フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

2 ビュー (過去 30 日間)
Yuanjie Su
Yuanjie Su 2019 年 8 月 30 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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