could anyone help me how to solve the issue

1 vue (au cours des 30 derniers jours)
jaah navi
jaah navi le 4 Juil 2019
Commenté : Rik le 5 Juil 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 commentaires
Shashank Sharma
Shashank Sharma le 4 Juil 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 le 4 Juil 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.

Connectez-vous pour commenter.

Réponse acceptée

Rik
Rik le 4 Juil 2019
Modifié(e) : Rik le 4 Juil 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 commentaires
jaah navi
jaah navi le 5 Juil 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 le 5 Juil 2019
You mean something like xlim([-0.1 3.1])?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by