Specifying the colour of a scatter plot
1 view (last 30 days)
Show older comments
Yoanna Ivanova
on 30 Sep 2019
Commented: Yoanna Ivanova
on 30 Sep 2019
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?
0 Comments
Accepted Answer
Shubham Gupta
on 30 Sep 2019
Edited: Shubham Gupta
on 30 Sep 2019
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 !
More Answers (0)
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!