필터 지우기
필터 지우기

Two ordinate axes on a single plot

조회 수: 7 (최근 30일)
Rick
Rick 2014년 10월 16일
댓글: Rick 2014년 10월 17일
Hello,
I'm trying to reduplicate this plot on MATLAB. I see that the scale of the two different y-axes needs to be very different. How do I make it so that the right side of the plot will have a separate axis than the left side, as seen in this plot which shows both concentration (of multiple species) vs. distance down the reactor as well as conversion vs. distance.
I have of course managed to make the conversion plot, just not the concentration plot. I attached the plot I am trying to make on MATLAB.

채택된 답변

Orion
Orion 2014년 10월 17일
your Ytick may still be there. Did you try to change the size of the figure ?
otherwise, just get the handle of the axes :
hAx = plotyy(z,[CA,CB,CC],z,Conversion);
and reset the Ytick values with a new set of Ytick
set(hAx(1),'YTick',value_for_axe_left)
set(hAx(2),'YTick',value_for_axe_right)
  댓글 수: 1
Rick
Rick 2014년 10월 17일
Thanks, everything is good now!

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

추가 답변 (2개)

Orion
Orion 2014년 10월 16일
Hello,
you need to use plotyy, which does exactly what you're expecting.
  댓글 수: 1
Rick
Rick 2014년 10월 16일
How do I use it when I have multiple things I want to plot?
Conversion = linspace(0,0.8,1000);
for i = 2:numel(Conversion)
V_PFR(i) = (FA0/(k2*CA0)).*integral(f,Conversion(1),Conversion(i));
A = 0.0205; % ft^2
z(i) = V_PFR(i)/A/100; % ft
CA(i) = CA0*((1-Conversion(i))/(1+epsilon*Conversion(i)));
CB(i) = CA0*Conversion(i)*(1-Conversion(i)/(1+epsilon*Conversion(i)));
CC(i) = CA0*Conversion(i)*(1-Conversion(i)/(1+epsilon*Conversion(i)));
end
plotyy(z,CA,z,CB,z,CC,z,Conversion,'plot')
xlabel('distance down the reactor (ft)')
ylabel('Concentration (lb mol/ft^3)')

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


Orion
Orion 2014년 10월 16일
편집: Orion 2014년 10월 16일
something like
plotyy(z,[CA,CB,CC],z,Conversion)
% assuming CA,CB,CC are columns vectors. otherwise, transpose them.
  댓글 수: 1
Rick
Rick 2014년 10월 17일
편집: Rick 2014년 10월 17일
Now that I have it, I lost my tick marks on the ordinate axes. It only shows the first and last points.

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

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by