poor quality of graphics exported to EPS

I'm disappointed with the quality of graphics exported to EPS format;  I'm using Maple 11.

Even with a simple plot, like  

plot( x^2, x=-1..2);

the exported EPS file  (I've tried using both the interactive export, clicking on the graphic) and the explicit   plotoutput   command)  is large and messy, and produces a jaggedy graph when printed.      As I recall this was less of a problem in earlier versions of Maple.

Has anyone found a workaround?

 

alec's picture

eps

As far as I recall, eps export produced good quality plots (if they didn't include text) in old Maple versions, something like Maple V and Maple 6. However, there were still some bugs in it - in particular, with the bounding box. They could be easily corrected manually though.

Sometime around Maple 8 or Maple 9 eps export was changed to produce the same poor quality plots as in other graphics formats, so it seems to be not usable at the moment.

Some people print plot structures to a file (if possible) and then use some other graphics tools to produce publishing quality plots. But it is more simple just use other CAS - such as SAGE (which is free), or Mathematica, or Matlab.

Alec

That's what I was afraid

That's what I was afraid of.      Indeed, I've done a lot of grubbing around in files to alter bounding boxes, etc., and hoped things might have improved.

A bit dispiriting that things seem to be going downhill in later Maple versions.

PZ

plotsetup

Try

plotsetup('ps','plotoutput'="plot.ps",'plotoptions'="portrait,noborder");
plot(x^2,x=-1..2);

I don't see any of the jaggies that you mentioned.

alec's picture

plot quality

Some simple 2D plots are more or less OK. But 3D plots are not. Well - maybe if they use CURVES - I didn't try that. That seems to depend on the plot structures used.

Edit. Just checked that particular example with x^2. Unfortunately - it isn't OK as well. Lines are too thin. The y-axis is wider than x-axis. The width of the x-axis decreases from the left hand side to the right hand side. The curve width is thinner than the axes width. The curve is visibly not smooth, a lot of short segments are seen, with color varying from dark grey to light grey. Text font is not very good. Minus touches 0 in -0.5 and is too long in -1 as well. 0 is positioned higher than other numbers on the x-axis, and is shifted to the left comparing with numbers on the y-axis. The eps file contains DSC errors (wrong %%Pages, for instance).

Alec

PS if you have an older Maple version, say Maple V or Maple 6, the difference can be clearly seen. -Alec

how rendered

Are you referring to the displayed output, which would depend on your postscript viewer, or the plotted output?  I don't see any of those effects on the plotted output (plotted with an hp laserjet 1100).  In the ghostview (gv) display on the screen, the y-axis appears thinner than the x-axis, however, that isn't a Maple problem.  If interested I can upload the .ps file.

alec's picture

printer driver

Printer driver might correct some of these things. I described what can be seen in GSview (in Windows). Perhaps, Linux is using different converter to eps.

Now, I printed it using my laser printer. Lines are still too thin. The difference between x-axis and y-axis width is not noticable though. The varying width of the curve is still noticable, especially from the left hand side. 0 is still positioned higher and more to the left than it should. It's definitely not camera-ready - lines are too thin and shifted 0.

I remember posting some ways of making plot of publishable quality about 3 years ago on this site - draw axes manually etc. It can be done (for 2D plots), but requires a lot of typing :)

Edit: Just uploaded both plot.ps and how it looks - plot.pdf.

Edit 2: Found a link to my post 3 years ago.

Alec

PS An interesting thing is that it would take just few lines in PostScript, or MetaPost to draw a perfect picture of this particular graph -Alec

Alec I just loaded up both

Alec

I just loaded up both your plot.ps and your plot.pdf. I can't see any of the issues you are talking about in the ps plot. The axes look the same thickness to me, and a look at the file will show that the postscript used to draw them is virtually identical. I don't see any variation in thickness of the line, or it's colour, but if I did I would expect that to be due to the antialiasing code trying to smooth out the line. If so then that's your viewer, not the underlying code. A quick look at the underlying postscript will show you that the curve is drawn consistently throughout its length, and the postscript to draw the two axes is identical apart from the location. (lines 156 and 202 of your file)

I do see the difference in the axis thickness in the PDF, but again given the identicality of the axes in the postscript I have to put that down to the ps/pdf converter, or the PDF viewer. My guess is that it's antialiasing again. Some viewers will antialias a horizontal or vertical line that is not exactly placed on a pixel boundary, making it seem thickner; some will shift the line so it is on a pixel boundary. Again it's your viewer's choice, not the postscript. Postscript can't know where the pixel boundaries will lie ahead of time.

David Clayworth Maplesoft GUI Developer

P.S. You can of course use postscript directly to draw x squared, but I wouldn't recommend it for anything more complicated. In fact it takes fifty lines of postscript to draw the axes, without the labels. And do you really want to be converting plot coordinates to postscript coordinates in your head, for fifty line segments, without a mistake?

alec's picture

You can't see any issues?

David,

You can't see any issues?

1. Minus doesn't touch 0 in -0.5 and is not too long in -1?

2. 0 is positioned on the same level as the other coordinates on the x-axis and is not shifted to the left comparing with numbers on the y-axis?

3. The both lines %%Pages: 1 and %%Page: 1 1 are present in the eps, or only one of them?

Alec

PS Do the eps file really need comments about bugs in some windows drivers? -Alec

PPS What about the eps export in Standard Maple? Also doesn't have any issues? -Alec

PPPS Other things may be really caused by me using 30'' monitor with high resolution. They didn't look that bad in print. 2 main issues seem to be the location of 0 and the axes and tickmarks width, which, probably, should be configurable in the plot command. -Alec

 

font

So far as the minus sign goes, that is, I believe, the en-dash in the Helvetica font. Not much can be done about that, except chose another font.

The position of the 0 (origin) is a bit weird. I assume that is because it is doing double-duty as the zero for both axes.  Aligning it vertically with the x-axis labels probably would be better. 

alec's picture

Position of 0

If I recall correctly, both Mathematica and SAGE just didn't display zero at all in this plot. Also, both of them (as well as Matlab) drew the parabola in blue color.

I was actually quite surprised looking at the eps output in Standard. It was much better quality. The parabola was red and this seems to be not mentioned in the help pages, but the line widths and zero position were much better. Is it only in Windows, or in Linux, too?

Alec

poor quality in both print and display

I'm seeing poor quality in both printed and screen output.

And, weirdly, I'm getting the dreaded black border even with the noborder command.

 

 

A bug

Some versions of Maple were shipped with a bug that meant the "noborder" option was not recognised. It is fixed in later versions.

David Clayworth Maplesoft GUI Developer

Robert Israel's picture

Try Classic

I've found the Postscript output in Classic to be better than Standard in many cases.
I think the Classic driver is basically the same as the one used in previous versions of Maple.

 

classic works much better for me

Thanks, Robert Israel.    

Maple 11 Classic produces *far* cleaner EPS graphical output  for me.   (They still need some cleanup for publication.)       The classic versions are also much, much smaller --- in one case about 8K as opposed to 300K for the nonClassic version.

acer's picture

plotsetup

In the Standard GUI, can you not access the same Postscript exporter as in Classic, by using the plotsetup routine?

Joe mentioned this above.

acer

alec's picture

Just tried it

Just tried it in Standard. The output actually looks OK, better than in Classic. The parabola is red instead of black and white output in Classic. 0 is located properly. No DSC errors (%%Pages doesn't match %%Page in Classic.) The file size is 48.7 KB instead of 6.03 KB in classic.

2 bugs with color.

Adding color=none to the plotsetup produces black background, white axes, and parabola is not visible.

Adding color=grey instead produces a plot without axes and with a hole in the place where parabola intersects with axes.

In both cases, the size of the output is about the same, 48.7 KB.

Alec

I miss psfrag

Although Maple did make noble progress with the ability to put math symbols in a graph to be exported to eps, I still find it far inferior to what I used to be able to do with the LaTeX psfrag package.

The "classic" plot format along with textplot would allow one to place text markers in the eps file that psfrag could mark up according LaTeX code. That allowed something close to publication quality. 

But now the bloated Maple eps file does not afford this technique--Maple's new eps format is not compatible with psfrag.

 

 

alec's picture

PostScript example

Just wanted to add an example of what I might consider being a perfect picture for this example, written in PostScript (without tickmarks and text),

%!PS-Adobe EPSF-3.0
%%BoundingBox: 36 36 324 396
%%Pages: 1
%%Page: 1 1
newpath 
72 144 moveto
144 0 216 72 288 360 curveto
3 setlinewidth
stroke
newpath 
72 72 moveto
288 72 lineto
1.5 setlinewidth
stroke
newpath
144 72 moveto
144 360 lineto
stroke
%%EOF

It looks like that - myplot.pdf

Alec

PS For people unfamiliar with scientific publishing - lines in the eps should be about 1.5  times more thick than in the desirable output in the print, because of the printing process. Fonts should be also used of highest quality - preferably commercial of the Times family. Helvetica that Maple puts in the eps is absolutely unacceptable -Alec

Your plot

Alec

 

I just loaded your ps file into my ghostview. The line looks a lot thicker than 1.5 times the axis width in my viewer, and the segmentation of the line is clearly visible (a lot more clearly than in the version Maple created). As I said, sometimes it's the viewer that controls these things. In your PDF version the horizontal axis looks thicker than the vertical, though interestingly the PDF viewer has smoothed out the curves. Is the PDF version made from exactly the sample file you posted? Also are you sure that your computer screen is set to an isotropic pixel density? Sometimes a computer can be set so that a given number of pixels can have a different physical distance in the vertical and horizontal directions.

Regarding the fonts, are you aware that font family is controllable in Maple? If you want you can set Times Roman for all the text in the plot, and that setting will be reflected in the postscript.

David Clayworth Maplesoft GUI Developer

alec's picture

Print

David,

As Joe Riel said, this is for printing purposes. Try to print it. It should look good on the screen too. Are you sure that your screen settings are good?

If you look at the Postscript code, the first line draws the entire parabola as a Bezier curve. Nothing can draw parabola more smooth than that.

Other 2 lines are for the axes. I set them with width 1.5 so that the tickmarks could have width 1. Generally speaking, that should be configurable in the plot command, probably, as well as the tickmarks width.

For the line widths, 2 things should be kept in mind. First, the picture's size will be reduced in the print, it is not 1 to 1. Second, too thin lines will be barely seen in the first copies, and will completely disappear at about 100th or 200th copy. That's why it is better to have them rather more thick than not thick enough.

Certainly, I know that Times Roman can be set. Some places accept that (as the worst possible choice), but others - don't. Practically, it is better to not to include text at all - then it could be added later in another application.

Alec

PS Comparing eps from few CAS and Matlab, I would suggest using Matlab version. It looked better than others. -Alec

PPS Add showpage at the end of the Postscript code (but before %%EOF) for printing from gsview - otherwise it won't print. -Alec

I use pstricks together with Maple plots and it looks great

Hi there,

The two Maple/eps files you posted look good on my system (both the ps and pdf), and publishable. The output you obtain in your own myplot.pdf does not look like the kind of plot generated by Maple, Matlab,  or Mathematica, in my experience at least.

Here is what I do. It may not be good enough for your standard, but just in case:

I use Maple classic. In addition I show below how I define some colors (blue, red, green) to substitute the standard Maple colors. You can control line thickness, the grid size, the appearance of ticks, of labels, and many other things.

> restart: with(plots): plotsetup(default):
> axesfonts:=axesfont=[TIMES,ROMAN,6]:
> labelfonts:=labelfont=[TIMES,ROMAN,8]:
> webblue:=COLOR(RGB,.1,0,.55):
> webred:=COLOR(RGB,.9,.1,0):
> webgreen:=COLOR(RGB,.0,.5,.0):
> p1:= plot(x^(2),x=-10..-4, grid=[100,100], thickness=2, colour=webred):
> p2:= plot(x^(2),x=-4..4, grid=[100,100], thickness=2, colour=webblue):
> p3:= plot(x^(2),x=4..10, grid=[100,100], thickness=2, colour=webgreen):
> display({p1,p2,p3},labels=[``,``],axesfonts,labelfonts);
> plotsetup(ps,plotoutput=`theplot.ps`,plotoptions=`color,portrait,noborder,axiswidth=400pt,axisheight=400`): display({p1,p2,p3},labels=[``,``],axesfonts); plotsetup(default):

Having produced a ps file of my basic graphic, I then use pstricks to produce a proper eps format that LaTeX can read, with labels, arrows, titles, etc.

Here is a LaTeX file to do that:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{pstricks}
\pagestyle{empty}

\usepackage{color}
\definecolor{webgreen}{rgb}{0,.5,0}
\definecolor{webblue}{rgb}{0.1,0,0.55}
\definecolor{webred}{rgb}{0.9,0.1,0}

\begin{document}

\begin{center}
\begin{pspicture}(0,0)(\textwidth,\textheight)
%\psgrid[gridcolor=blue,griddots=10,subgriddiv=2,subgriddots=10,subgridcolor=gray,gridlabelcolor=blue,gridlabels=7pt]
\rput[lb](0,0){\includegraphics[width=\textwidth]{theplot}}
\rput[r](6,12.5){$f(x)$}
\rput[l](12.5,0){$x$}
\end{pspicture}
\end{center}

\end{document}

I find the output to be good enough for my needs. Just as I find the files you have updated to look quite good on my system.

I'm using windows. Is there a problem with your drivers or are your needs very advanced?

alec's picture

Whom do you ask?

Whom do you ask, me or the original poster?

If me - I don't have problems with that, just because I don't use Maple personally, for eps or other purposes, and don't have it installed.

I'm glad Maple eps works good for you.

Alec

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}