## How to overlap time vectors and plot in multiple axis ?

Jeevan Kumar Bodaballa

### Jeevan Kumar Bodaballa (view profile)

さんによって質問されました 2019 年 11 月 21 日 15:39

### dpb (view profile)

さんによって 回答されました 2019 年 11 月 22 日 13:10
Ridwan Alam

### Ridwan Alam (view profile)

さんの 回答が採用されました
Here are my questions !
How can I add third Y-axis in same plot
Here in data 6 variables(dt,temptime,Tout,RHout,Sat,mix) are present and I would like have
dt & temptime variables in x-axis
Sat & RHout in yyleft axis
Tout in yyright axis
mix in yyright as third axis

dpb

### dpb (view profile)

2019 年 11 月 21 日 16:51
So what did you try and where did you have a problem?
Walter Roberson

### Walter Roberson (view profile)

2019 年 11 月 22 日 9:53
Jeevan Kumar Bodaballa if you consider your question to be unclear, then as you are the person who asked the question, you should clarify the question.

サインイン to comment.

## 2 件の回答

### Ridwan Alam (view profile)

2019 年 11 月 21 日 21:54

### Ridwan Alam (view profile)

2019 年 11 月 21 日 22:07
採用された回答

Hope this helps:
fig=figure(1);
yyaxis left
plot(dt,Sat,'b--','Linewidth',2);
% hold on;
% plot(temptime(3470:3578),RHout(3470:3578),'b.','Linewidth',2);
ylabel('Saturation and RH');
hold on;
yyaxis right
plot(dt,mix,'r-','LineWidth',2);
hold on;
plot(temptime(3470:3578),Tout(3470:3578),'r.','LineWidth',2)
xlabel('Time (h)'); %
ylabel('Mixing ratio [Kg/Kg]');
set(gca, 'YScale', 'log');
grid on

Ridwan Alam

### Ridwan Alam (view profile)

2019 年 11 月 22 日 0:28
I don't think I have seen or known how to do anything like that. Sorry! I would like to know/learn if that's possible as well.
One way might be to rescale the 'Tout' data to the same scale as 'Mix' and plot it. Still I don't think you can assign two different ylabels to the same axis. But again, I might be wrong.
If you find out my answer is okay, please accept as an answer. If you liked the conversation, please vote up as well. Thanks!
dpb

### dpb (view profile)

2019 年 11 月 22 日 0:39
There's not a function supplied with Matlab to have more than the left/right axis.
You either have to "roll your own" by shrinking the existing axis in the x direction enough and creating a new one or use one of the FEX submittals. I know there are some over there but I've not used any so can't recommend any particular one as the gold standard.

サインイン to comment.

### dpb (view profile)

2019 年 11 月 22 日 13:10

#### 0 件のコメント

サインイン to comment.

Translated by