Specifying the colour of a scatter plot

2 ビュー (過去 30 日間)
Yoanna Ivanova
Yoanna Ivanova 2019 年 9 月 30 日
コメント済み: Yoanna Ivanova 2019 年 9 月 30 日
Hi everyone,
I am trying to plot a scatterplot but I want the colours to be .. specific.
I am using this function:
scatter (x, y, 'filled', 'MarkerEdgeColor',[.255, .66, 0], 'MarkerFaceColor',[.255, .66, 0]);
as I found this to be the correct command online but the colour that I get is not what I think I specify... the colour I need in RGB is 255 66 0 and the one that is being plotted here is some weird green.. do you have any ideas what could be wrong ?
Another thing: I wanted to remove the numbers from the y-axis and put labels on them. For example -2 would be disagree, -1 would be slightly disagree, -0.03 would be just slightly disagree and 0.03 would be just slightly agree... etc. Because the distances between these points isn't the same I am having a hard time specifying this in Matlab, do you know how to go about this?

採用された回答

Shubham Gupta
Shubham Gupta 2019 年 9 月 30 日
編集済み: Shubham Gupta 2019 年 9 月 30 日
Try:
scatter (x, y, 'filled', 'MarkerEdgeColor',[255, 66, 0]/255, 'MarkerFaceColor',[255, 66, 0]/255);
to change tick labels for y-axis:
a = gca;
a.YTick = [-2,-1,-0.03,0.03,1,2];
a.YTickLabel = {'Label1','Label2','Label3','Label4','Label5','Label6'}';
I hope it helps !
  1 件のコメント
Yoanna Ivanova
Yoanna Ivanova 2019 年 9 月 30 日
Yes, this worked!! Thank you!!

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

その他の回答 (0 件)

カテゴリ

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