plotting a graph with different size markers

Hello everyone,
I would like to plot a graph with the data points as circles according to their sizes in diameter. The y-axis is the vertical distance and the x-axis is the horizontal distance. Furthermore, is it possible to colour the points from 1.53x10^-4 to 2.23x10^-4 in red and the rest in blue?
Thanks

 채택된 답변

KSSV
KSSV 2020년 8월 20일

0 개 추천

Read about scatter.

댓글 수: 5

asd ad
asd ad 2020년 8월 20일
I read about scatter but the problem is my x-axis is not in equal dimensions to scatter as far as I've understood it
data = xlsread("Data.xlsx") ;
x = data(:,1) ;
y = data(:,2) ;
z = data(:,3) ;
scatter(x,y,[],x,'filled')
data = xlsread("Data.xlsx") ;
x = data(:,1) ;
y = data(:,2) ;
z = data(:,3) ;
sz = linspace(1,300,length(z));
scatter(y,z,sz,'filled','MarkerEdgeColor',[0 0 1],...
'MarkerFaceColor',[0.5843 0.8157 0.9882],...
'LineWidth',1.5)
so that is my code but is there like a code to change the colour for half the values to red. For example there are 146 data points so from 74th data points onwards it should be red
Read about indexing.
data = xlsread("Data.xlsx") ;
x = data(:,1) ;
y = data(:,2) ;
z = data(:,3) ;
sz = linspace(1,300,length(z));
scatter(y(1:74),z(1:74),sz(1:74),'filled','MarkerEdgeColor',[0 0 1],...
'MarkerFaceColor','r',...
'LineWidth',1.5)
hold on
scatter(y(75:end),z(75:end),sz(75:end),'filled','MarkerEdgeColor',[0 0 1],...
'MarkerFaceColor','b',...
'LineWidth',1.5)
asd ad
asd ad 2020년 8월 20일
Thanks a lot for your help and recommendations. I've learnt a lot from you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

질문:

2020년 8월 20일

댓글:

2020년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by