Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Broken Plot

As you can see in the example image above, I am frequently (but not always) seeing broken line plots when I try to overlay them on top of another plot using Show.

This is especially common when plotting on top of a BoxWhiskerChart, like above, but I have seen similar artifacts with other combinations of graphics.

It seems like this is probably a bug, but is there a way to work around it?

EDIT: As requested, here is example data and code that reproduces the plot:

d1 = {{380.85484658712056, 286.8907758484098, 
    277.5346417980861, -260.9698886255429, -212.00464593127498}, \
    {110.64430107319674, 144.47675987473627, 
    99.93373512263015, -56.177881856948964, 
    29.868418465268505}, {43.12802057882277, -68.16017567325775, 
    14.084311318612794, -36.20880886565394, -81.87985320930875}, \
    {106.99911157544254, -31.663203349930104, -27.570575917736175, 
    61.25746244652189, 
    0.07927149668211417}, {22.786524517448473, -40.71909598294233, \
    -5.457645151349941, -43.881578084779825, -56.53761318830431}, \
    {-23.848477320370613, 6.595731836165279, 49.84565391704327, 
    14.463305228579669, 
    1.7165492496714267}, {-24.233241726829753, -34.41986971239141, 
    71.77402199374153, 
    6.240151571212979, -9.893448889735769}, {27.530209189665232, \
    -39.16537688719902, 7.934274688868037, 21.450252634259602, 
    22.436356176565518}, {5.815740478111099, -19.121655982833524, 
    6.276548184966871, -6.191562514728518, 
    8.163468204721694}, {-1.1095960641474583, -1.8024030708469272, 
    0.5884529855628465, 6.78776508911811, 
    3.2052724335758094}, {1.9945820939801755, -4.961791563938944, 
    0.7207552625366906, -23.034734413964447, 
    23.31037162230476}, {7.791172424307904*^-14, \
    -2.810291307094996*^-14, 5.16543833023678*^-14, 
    1.6887681396769957*^-14, -6.281861164741391*^-14}};
d2 = {{-179.0813322830084, 168.63728065982806, 
    7.613650128893625, -52.78046442802247, 
    4.762591758605045, -5.301920135661192, -20.832115595725575, \
    -4.066331598432242, 14.421498996215757, 2.7434661239850864, 
    4.4509223705660865, 6.406095853462969*^-14}};
Show[BoxWhiskerChart[d1, "Outliers"], ListLinePlot[d2]]
share|improve this question
3  
please add copyable code (with sample data) so that people don't have to read your image and have to spend time writing one of their own. Also, I don't think this is a bug... most probably just carelessness with different plot ranges and related options –  rm -rf May 1 '12 at 19:08
1  
Looks like you need to add PlotRange -> All for the call to ListLinePlot. –  Brett Champion May 1 '12 at 19:16
    
Aha, I thought I didn't need PlotRange -> All because the axes are "inherited" from the first plot, but this does indeed fix it! Please write this as an answer so I can accept it. –  Kaelin Colclasure May 1 '12 at 19:24
add comment

1 Answer 1

up vote 7 down vote accepted

The reason this is cut off is because the ListLinePlot's PlotRange does not cover all the values:

ListLinePlot[d2]

Mathematica graphics

When this is included in the Show it is still cut off. If, instead, you do:

ListLinePlot[d2,PlotRange->All]

Mathematica graphics

it includes all the points. Then, the whole thing will show up when you use Show:

Show[BoxWhiskerChart[d1, "Outliers"], ListLinePlot[d2, PlotRange -> All]]

Mathematica graphics

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.