0
$\begingroup$

I'm trying to combine an ErrorListPlot with another Plots. Without the ErrorListPlot, it's working good. But, when I include it in the Show function, only the ErrorListPlot appears, and the other Plots are gone. How can I fix this?

Thanks in advance, Gabriel

$\endgroup$
2
  • $\begingroup$ Could you provide a simple code example of something that doesn't work? E.g., I've no problem with: Show[ErrorListPlot[Table[{i, RandomReal[0.5]}, {i, 10}]], Plot[{x^2, x}, {x, 0, 10}]] $\endgroup$ Commented Sep 2, 2017 at 21:05
  • $\begingroup$ Here is an image with and without the ErrorListPlot inside the Show function: link. Thanks for your time, @JohnJosephM.Carrasco $\endgroup$ Commented Sep 2, 2017 at 21:41

1 Answer 1

1
$\begingroup$
  1. Without having access to your actual code & data, you're asking for people to help debug by glancing at your image. You'll get better answers if you include a small working example that gets at your problem. (People like to tinker). Worst case you can always paste your full example into pastebin or gist.
  2. Show has the plot range default to the first object, and you seem to have drastically different scales. In this case it looks like your y-intercept occurs higher than the scale of your error list plot.

I can reproduce with the following:

Here I'll plot the bigger one first so you can see all the data is actually there (if difficult to parse):

Show[Plot[{100 + x^13, 1000 + x^7}, {x, 0, 10}], 
 ErrorListPlot[Table[{i, RandomReal[0.5]}, {i, 10}]]]

yields:

enter image description here

Now let's see what happens when we do something similar to what you seem to have going on:

Show[ErrorListPlot[Table[{i, RandomReal[0.5]}, {i, 10}]], 
 Plot[{100 + x^13, 1000 + x^7}, {x, 0, 10}]]

yielding:

enter image description here

Note: Since we are stuck to the scale of the error list plot, and the other plot doesn't start until the y-axis is greater then 100 we don't see any of it.

We can start smashing them together by manually enlarging the plot range:

Show[ErrorListPlot[Table[{i, RandomReal[0.5]}, {i, 10}]], 
 Plot[{100 + x^13, 1000 + x^7}, {x, 0, 10}], PlotRange -> {0, 150}]

enter image description here

In this case things really don't belong on the same plot. Maybe your data won't look so crazy when you include your PlotRange->{0,3}

$\endgroup$
1
  • 1
    $\begingroup$ You are right! Inside my messy code, I've changed some data that completely altered the scale of the lines. I found it and then the Show function worked pretty fine. Thank you! $\endgroup$ Commented Sep 2, 2017 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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