s-news
[Top] [All Lists]

irregular appearance different line types

To: s-news@wubios.wustl.edu
Subject: irregular appearance different line types
From: Jean V Adams <jvadams@usgs.gov>
Date: Tue, 30 Aug 2005 15:27:12 -0400

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", 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
<Prev in Thread] Current Thread [Next in Thread>