# Two dotted lines for reference distribution in QuantilePlot

I'm using QuantilePlot to assess if my data fits a normal distribution using Mathematica 11.3.

My data set is large, 500000 points. A histogram of my data plotted with a normal distribution visually shows excellent agreement.

Here I use QuantilePlot to compare with a normal distribution (I get the same result if I explicitly use a normal distribution as the second data set):

QuantilePlot[data, ImageSize -> Large]


I can't find any reference to QuantilePlot plotting two parallel lines as the reference line. My data matches the lower of these two lines very well, but it is not clear what that means.

I tried plotting the quantiles of data against itself:

QuantilePlot[data, data, ImageSize->Large]


This should be a perfect match, and it is, but again with the lower dotted line.

To try this for yourself I came up with:

normaldist=RandomVariate[NormalDistribution[1,0.5],100000];
QuantilePlot[normaldist, normaldist, PlotRange->{{0,0.02},{-0.01,0.02}}, ImageSize->Large]


What is the second dotted line? All the examples in the documentation do not show a second line until you 'zoom in' using PlotRange.

• This feels like a bug to me. Contact WRI Support to see if they agree. Feb 21 '19 at 12:42
• Seems the issue is related to specifying the PlotRange option. Remove that option and the plot appears with the single reference line. Feb 21 '19 at 12:44
• The second line does not appear with version "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)" Feb 21 '19 at 15:28
• Only one line in both "10.4.1 for Linux x86 (64-bit) (April 11, 2016)" and "11.3.0 for Linux x86 (64-bit) (March 7, 2018)". Feb 22 '19 at 12:07

At first glance this appears to be a bug. I suggest reporting it to WRI Support.

As a workaround you only need to remove the PlotRange option and the plot will display with the single reference line.

QuantilePlot[normaldist, normaldist,
ImageSize -> Large
ReferenceLineStyle -> Directive[Orange, Thick]]


Hope this helps.

• Thanks for answering. The first plot I posted did not use the PlotRange option, and still had the double line. I think in your example there are still two lines, just so close together as to be indistinguishable, and that's why when you look at a smaller region using PlotRange you can see them. Feb 21 '19 at 13:13
• @L.Cowie Most likely a bug. Contact WRI Support. Feb 21 '19 at 13:26

I ended up making a Quantile-Quantile plot myself to get around this. It's really slow and doesn't give the exact same result as QuantilePlot (less points?). But it will do. Perhaps someone else has a better way?

qsize = 0.00001;
quantiles = Quantile[data, #] & /@ Range[qsize, 1, qsize];
normalquantiles =
Quantile[NormalDistribution[Mean[data],
StandardDeviation[data]], #] & /@ Range[qsize, 1, qsize];
Show[ListPlot[Transpose[{normalquantiles, quantiles}],
PlotRange -> {{87.6, 89.65}, All}, ImageSize -> Large],
Plot[x, {x, 86, 92}, PlotStyle -> Directive[{Lighter, Dotted}]]]


Gives