Specifying the colour of a scatter plot
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Yoanna Ivanova
am 30 Sep. 2019
Kommentiert: Yoanna Ivanova
am 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 Kommentare
Akzeptierte Antwort
Shubham Gupta
am 30 Sep. 2019
Bearbeitet: Shubham Gupta
am 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 !
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Scatter Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!