Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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

2 vues (au cours des 30 derniers jours)
Yuanjie Su
Yuanjie Su le 30 Août 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
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 commentaires
Yuanjie Su
Yuanjie Su le 1 Sep 2019
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 le 1 Sep 2019
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]);

Réponses (0)

Cette question est clôturée.

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by