Painters doesn't render line styles properly
古いコメントを表示
Hey there! I'm trying to export a figure as a pdf, and as such I set painters as the renderer for my figure. However, I don't seem to be getting the correct linestyles that I specify. Here's a mwe of what is happening:
x=linspace(0,1,100);
[X,Y]=meshgrid(x);
Z=peaks(100);
set(gcf,'Renderer','painters');
hold all
surf(X,Y,Z)
shading interp
contour3(X,Y,Z+1,[1,1],'LineStyle','--','LineWidth',1,'LineColor','w')
contour3(X,Y,Z+1,[2,2],'LineStyle','-.','LineWidth',1,'LineColor','w')
view(2)
As you can see the plot shows solid lines. By increasing the linewidth I see that the lines are actually dashed and dotted, but as they are they are pretty unusable. Anyone knows how to fix this issue?
3 件のコメント
Jaime Abad Arredondo
2022 年 8 月 23 日
Rik
2022 年 8 月 23 日
Perhaps using plot to create the lines might work better?
回答 (1 件)
Hi,
From the information you have provided, I understand that you are facing an issue getting the correct linestyles while setting the renderer for the figure as “painters.” Also, setting the renderer as “painters” works for you in the case of small matrices.
Since you have tried “OpenGL,” you can also use “zbuffer” to get the correct linestyles. Here is the sample code:
set(gcf, 'Renderer', 'zbuffer');
You can refer to the following documentation to know more about set and Renderer:
- https://www.mathworks.com/help/releases/R2023a/matlab/ref/set.html
- https://www.mathworks.com/help/releases/R2023a/matlab/ref/matlab.ui.figure-properties.html#prop_Renderer
I hope it helps.
2 件のコメント
Rik
2023 年 10 月 11 日
Wouldn't a doc page about the renderers make more sense as a reference?
Jaime Abad Arredondo
2023 年 10 月 11 日
編集済み: Jaime Abad Arredondo
2023 年 10 月 11 日
カテゴリ
ヘルプ センター および File Exchange で Graphics Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


