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

조회 수: 3 (최근 30일)
Paris Panagiotopoulos
Paris Panagiotopoulos . 2016년 5월 23일
댓글: Paris Panagiotopoulos . 2016년 5월 24일
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.
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
Paris Panagiotopoulos 2016년 5월 24일
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 2016년 5월 24일
  댓글 수: 1
Paris Panagiotopoulos
Paris Panagiotopoulos 2016년 5월 24일
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에서 Formatting and Annotation에 대해 자세히 알아보기


Community Treasure Hunt

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

Start Hunting!

Translated by