Filter löschen
Filter löschen

could anyone help me how to solve the issue

1 Ansicht (letzte 30 Tage)
jaah navi
jaah navi am 4 Jul. 2019
Kommentiert: Rik am 5 Jul. 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 Kommentare
Shashank Sharma
Shashank Sharma am 4 Jul. 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 am 4 Jul. 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Rik
Rik am 4 Jul. 2019
Bearbeitet: Rik am 4 Jul. 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 Kommentare
jaah navi
jaah navi am 5 Jul. 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 am 5 Jul. 2019
You mean something like xlim([-0.1 3.1])?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by