Dear MATLAB answers,
I have here a plot that I need to replicate using my own data. I tried looking through help pages with all the different type of plots, but was having difficulty figuring out how to create the scatter type plot with offsets as shown in attached image. I would be able to plot the lines, curves, etc, but those too I would not know how to offset.
Therefore, my question is:
  1. how to create scatter plot of type shown
  2. how to offset scatter/line/curve in standard way shown in image
Thank you in advance for your guidance!
examplePlot.JPG

5 件のコメント

Bob Thompson
Bob Thompson 2019 年 1 月 31 日
Are the results actually 'offset'? To me 'offset' indicates that the data should overlap, but has been deliberately moved by a fixed increment in order to make all points more visible. Is this what you mean? It looks to me like there are just three different data sets that appear at regular intervals.
As for creating a scatter plot, I would suggest creating a quick loop for each data set. Somethign like this:
hold on
for i = 1:numdata
scatter(x_values,y_values,formatting) % Where formatting is a string of characters wich dictates the format of the plotted data (color, shape, etc.)
end
Adenine Pall
Adenine Pall 2019 年 2 月 1 日
Thank you for the response, but yes the data is offset for exactly the reason you described: to make all points more visible. The data would overlap otherwise.
Adam Danz
Adam Danz 2019 年 2 月 1 日
編集済み: Adam Danz 2019 年 2 月 1 日
To vertically offset on a linear axis, you just have to add a constant to the data. For the example in the image, assuming the data used to overlap with the blue, a value of ~0.2 was added to the red data and a value of ~0.4 was added to the green data.
scatter(x, y+0.2)
Adenine Pall
Adenine Pall 2019 年 2 月 1 日
編集済み: Adenine Pall 2019 年 2 月 1 日
thank you very much - this works! I probably should have been able to figure that out, but what was and still is confusing: wouldn‘t offseting like this make tick marks on y-axis irrelevant to the data we are showing?
Adam Danz
Adam Danz 2019 年 2 月 1 日
編集済み: Adam Danz 2019 年 2 月 1 日
Yes, precisely!
Vertical offsets like this obfuscate the dependent variable and the y axis no longer describes the offseted data. Nevertheless, the caption in the figure you shared indeed states that the data were vertically offset.

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

 採用された回答

Adam Danz
Adam Danz 2019 年 2 月 1 日

1 投票

(comment moved here so that the question is answered)
To vertically offset on a linear axis, you just have to add a constant to the data. For the example in the image, assuming the data used to overlap with the blue, a value of ~0.2 was added to the red data and a value of ~0.4 was added to the green data.
scatter(x, y+0.2)

その他の回答 (0 件)

カテゴリ

質問済み:

2019 年 1 月 31 日

回答済み:

2019 年 2 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by