How to begin axis from another value and make it a 0 point in plot matlab?
211 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have some measurements. On the x label they starts from 0 to 100, but from 23 I can see something change on the plot, so I want to show a plot from 23 to 100, and that is how i do this:
plot(x,y)
axis(23, 100, 0, 40)
let's say that y is from 0 to 40 and i don't want to change it.
But now I want to make 23 a 0, so then the 100 whould be 77- how can I make this?
Thanks
0 Commenti
Risposta accettata
Benjamin Kraus
il 5 Mar 2018
If you want the ticks on your plot to show something other than the real numbers, you can either (a) change the numbers, or (b) manually specify your tick values.
To demonstrate, let me create some fake data:
x = 0:100;
fakedata = x/10;
fakedata(24:end) = sin(fakedata(24:end)-2.3)+2.3;
plot(x, fakedata)
Your two options are to either: change the X-values to something different (recommended):
plot(x-23, fakedata)
xlim([0 77])
Or manually specify your tick values:
plot(x,fakedata)
xlim([23 100]);
xticks(23:10:100);
xticklabels(0:10:77);
Più risposte (3)
Jos (10584)
il 5 Mar 2018
1) change the limits
plot(x,y)
xlim([23 100])
2) change the data (not recommended)
plot(x,y-23)
0 Commenti
Vedere anche
Categorie
Scopri di più su Axis Labels in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!