Cannot set marker edge thickness using the Linewidth property smaller than 1pt

50 ビュー (過去 30 日間)
JK
JK 2018 年 10 月 27 日
I would like to set the edge thickness of markers to some smaller values than 1 (0.5 or 0.3 for example). I currently use Matlab 2018b on a Mac and could not yet figure out why markers always appear with an edge width of 1pt. I attached an example where the lines (when exported to an eps file either via the Matlab export function or the export_fig addon) have the correction thickness but the markers seem to remain at a width of 1pt.
Edit: It seems that the Linewidth property affects the edge thickness of markers for values equal to 1 or above. Setting it to values <1 seems not to work though (only for lines, not the markers).
Thanks a lot
testpoints = line([1 2 3 4 5],[4 5 6 7 8],'LineStyle','none','Linewidth', 0.5,'MarkerEdgeColor','k','MarkerFaceColor','w','Marker','s','MarkerSize',4);
testline = line([1 2 3 4 5],[4 5 6 7 8],'LineStyle','-','Linewidth', 0.5,'Marker','none');
  3 件のコメント
JK
JK 2018 年 10 月 27 日
I inspected the eps file using Adobe Illustrator and checked the line and marker thickness.
Walter Roberson
Walter Roberson 2023 年 5 月 2 日
編集済み: Walter Roberson 2023 年 5 月 2 日
According to the documentation,
The line width cannot be thinner than the width of a pixel. If you set the line width to a value that is less than the width of a pixel on your system, the line displays as one pixel wide.
I do not know how this would affect eps; I suspect the plot would get rasterized according to the figure PageSize

サインインしてコメントする。

回答 (3 件)

David Broadway
David Broadway 2020 年 3 月 27 日
I am having the same issue.
One not very good solution is to plot the data twice once with just the edge and another with the face. This seems to get the correct effect but it is not an optimal solution.
hold on
plot(XData, YData, ...
'o', ...
'MarkerSize', 1, ...
'MarkerEdgeColor', [31, 119, 180] / 255;
plot(XData, YData, ...
'o', ...
'MarkerSize', 0.8, ...
'MarkerEdgeColor', 'none', ...
'MarkerFaceColor', [174, 199, 232] / 255);
hold off
  6 件のコメント
DGM
DGM 2023 年 5 月 2 日
I'm a bit slow today. I see Walter is already working with you here
His solution thus far already includes the concepts that I've covered, so it would probably be best to focus on that thread for now.
Walter Roberson
Walter Roberson 2023 年 5 月 2 日
pzmap() does not allow you to directly change properties; you have to look for the graphic objects.
pzplot() does allow you to pass in some properties, and returns a handle that allows you to directly change other properties without having to search for the objects.

サインインしてコメントする。


jonas
jonas 2018 年 10 月 27 日
編集済み: jonas 2018 年 10 月 27 日
After digging through the undocumented properties, here's how you change the marker edge thickness:
LineHandle.NodeChildren.LineWidth = 2
The edgethickness does not automatically scale with markersize, so none of your linespec properties affect the edgethickness.
  9 件のコメント
jonas
jonas 2018 年 10 月 28 日
編集済み: jonas 2018 年 10 月 28 日
Yep you are correct, I had not noticed that the edge of the marker scales with linewidth. The only other answer I can find online is related to resolution, which is not the problem here because the axes ruler is 0.5 pts and is exported just fine. Odd.
Rupsagar Chatterjee
Rupsagar Chatterjee 2023 年 9 月 7 日
not working for me

サインインしてコメントする。


JK
JK 2018 年 11 月 1 日
Mathworks support has now confirmed that this is a bug and forwarded it to the development team to be fixed in a future release.

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by