Specified LineStyle of rectangle object reverts to default when printing to pdf

1 view (last 30 days)
So, I've added a rectangle to one of my plots, but when I go to print/export the figure to a pdf it's rendering the rectangle with solid edges instead of dashed ones. Essentially, I'm adding a rectangle representing a zoomed-in region at position vector P using:
rectangle('Position',P,'LineStyle','--','LineWidth',1);
print([filename,'.pdf'],'-dpdf','-painters');
The figure on the left is what shows up in the MATLAB figure window, but when I open the pdf it looks like the figure on the right.
I've tried both the basic print command and export_fig and I'm getting the same result. Is there some sort of obscure print setting I should be using? I can manually edit the rectangle in Adobe Illustrator but I'd rather just have it export the right way.
  3 Comments
Erica
Erica on 5 May 2014
Drat. I was using R2012a on Linux and I just tested it with R2011a on my mac and I'm getting the same result as before. Ghostscript refuses to open them and it looks solid in Preview and Adobe Illustrator and Reader. Looks like I'm stuck with manually editing the pdf in illustrator. Thank you for your help! :)
Star Strider
Star Strider on 5 May 2014
My pleasure!
Contact MathWorks Support to see if a free update or bug fix is available. Otherwise, report it as a bug. It should work as it’s supposed to, and MathWorks may fix it for free.

Sign in to comment.

Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!