TransWikia.com

Bug in Filling between ListPlots?

Mathematica Asked on July 28, 2021

I am trying to plot three data sets with ListPlot and fill the space in between the curves and axis, as indicated in the examples below. But a very strange thing is happening, which seems like it must be a bug.

Data:

test1 = {{0.4, 0.1425}, {0.425, 0.1204}, {0.45, 0.098}, {0.475, 
    0.0777}}; 
test2 = {{0.4, 0.1416}, {0.425, 0.1178}, {0.45, 0.0925}, {0.475, 
    0.0701}}; 
test3 = {{0.4, 0.1415}, {0.41, 0.1325}, {0.42, 0.1227}, {0.425, 
    0.1173}, {0.43, 0.1118},
   {0.44, 0.1008}, {0.45, 0.0905}, {0.46, 0.0807}}; 

Plot code:

ListPlot[{test1, test2, test3},
 Filling -> {1 -> {2}, 2 -> {3}, 3 -> Axis},
 Frame -> True,
 Joined -> True,
 Mesh -> All,
 PlotRange -> {{.42, .46}, {.08, .14}}]

Result:

enter image description here

When the vertical plot range is decreased a bit so as to "zoom in" on the problematic region, the issue goes away:

ListPlot[{test1, test2, test3},
 Filling -> {1 -> {2}, 2 -> {3}, 3 -> Axis},
 Frame -> True,
 Joined -> True,
 Mesh -> All,
 PlotRange -> {{.42, .46}, {.08, .13}}]

enter image description here

Can I fix this so that the image is drawn correctly (as in the second image above) regardless of my PlotRange settings?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP