# Plotting data with extremely small variation in the dependent variable

I have a dataset like

data = {{-5., 1.00000000000000004968}, {-4.5, 1.00000000000000004510},
{-4., 1.00000000000000004200}, {-3.5, 1.00000000000000004144},
{-3., 1.00000000000000004012}, {-2.5, 1.00000000000000003979},
{-2., 1.00000000000000004132}, {-1.5, 1.00000000000000004208},
{-1., 1.00000000000000004284}, {-0.5, 1.00000000000000004726},
{0., 1.00000000000000004284}, {0.5, 1.00000000000000004350},
{1., 1.00000000000000004312}, {1.5, 1.00000000000000004073},
{2., 1.00000000000000003956}, {2.5, 1.00000000000000004256},
{3., 1.00000000000000003917}, {3.5, 1.00000000000000004538},
{4., 1.00000000000000004671}, {4.5, 1.00000000000000004685},
{5., 1.00000000000000004719}}


However ListPlot[data] just gives a bunch of datapoints with constant ordinate. How can I visualize the small variations of the ordinates?

• Try ListPlot[data] – Coolwater Sep 15 '16 at 8:36
• Have you tried searching the documentation for "plot data"? What did you find? – Szabolcs Sep 15 '16 at 8:36
• At risk of missing the original problem, I've edited this question. If I distorted your intent, feel free to roll back. – LLlAMnYP Sep 15 '16 at 10:17
• I don't think this should closed as a simple mistake. There is a real, non-trivail issue being raised. – m_goldberg Sep 15 '16 at 12:06
• I expected ListPlot[data, PlotRange -> MinMax /@ Transpose@data] to set the y-axis appropriately, but it turns out it just completely ignores it (presumably because it ignores a PlotRange where the two endpoints are "equal") – KraZug Sep 15 '16 at 12:16

I suggest modifying the y-coordinates by subtracting of 1.0, while compensating for that in the list plot by adding 1.0 to frame tick labels for the y-coordinates.

data =
{{-5., 1.00000000000000004968}, {-4.5, 1.00000000000000004510},
{-4., 1.00000000000000004200}, {-3.5, 1.00000000000000004144},
{-3., 1.00000000000000004012}, {-2.5, 1.00000000000000003979},
{-2., 1.00000000000000004132}, {-1.5, 1.00000000000000004208},
{-1., 1.00000000000000004284}, {-0.5, 1.00000000000000004726},
{0., 1.00000000000000004284}, {0.5, 1.00000000000000004350},
{1., 1.00000000000000004312}, {1.5, 1.00000000000000004073},
{2., 1.00000000000000003956}, {2.5, 1.00000000000000004256},
{3., 1.00000000000000003917}, {3.5, 1.00000000000000004538},
{4., 1.00000000000000004671}, {4.5, 1.00000000000000004685},
{5., 1.00000000000000004719}};
dataX = data[[All, 1]];
dataY = data[[All, 2]] - 1;
plotPts = Transpose[{dataX, dataY}];
divisions = FindDivisions[MinMax[dataY], 5] // N


{3.75*10^-17, 4.*10^-17, 4.25*10^-17, 4.5*10^-17, 4.75*10^-17, 5.*10^-17}

ListPlot[plotPts,
Axes -> False,
Frame -> True,
FrameTicks -> {{{#, Row[{"1 + ", #}]} & /@ divisions, None}, Automatic}]


• Turns out, this is a more interesting question, than one would realize at face value. I guess, the real question is "how to plot at better than machine precision?" +1 for going to so much trouble – LLlAMnYP Sep 15 '16 at 11:40
• @LLlAMnYP. The real problem is that Plot, in the end, will always have to draw at machine precision. So the data and the plot scales have to be manipulated to accommodate that fact. – m_goldberg Sep 15 '16 at 11:49
• I would simply draw dataY and emphasize (e.g., by appropriate labeling the vertical axis) that this is $y-1$. In my opinion it's easier to compreend the plot that way; one thinks of it as the magnitude of variations around 1 and can focus on the $10^{-17}$ parts, not on realizing how high above the zero each point is. – corey979 Sep 15 '16 at 16:01

Looks like a pretty boring plot, unless you do something to visualize those very small variations in the ordinate. Maybe this can point you in the right direction:

data = {{-5., 1.00000000000000004968}, {-4.5, 1.00000000000000004510},
{-4., 1.00000000000000004200}, {-3.5, 1.00000000000000004144},
{-3., 1.00000000000000004012}, {-2.5, 1.00000000000000003979},
{-2., 1.00000000000000004132}, {-1.5, 1.00000000000000004208},
{-1., 1.00000000000000004284}, {-0.5, 1.00000000000000004726},
{0., 1.00000000000000004284}, {0.5, 1.00000000000000004350},
{1., 1.00000000000000004312}, {1.5, 1.00000000000000004073},
{2., 1.00000000000000003956}, {2.5, 1.00000000000000004256},
{3., 1.00000000000000003917}, {3.5, 1.00000000000000004538},
{4., 1.00000000000000004671}, {4.5, 1.00000000000000004685},
{5., 1.00000000000000004719}};

ListPlot[{#[[1]], Log@#[[2]]}& /@ data, Joined -> True]


• Thanks dionys. This will help me. – ayyappan Sep 15 '16 at 9:05
• Thank you all. All answers are helping me. – ayyappan Sep 15 '16 at 16:28
• Suppose my data Set contains more than 500 points it is not working.@ m_goldberg, Corey 979. – ayyappan Sep 15 '16 at 16:56