MATLAB Answers

How to plot a graph along with axes graph?

1 view (last 30 days)
Jhon Gray
Jhon Gray on 23 Aug 2020
Edited: dpb on 23 Aug 2020
I want to creat a plot like this. is there any function for this? How to make it?

  0 Comments

Sign in to comment.

Accepted Answer

dpb
dpb on 23 Aug 2020
Edited: dpb on 23 Aug 2020
Just build custom-placed subplot() axes...something like
I=imread('ngc6543a.jpg'); % just an image to use later...
figure
pos1=[0.1 0.3 0.2 0.6]; % guess at position vector for first axes
pos2=[pos1(1)+pos1(3)+0.05 pos1(2) 0.9-(pos1(1)+pos1(3))-0.05 pos1(4)]; % adjust for second
pos3=[pos2(1) 0.1 pos2(3) pos2(2)-0.15]; % and for third..
hAx(1)=subplot('Position',pos1); box on
hAx(2)=subplot('Position',pos2); box on
hAx(3)=subplot('Position',pos3); box on
hAx(1).YScale='log';
hAx(1).YLim=[0.10 35];
hAx(1).YTick=2.^[0:8]/8;
hAx(3).YLim=[-100 100]; hAx(3).XLim=[0 30];
image(hAx(2),I)
hAx(2).XTick=[];hAx(2).YTick=[];
resulted in
Hadn't yet added the colorbar and looks like could have made the width for hAx(1) somewhat smaller which will leave a little more room for it.
Basic form for what asked for, though, it would appear...
ADDENDUM:
NB: subplot is unneeded here; just use axes. I had initially tried to see if could smoosh together some but it only works to merge contiquous numbers, but then didn't change the call...

  0 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by