could anyone help me how to solve the issue

1 visualizzazione (ultimi 30 giorni)
jaah navi
jaah navi il 4 Lug 2019
Commentato: Rik il 5 Lug 2019
I am getting the attached graph when i run the code.
In graph i want to remove zero with respect to y axis where as the rest of the values on y axis should remain same.
Could anyone please help me on this.
  3 Commenti
Shashank Sharma
Shashank Sharma il 4 Lug 2019
Do you want to change the y limits ?
If so the function ylim can be used.
ylim( [ ymin, ymax ] )
In the above function if you set the ymin to be greater than 0. The 0 will no longer be displayed on the plot
jaah navi
jaah navi il 4 Lug 2019
x=[0.1 1 2 3 4]
y=[0.07 0.09 0.09 0.09 0.09]
z=[0.12 0.18 0.18 0.18 0.18]
l=[0.5 0.58 0.58 0.58 0.58]
m=[0.5 1 1 1 1]
plot(x,y,'-*')
hold on
plot(x,z,'-^')
hold on
plot(x,l,'-*')
hold on
plot(x,m,'-^')
hold on
xlim([0,4]);
set(gca,'XTick',[0:1:4]);
ylim([0,1.1])
set(gca,'YTick',[0:0.2:1.1])
I have used ylim([0,1.1]) so yaxis starts from 0.
what i actually need is y axis needs to start from 0 but 0 should not appear on the yaxis.
Could you please help me on this.

Accedi per commentare.

Risposta accettata

Rik
Rik il 4 Lug 2019
Modificato: Rik il 4 Lug 2019
If you want to not show a tick, you can remove it by explicitly skipping it.
ylim([0,1.1])
set(gca,'YTick',[0.2:0.2:1.1])
You can also choose to automatically remove the first tick after plotting:
ylim([0,1.1])
ticks=get(gca,'YTick');
set(gca,'YTick',ticks(2:end))
  3 Commenti
jaah navi
jaah navi il 5 Lug 2019
it works.
Could you please help me how to skip the first tick from x axis initial point to forward to some distance as shown in attached figure.
Rik
Rik il 5 Lug 2019
You mean something like xlim([-0.1 3.1])?

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by