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]);
  1 件のコメント
Avigdor
Avigdor 2012 年 11 月 7 日
Thanks! I'll give it a try!

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-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