Thread Subject: Dotted line and png plots

Subject: Dotted line and png plots

From: Solan

Date: 19 Sep, 2008 22:10:36

Message: 1 of 6

Dear group reader,

I am (again) trying to export figures for publication in a referee
journal. I have used matlab for almost 10 years, but every time I end
up with some problems with printing publication quality graphs. Can
someone point to a good resource on how to learn this once and for
all? My favourite typesetting software is LaTex. Currently I prefer
the png format since it seems less vulnerable than any vector format.

My particular problem is that I want to export a figure that includes
a broken line. I use:
exportfig(1,'./FIG/Fig4a.png','Format','png','Width',figwidth/
2,'Height',figheight,'resolution',600)
The png looks great, but when I increase the resolution, the spacing
between the "dots" decreases. Is there a way to control the "dot"
spacing withour having to decrease the resolution?

If someone could point to good resource to increase my efficiency (so
that I don't have to work until 23:50 a Friday night), I would be more
than grateful.

S

Subject: Dotted line and png plots

From: Christopher Hummersone

Date: 13 Nov, 2008 12:25:03

Message: 2 of 6

I am having the same problem. And not only that, but LaTeX characters are not rendering correctly either (they have odd bits missing). I have tried a range of renderers and resolutions but with no change in the result. Anyone any ideas?

Subject: Dotted line and png plots

From: Jan Simon

Date: 13 Nov, 2008 13:53:02

Message: 3 of 6

Dear Solan!
If you use LaTeX, EPS files would be great: They are small, scalable and look fine in PDFs at any resolution. You can adjust the font size of the title and tick labels after inserting the EPS in the LaTeX document.

There is a file on the FileExchange, which fixes even the problems with dotted/dashed lines (http://www.mathworks.com/matlabcentral/fileexchange/17928).

Can you explain, why you prefer PNGs?

Jan

Subject: Dotted line and png plots

From: Solan

Date: 10 Dec, 2008 10:28:46

Message: 4 of 6

On Nov 13, 2:53=A0pm, "Jan Simon" <matlab.THIS_Y...@nMINUSsimon.de>
wrote:
> Dear Solan!
> If you use LaTeX, EPS files would be great: They are small, scalable and =
look fine in PDFs at any resolution. You can adjust the font size of the ti=
tle and tick labels after inserting the EPS in the LaTeX document.
>
> There is a file on the FileExchange, which fixes even the problems with d=
otted/dashed lines (http://www.mathworks.com/matlabcentral/fileexchange/179=
28).
>
> Can you explain, why you prefer PNGs?
>
> Jan

Dear Jan,

I wish you were right.

The reason for not using vector graphics is that many options do not
render in eps (e.g. alpha properties). More specifiacally I have been
using the American Institute of Physics publication service (Journal
of the Acoustical Society of America). They have a system where you
can upload an LaTex files and figures, and the pdf is automatically
generated. I really prefer this solution over other solutions, and
especially when the typesetters retype the document (and you have a
lot of equations). The problem is that they require the fonts to be
embedded in the eps files.I have been able to hack the eps files and
include font definitions, but it is very ad hoc. I did try to find an
option in matlab where the fonts were embedded in the file, but did
not find it. Can't quite remember those details now. In addition, the
files gets very large for images. Bottom line. I gave up.

My idea was to have a setup that would work in all situations, and png
seemed to be the best option. But then I came up with the problem
described above with the dotted lines. Now, after upgrading matlab, I
have a new problem. I use the exportfig.m, but now the colorbar is
completely off after exporting. In addition, the journal required the
ylabel to be italic. That's easy, I thought. Again, I was wrong. I
changed the font to italic, but when I exported the file to png, the
\theta was cut at the end. Not acceptable for the journal.

Again, I am trying to find workarounds. The theta issue will be fixed
by exporting an empty plot with theta in the xlabel (which works
fine...). Importing both files in gimp or Inkscape, copying the
\theta, rotating it and gluing it at the right place. I guess I have
to do to the same with the colorbar.

There are always workarounds, but these takes time. What I really like
to see is one way to produce a graph according to any journal style,
specifying final size (in cm), font size etc. Exportfig is a nice way,
but there are always issues (as with the theta issue, the broken line
issue, the colorbar issue). Maybe I have not paid enough attention to
recent developments in matlab, and maybe there is a simple *easy* way
to get what I want. If someone can point me to a resource that can do
this, I would be more than grateful.

N

Subject: Dotted line and png plots

From: Ben Reineman

Date: 10 Dec, 2008 21:27:13

Message: 5 of 6

I got around this by exporting to eps in the normal way
print(gcf, '-depsc', '-r100', 'figure.eps'])
and then using GSview (free!) to convert to PNG. Then it just needs
some cropping, but the dotted lines look correct.

Subject: Dotted line and png plots

From: Oliver Woodford

Date: 12 Dec, 2008 10:58:02

Message: 6 of 6

Many people, including me, have had problems making figures suitable for publication. I've written a suite of functions (each available on the FEX) which do just this: print_pdf, print_eps and print2im (for bitmap figures). They aim to put exactly what is on the screen into a file of the type you desire, with all the necessary publication requirements, e.g. embedded fonts.

I'd be interested to hear how print2im performs on your dotted line problem, Solan. Also, try print_pdf on the same figure and see if it doesn't fix the earlier problems you were having with vector graphics. If they don't work as desired, please send me a script to generate an example figure for testing, and I'll endeavour to improve things.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
render resoluti... Christopher Hummersone 13 Nov, 2008 07:30:05
rssFeed for this Thread

Contact us at files@mathworks.com