Plotting in four data sets in quadrants of a single graph

7 visualizaciones (últimos 30 días)
Avigdor
Avigdor el 7 de Nov. de 2012
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?

Respuestas (1)

José-Luis
José-Luis el 7 de Nov. de 2012
Editada: José-Luis el 7 de Nov. de 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]);

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by