Matlab doesn't change MarkerSize

20 visualizaciones (últimos 30 días)
Carlos Trasviña
Carlos Trasviña el 3 de Jun. de 2018
Comentada: Carlos Trasviña el 3 de Jun. de 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 comentarios
Walter Roberson
Walter Roberson el 3 de Jun. de 2018
Is the difficulty occurring even on the displayed images, or only in the PDF ?
Carlos Trasviña
Carlos Trasviña el 3 de Jun. de 2018
It's hard to say in the displayed images, but if my sight doesnt fail me I would say that YES, there is a difference in size. In the PDF file I'm sure.

Iniciar sesión para comentar.

Respuesta aceptada

Greg
Greg el 3 de Jun. de 2018
Editada: Greg el 3 de Jun. de 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 comentarios
Greg
Greg el 3 de Jun. de 2018
Thinking about it more, a ceil as opposed to floor of pixel size would explain it.
Carlos Trasviña
Carlos Trasviña el 3 de Jun. de 2018
I've been running some tests and found out that it seems to be related to the print file format. I tried changing the MarkerSize on different file formats and it did change, although it was never exactly what I was expecting (probably because of the point size).
I think I'll have to make a compromise... in the end, it's mostly aesthetic.
Thanks for your comments!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by