Plotting in four data sets in quadrants of a single graph
7 views (last 30 days)
Show older comments
Hi,
I have 4 data sets that I want to plot in one graph, each data set occupying a single quadrant of a graph. It would be similar to subplot, but I do not want four separate plots. I want 4 imbedded plots in one graph. How can I split the graph in order to do this?
How can I do this in matlab?
0 Comments
Answers (1)
José-Luis
on 7 Nov 2012
Edited: José-Luis
on 7 Nov 2012
I am not sure I understand what you mean. Subplot sounds like the solution for this problem. If by a single graph you mean you only want one axes, then the solution that comes to mind is to offset your data and plot it. Assuming all have common x values, and four different y's (column vectors):
off_x = max(x) - min(x);
off_y = max([max(y1)-min(y1), max(y2)-min(y2), max(y3)-min(y3), max(y4)-min(y4)]);
plot(x,y1); hold on;
plot(x+off_x,y2);
plot(x+off_x,y3+off_y);
plot(x,y4+off_y);
Note that you would need to play with the tick labels for them to make sense. Also, if what you want to avoid spaces between the subplots, you could create custom axes, e.g.:
h1 = axes('Position',[0.1 0.1 0.4 0.4]);
h2 = axes('Position',[0.1 0.5 0.4 0.4]);
h3 = axes('Position',[0.5 0.5 0.4 0.4]);
h4 = axes('Position',[0.5 0.1 0.4 0.4]);
See Also
Categories
Find more on 2-D and 3-D 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!