필터 지우기
필터 지우기

plotyy with different data ranges to visually appear equal.

조회 수: 1 (최근 30일)
Clifford Shelton
Clifford Shelton 2012년 10월 23일
Ok. When making a line plotyy graph, the two y-axis have data with different ranges.
For example
y(1) has a range from 0:14
and
y(2) has a range from 5.9:6.35
Because of this difference in ranges, the second line graph is generated to "float above" the first line graph in the plot.
What I want to do is have the two line graphs fit in the graph where even though they have different value ranges, one doesn't float over the other (maybe in other words to have the same local max and same local min.)
So that the value of 5.9 on y(2) will visually meet with the value of 0 on y(1) in the plotyy graph.
Any help is most appreciated!
  댓글 수: 1
Matt Fig
Matt Fig 2012년 10월 24일
Please create real example code that can be copied and pasted. Once you give code that will run so that we see what you see, then give a description of what you want to see.

댓글을 달려면 로그인하십시오.

답변 (2개)

Doug Hull
Doug Hull 2012년 10월 23일
plotyy might be the function you seek!
  댓글 수: 1
Clifford Shelton
Clifford Shelton 2012년 10월 24일
thanks for the suggestion, but I'm using the plotyy function. I may not have made myself clear. Please see my comment to Walter Robinsons answer....I hope I'm much clearer then. Thanks for the help!

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2012년 10월 23일
You should be able to set() the YLim properties of the two axes objects independently.
  댓글 수: 1
Clifford Shelton
Clifford Shelton 2012년 10월 24일
편집: Clifford Shelton 2012년 10월 24일
Thanks for the suggestion, there is one problem though. I'm generating a bunch of plotyy charts that all have different value ranges. And I don't even know what the value ranges will be until the graphs are generated.
For the example: data range of y(1) = 0:10
data range of y(2)= 5.9:6.3
after creating a plotyy chart the y(2) data is always plotted "floating" above my y(1) data because the y(1) graph always has an automatic Y minimum set at 0.
However The y(2) line graph however has a Y minimum that changes. (may be set at 5 or 4.5 which makes this seond line "float above" the y1 line.)
Is there anyway to code in that the y(2) Ylim properties are always set to be the local minimum and maximums of my y(2) data range?
That would be the easiest way I can think of solving this problem.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by