Matlab doesn't change MarkerSize

조회 수: 4 (최근 30일)
Carlos Trasviña
Carlos Trasviña 2018년 6월 3일
댓글: Carlos Trasviña 2018년 6월 3일
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
Walter Roberson
Walter Roberson 2018년 6월 3일
Is the difficulty occurring even on the displayed images, or only in the PDF ?
Carlos Trasviña
Carlos Trasviña 2018년 6월 3일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Greg
Greg 2018년 6월 3일
편집: Greg 2018년 6월 3일
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
Greg
Greg 2018년 6월 3일
Thinking about it more, a ceil as opposed to floor of pixel size would explain it.
Carlos Trasviña
Carlos Trasviña 2018년 6월 3일
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!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by