How to position the y axis on the right in a plot

I have two vectors f(t) and g(t) and I want to plot them in one graph using plotyy. But I also want to do some other things like changing the marker style of each curve and also changing the span of the axes. I have tried using xlim but it only affects one of the x axes, not both.

 Akzeptierte Antwort

Ingrid
Ingrid am 28 Jan. 2016

0 Stimmen

you need to use the handles for this so
[hAx,hLine1,hLine2] = plotyy(x,y1,x,y2);
xlim(hAx(1),...)
xlim(hAx(2),...)
this is also very well explained in the documentation of plotyy
doc plotyy

4 Kommentare

Imam
Imam am 28 Jan. 2016
And the second argument on each xlim will be the vector specifying the limits?
Ingrid
Ingrid am 28 Jan. 2016
indeed, the same as you have tried to use xlim, but now with explicitly specifying to which axes the xlim needs to be applied
Another question please, I also want my plot to be of only marker-defined, meaning the data points are marked with certain marker type without connecting line. I have added
set(hLine1,'Marker','o','MarkerSize',10)
The marker appears as desired but the connecting line between data points still exist. How can I remove the line?
set(hLine1,'LineStyle','none')
this is clearly explained in the documentation of plot

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Tags

Gefragt:

am 28 Jan. 2016

Kommentiert:

am 29 Jan. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by