How to export high resolution line graphs to png, tiff, etc

5 次查看(过去 30 天)
I am not sure if this has already been solved, but here goes.
I need to export to png or tiff 2D graphs of lines in high resolution (600dpi or higher). Everything is ok when all lines are solid, but when dotted, dashed or other combinations are present the exported image looks very bad. The problem is that the lines and dots do not scale correctly when exported and and up being very very thin very numerous. The end result is a "hazy" solid line that only looks like a dotted one when you fully zoom in. The same goes for the grid if I add it.
For now what I do is after doing all my plotting and manipulation in Matlab, I export a .dat file of the quantity I want to plot and save it to disk. Then I use another program for the plotting, such as Origin lab.
I have tried various files here on the website but nothing seems to work well. I also know that similar problems exist in python which runs similar to Matlab. Note I do not want vector graphs.
Thanks in advance :) Best, Paris

回答(2 个)

Richard Quist
Richard Quist 2016-5-24
If you believe the lines aren't scaling correctly you should contact technical support so they can look into the issue.
It's possible that what you're seeing is just an artifact of how the viewing application is displaying the image. If it is not being shown at its native size and resolution then the image will be scaled ... and scaling almost always results in poorer quality for bitmapped graphics.
One approach that might help would be to increase the line widths ... this would give the viewing application more pixels per line and it may do a better job when showing the scaled version.
figure;
l = plot(rand(3));
set(l(1), 'linestyle', '-.');
set(l(2), 'linestyle', '--');
set(l(3), 'linestyle', ':');
% increase line widths for all lines
set(l, 'linewidth', 1);
print -djpeg -r600 lines.jpg
  1 个评论
Paris Panagiotopoulos
Thank you for your suggestion but it does not work well. It actually showcases the problem pretty well. If you compare the on screen .fig file and the exported .jpg the spacing between the dots and lines is very different. This is the problems with scaling I am talking about. It's not the width of the line that is wrong its the spacing of the dots and lines.

请先登录,再进行评论。


KSSV
KSSV 2016-5-24
  1 个评论
Paris Panagiotopoulos
I have tried this in the past but it did not look anywhere close to what other programs produce. I will give it a try again today.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by