Matlab doesn't change MarkerSize
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Carlos Trasviña
am 3 Jun. 2018
Kommentiert: Carlos Trasviña
am 3 Jun. 2018
Hi all,
I know this is a basic one, but for some reason when I plot a figure, certain markers don't change their Size. The code that I use is the following:
plot(datos(index,i+1),headers(1,i+1),'sk','MarkerSize',4,'LineWidth',.25,'MarkerFaceColor',[R G B]);
or
plot(datos(index,i+1),headers(1,i+1),'pk','MarkerSize',4.5,'LineWidth',.25,'MarkerFaceColor',[R G B]);
When I set the MarkerSize for a square or pentagram shape they always end up in a size 2.9x2.9 (squares) or size 4.2x4.06 (pentagram). I'm saving the figure as a PDF with "print(fig1,saveString,'-dpdf','-fillpage');" don't know if that matters but I thought of mentioning it.
Thanks in advanced,
Carlos TM
2 Kommentare
Walter Roberson
am 3 Jun. 2018
Is the difficulty occurring even on the displayed images, or only in the PDF ?
Akzeptierte Antwort
Greg
am 3 Jun. 2018
Bearbeitet: Greg
am 3 Jun. 2018
The unit of 'MarkerSize' is 'points' which is typically 1/72 inch. Depending on your OS, there are usually 96 pixels per inch. If you do the math on various marker sizes - and assume that apparent size of a marker is floor of its pixel size - the following sheds a little light:
pts = 4:.1:5;
in = pts./72;
pix = in.*96;
[pts;in;pix]
ans =
4.0000 4.1000 4.2000 4.3000 4.4000 4.5000 4.6000 4.7000 4.8000 4.9000 5.0000
0.0556 0.0569 0.0583 0.0597 0.0611 0.0625 0.0639 0.0653 0.0667 0.0681 0.0694
5.3333 5.4667 5.6000 5.7333 5.8667 6.0000 6.1333 6.2667 6.4000 6.5333 6.6667
This would make me believe that 4.5 looks larger than 4.0-4.4, but it could be a little round-off error in MATLAB's calculation vs. my assumed algorithm above. Try 4.6 for your 'MarkerSize' and see if that helps.
3 Kommentare
Greg
am 3 Jun. 2018
Thinking about it more, a ceil as opposed to floor of pixel size would explain it.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!