hi every body.my question is how can i plot subplot like this picture in Matlab. i want draw dotted line cross the subplots like red dotted line and write on it like blue circle.

9 views (last 30 days)

Accepted Answer

jonas
jonas on 24 May 2018
(1) learn how to use subplots
MATLAB has a function subplots() which is really easy to use. Personally I prefer the function tight_subplot() which is available on FileExchange ( link ), as it is a bit more convenient to specify the exact location of the axes.
(2) Once your plots are finished, you will want to make each axis invisible (except for the ones to the right):
set(gca,'ycolor','none','xcolor','none')
(3) learn about annotations
MATLAB can create a few default shapes, such as lines and circles, by the function annotation.
Try and see what happens, then post your results here and ask for more help if needed!
  2 Comments
ali jafari
ali jafari on 24 May 2018
thank you so much. in fact i want draw figure like below. i don't now this figure draw with 'plot' command or 'subplot' command? and what is your suggest.
jonas
jonas on 24 May 2018
Edited: jonas on 24 May 2018
Then I'm going to recommend using tight_subplot() from fileexchange. I have given you something to start from,
%create 8x2 axes
[ha,pos]=tight_subplot(8,2,0.01,0.1,0.2)
%access one axes and plot something
axes(ha(1))
area([sin(0:0.01:2*pi)])
set(ha,'xcolor','none','ycolor','none')
%change properties of a single axes
set(ha(2),'ycolor',[0 0 0],...
'YAxisLocation','right')
%create lines (not connected to any axes)
l=annotation('line',[0.7 0.7],[0 1],...
'linestyle',':',...
'color',[1 0 0],...
'linewidth',3)
%create some text
t=annotation('textbox',[0.1 0.1 0.1 0.1],...
'string','hello!',...
'edgecolor','none')
This should give you an idea of what to do

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!