Plotting in four data sets in quadrants of a single graph

7 次查看(过去 30 天)
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?

回答(1 个)

José-Luis
José-Luis 2012-11-7
编辑:José-Luis 2012-11-7
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]);

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by