필터 지우기
필터 지우기

Specifying the colour of a scatter plot

조회 수: 1 (최근 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 !

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by