フィルターのクリア

Plotting on y-axis in form of offset for clarity ?

21 ビュー (過去 30 日間)
RS
RS 2015 年 4 月 16 日
編集済み: pfb 2015 年 4 月 16 日
I have data A (first column x axis, and following column are y axis, trying to plot such that y axis have some offset for clarity), I don't want to put some additional value to this, without putting additional value, How can I plot directly on y axis, so that it will have some offset on y axis. Thanks.
plot(A(:,1),A(:,2));
hold on
plot(A(:,1),A(:,3)-0.3;
plot(A(;,1), A(:,4)+0.3;

回答 (1 件)

pfb
pfb 2015 年 4 月 16 日
編集済み: pfb 2015 年 4 月 16 日
your solution should work, provided you close the parentheses
plot(A(:,1),A(:,3)-0.3);
plot(A(;,1), A(:,4)+0.3);
didn't you get an error message?
  2 件のコメント
RS
RS 2015 年 4 月 16 日
編集済み: RS 2015 年 4 月 16 日
yes, Is there any other methodology or something else, because sometime the guess value of 0.3 or 0.4 is too much for plot and plot changes to line form.
pfb
pfb 2015 年 4 月 16 日
編集済み: pfb 2015 年 4 月 16 日
That is a bit too vague.
You're asking for a code that decides what is the optimal offset for producing a clear plot.
However "a clear plot" is kind of a subjective notion.
Have you considered alternatives, such as a waterfall plot? See
doc waterfall
Update note that waterfall works along rows
What I was suggesting above is to use a third dimension to "offset" your data. You can do that also with "plot3". Whether this produces an acceptable plot depends on your data and your personal taste.
About your original question, you could perhaps do something like this
hold on
plot(A(:,1),A(:,2));
os = max(A(:,2))-min(A(:,3));
plot(A(:,1),A(:,3)+os);
os = os+max(A(:,3))-min(A(:,4));
plot(A(:,1),A(:,4)+os);
and so on. You can put that in a loop, if you have many columns.

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

カテゴリ

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