Plotting in four data sets in quadrants of a single graph

조회 수: 7 (최근 30일)
Avigdor
Avigdor 2012년 11월 7일
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