Info

此问题已关闭。 请重新打开它进行编辑或回答。

What's the relationship beween scatter markersize and its height and the length?

1 次查看(过去 30 天)
Here, I use scatter to label some points in the axes. So I need to know the height and the length of the scatter maker to avoid overlapping. But I only know the makersize. what's the relationship beween scatter makersize and its height and the length? As this picture shows:
  5 个评论
Yuanjie Su
Yuanjie Su 2019-9-1
Thanks for your answer. Today, I use plot instead of scatter and get some result.
First I set the axes unity property is point. Then I compute the markerwidth through axes.position, axes.XLim and s(the makerwith in x axes scale). Then I find maker 'o' and 'd' makerwidth is s in x axes scale.
handles=guihandles;
h1=plot(handles.axes1,0.5,0.5);
s = 0.4; %Marker width in units of X,axe1 units is point
axpos = get(handles.axes1,'Position');
xlim=get(handles.axes1,'XLim');
markerWidth = s/diff(xlim)*axpos(3); % Calculate Marker width in points
set(h1, 'Marker', 'square');
set(h1, 'MarkerSize', markerWidth);
hold on;
h2=plot(handles.axes1,0.5,0.5);
set(h2, 'Marker', 'o');
set(h2, 'MarkerSize', markerWidth);
h3=plot(handles.axes1,0.5,0.5);
set(h3, 'Marker', 'd');
set(h3, 'MarkerSize', markerWidth);
批注 2019-09-01 124211.jpg
Yuanjie Su
Yuanjie Su 2019-9-1
The supplement for the last answer.批注 2019-09-01 125826.jpg
handles=guihandles;
h1=plot(handles.axes1,0.5,0.5);
s = 0.4; %Marker width in units of X,axe1 units is point
axpos = get(handles.axes1,'Position');
xlim=get(handles.axes1,'XLim');
markerWidth = s/diff(xlim)*axpos(3); % Calculate Marker width in points
set(h1, 'Marker', 'square');
set(h1, 'MarkerSize', 1.28*markerWidth);
hold on;
h2=plot(handles.axes1,0.5,0.5);
set(h2, 'Marker', 'o');
set(h2, 'MarkerSize', markerWidth);
h3=plot(handles.axes1,0.5,0.5);
set(h3, 'Marker', 'd');
set(h3, 'MarkerSize', markerWidth);
h4=plot(handles.axes1,0.565,0.5);
set(h4, 'Marker', '<');
set(h4, 'MarkerSize', markerWidth);
h5=plot(handles.axes1,0.435,0.5);
set(h5, 'Marker', '>');
set(h5, 'MarkerSize', markerWidth);
set(handles.axes1,'XLim',[-0.5,1.5]);

回答(0 个)

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by