# Two DistributionChart results in single plot

I have two sets of data that live on different scales, but I would like to plot them together to show the distributions of values side-by-side. Is there a way to add a second y-axis on the right that corresponds to (and scales) that respective data properly.

For example:

DistributionChart[{RandomReal[{0, 1.5}, 1000],
RandomReal[{0, 0.01}, 1000]}]


generates a squished distribution for the second variable. I'd like a second y axis on the right that goes from say (0,0.01).

SeedRandom[1]
{data1, data2} = {RandomReal[{0, 1.5}, 1000], RandomReal[{0, 0.01}, 1000]};


You can Rescale data2 to have the same scale as data1 and construct the correct frame ticks for the right edge using ChartingFindTicks:

DistributionChart[{data1, Rescale[data2, MinMax @ data2, MinMax @ data1]},
FrameTicks -> {{Automatic,
ChartingFindTicks[MinMax @ data1, MinMax @ data2][## & @@ MinMax[data1]]},
{None, None}}]


To get the correct tooltips for data2, we can extract the tooltip from the DistributionChart with original data2 as input and use it as the tooltip for the rescaled data2:

tooltip2 = Cases[DistributionChart[{data2}], Tooltip[_, t_] :> t, All][[1]];
DistributionChart[{data1,
Tooltip[Rescale[data2, MinMax @ data2, MinMax @ data1], tooltip2]},
FrameTicks -> {{Automatic,
ChartingFindTicks[ MinMax@data1, MinMax@data2][## & @@ MinMax[data1]]},
{None, None}}]


Alternatively, you can use logarithmic scaling:

 DistributionChart[{data1,data2}, ScalingFunctions -> "Log"]
`

• Perfect, nice catch with tooltips. I didn't even notice the scaling issue until you edited the change. – Gregory May 24 '19 at 15:28