One plot line is messing up the two other plot lines/points

4 visualizzazioni (ultimi 30 giorni)
My second plot() command is messing up the other two plot() commands from displaying properly.

Risposte (1)

Steven Lord
Steven Lord il 22 Set 2025
In your second plot, the Y axis limits are 0 and 4. Your data points for your first and third lines all have Y coordinates in that interval.
In your first plot, note that the Y axis has a little "x10^5" above it. That means the Y axis limits are 0 and 1200000. The data points from your second line span that range. The points from your first and third lines only take up a very small portion of that range, meaning those lines are essentially indistinguishable from the line Y = 0.
As an analogy, if you had $1.2 million, would you care about spending an extra $4? Or would that be something where you'd say "Sure, whatever, that's small change."
This is not a bug. This is "Your data spans too wide a range to show them both on a linear Y axis plot and see the fine details of all the lines."
You could try setting the Y axis to logarithmic scale using semilogy instead of plot. Note that straight lines (linear data) don't appear straight in log scale.
x = 1:100;
plot(x, x)
title('Linear Y scale')
figure
semilogy(x, x)
title('Logarithmetic Y scale')
  1 Commento
Ronin
Ronin il 22 Set 2025
Thank you so much this allowed me to realize I made an error earlier in the code where I forgot to put a *1e-3 this made my data to scale.

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by