s-news
[Top] [All Lists]

Re: irregular appearance different line types

To: Jean V Adams <jvadams@usgs.gov>
Subject: Re: irregular appearance different line types
From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
Date: Wed, 31 Aug 2005 08:37:52 +0100 (BST)
Cc: s-news@wubios.wustl.edu
In-reply-to: <OF0E48E7F3.AC362E64-ON8525706D.00687F2E-8525706D.006ADBE2@usgs.gov>
References: <OF0E48E7F3.AC362E64-ON8525706D.00687F2E-8525706D.006ADBE2@usgs.gov>
 This message is in MIME format.  The first part should be readable text,
 while the remaining parts are likely unreadable without MIME-aware tools.

--27464147-1794452324-1125473872=:26002
Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

Jean,

I think the problem may be Word. I don't see any problem with output from postscript(), and it is hard to see how PostScript files could have this effect: they just say stroke a line from A to B with this line type. (You will not see the effect in my books either, which use postscript(). Under Unix, but I have been told (and believe) that current Windows S-PLUS uses the same postscript() device as Unix did/does.)

It is not clear to me how you are producing the output, i.e. which printer driver on what printer? This could be a printer/printer driver issue.
Again, I have never seen it using postscript or PDF printers.

As a cross-check I looked at R's win.metafile device. That is using standard GDI calls and seems to me to also be nasty (but not as bad as a graphsheet). So I suspect it is a Windows GDI problem, and anything which goes via Windows metafiles will show the effect.

On Tue, 30 Aug 2005, Jean V Adams wrote:

I am having problems creating publication quality line graphs using
different line types in S-PLUS.  When using a line width > 1 and a line
type other than 1, the appearance of a plotted line changes depending on
the angle of the line in the plot.  This is a recurring problem for me.  I
first posted queries for a solution to this newslist nearly eight years
ago!  (If you're curious, check out my 11 Jun 2003 posting at
http://www.biostat.wustl.edu/archives/html/s-news/2003-06/msg00066.html.)
Apparently the problem has something to do with the graphics device used.

My goal is to create a publication quality line graph using different line
types in S-PLUS and paste/insert the result into a Word document ...
preferably with no other software needed in between.  I have experimented
with several different approaches (see the code pasted below).  Using
graphsheet() gives me irregular lines, no matter whether I'm looking at
them on the screen, saving them to a file using commands within
graphsheet, or exporting them to a file using the GUI.  Using the
postscript() device also gives me irregular lines.  The wmf.graph() device
ignores my use of different line types ... all the lines look like lty=1.
The pdf.graph() device gives me BEAUTIFUL lines (lines I never dared dream
of before), but I am unable to import the image into a Word document (I
only have Adobe Reader).  Ugh!

I am using S-PLUS® 7.0 for Windows PROFESSIONAL DEVELOPER with operating
system Microsoft Windows XP Professional.

I welcome any suggestions you might have to help me achieve my goal.
Thanks in advance.



options(warn=-1)
x <- sort(seq(0, 12, 0.1), seq(9, 11, 0.01))

# irregular lines, both on screen and when exported (as eps or wmf file,
for example)
graphsheet(width=6.5, height=5)
plot(0, 0, xlim=c(8, 12), ylim=c(-1, 1), type="n", xlab="", ylab="")
for(i in 2:8) lines(x + 0.8*i, sin(x), lty=i, lwd=i-1)

# irregular lines
postscript(file="lineplot.eps", onefile=F, print.it=F, width=6.5,
height=5)
plot(0, 0, xlim=c(8, 12), ylim=c(-1, 1), type="n", xlab="", ylab="")
for(i in 2:8) lines(x + 0.8*i, sin(x), lty=i, lwd=i-1)
dev.off()

# all lines look like lty=1!
wmf.graph(file="lineplot.wmf", width=6.5, height=5)
plot(0, 0, xlim=c(8, 12), ylim=c(-1, 1), type="n", xlab="", ylab="")
for(i in 2:8) lines(x + 0.8*i, sin(x), lty=i, lwd=i-1)
dev.off()

# beautiful lines, but unable to import into Word
pdf.graph(file="lineplot.pdf", width=6.5, height=5)
plot(0, 0, xlim=c(8, 12), ylim=c(-1, 1), type="n", xlab="", ylab="")
for(i in 2:8) lines(x + 0.8*i, sin(x), lty=i, lwd=i-1)
dev.off()

options(warn=0)



JVA

`·.,,  ><(((º>   `·.,,  ><(((º>   `·.,,  ><(((º>

Jean V. Adams
Statistician
U.S. Geological Survey
Great Lakes Science Center
c/o Marquette Biological Station
1924 Industrial Parkway
Marquette, MI 49855  USA
phone: 906-226-1212
FAX: 906-226-3632
web site: www.glsc.usgs.gov
e-mail: jvadams@usgs.gov

--
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
--27464147-1794452324-1125473872=:26002--

<Prev in Thread] Current Thread [Next in Thread>