Anyone knows how to subplot graphs obtained from created matlab functions??

2 views (last 30 days)
Hi all,
anyone can help me to make subplots for scatters plots coming from a function??, i.e.
function(X,Y,50,'b.',Z); % This is a scatter plot that have a scatter plot and a bar plot % represented in the secondary axis
I'm trying to make subplots for this function as:
subplot(15,1,1); function((X1,Y1,50,'b.',Z1)
subplot(15,1,2); function((X1,Y2,50,'b.',Z1).... and so on....
This way it is not working....!!! any of you guys have some ideas about the correct way to do it??
Thanks,
Rodrigo
thanks

Answers (1)

Harsha Medikonda
Harsha Medikonda on 4 Aug 2014
It seems like your function does the scatter plot. If it is possible to return the handle of the scatter plot as an output argument from the function, you could then use it to set the parent property of the scatter plot to the appropriate subplot axes. Alternatively you could also set the axes handle created using subplot and pass it to the scatter function as shown in the below link. This is useful to plot on the axes directly. <http://www.mathworks.com/help/matlab/ref/scatter.html#btrli6q-1 scatter >
The sample code below does subplotting of 2 scatter plots Using the handle from the scatter function, parent properties for the plots are set.
%x1 = -10:.1:10;
%y1=x1.^2;
%f1=figure('visible','off');
%h1=scatter(x1,y1);
%x2 = -5:.1:5;
%y2=x2.^3;
%f2=figure('visible','off');
%h2=scatter(x2,y2);
%figure
%a=subplot(1,2,1);
%b=subplot(1,2,2);
%set(h1,'parent',a);
%set(h2,'parent',b);
%close(f1,f2);
Refer to the link below for documentation on using "Set" Set documentation

Categories

Find more on Discrete Data Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!