Combine two existing Matlab figs, into one figure with two y axes (keeping the respective axes titles and units)

2 次查看(过去 30 天)
Hi, I have two Matlab figs, although not the original data in a *.mat file, which share the same 'x' axis, but not 'y' (one curve in each figure). I wish to combine Fig. 2 into Fig, 1, but have two y axes, with the original axis titles and units. I also wish to keep the original symbols and the same color map for the curves from the two pictures. What is the easiest way to do that?
Thank you.
  4 个评论
dpb
dpb 2018-8-5
编辑:dpb 2018-8-5
I think I mistyped/misnamed the new world replacement for the deprecated plotyy :)
-- it's |yyaxis| instead. Sorry...
ADDENDUM
I did just try a 'spearmint; took the example for two axes and created two figures instead of the L/R axes. Then with some rigamarole to get all the necessary handles to the lines that are children of their respective axes,
yyaxis left
hAxL=gca;
copyobj(hL1,hAxL)
yyaxis right
hAxR=gca;
copyobj(hL2,hAxR)
did bring over the line colors, markers, etc., ... I didn't experiment with the titles and all, but the basic operations seems to work ok.
Erez
Erez 2018-8-6
编辑:Erez 2018-8-6
Thanks a lot, but unfortunately it still doesn't work. Ok, I've copied your exact code. I also had a mistake, I am using Matlab 2014b, so maybe this version is not familiar with this syntax. The error message is:
"Undefined function 'yyaxis' for input arguments of
type 'char'.
Did you mean:
>> axis left "
Perhaps there is a way to download the function `yyaxis' and add it into my script?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by