I have a problem similar to this thread:
http://groups.google.com/group/ggplot2/browse_thread/thread/f05bfdcb47612038/d67d3e78c3fc435e
but not on mac (I am using linux) and not with linetype 5, but 9.
Displaying the data works fine, but in the pdf, it's really difficult to
see the line.
ggplot(data.frame(x=1:10, y=1:10)) + geom_line(aes(x,y), linetype=9)
pdf("/tmp/test.pdf")
ggplot(data.frame(x=1:10, y=1:10)) + geom_line(aes(x,y), linetype=9)
dev.off()
especially when using non-black colors:
df <- data.frame(x=rep(1:40, 10), y=rnorm(40, 15, 10), name=as.factor(1:10))
ggplot(df)+geom_line(aes(x,y,color=name, linetype=name))
pdf("/tmp/test.pdf")
ggplot(df)+geom_line(aes(x,y,color=name, linetype=name))
dev.off()
is there any way to solve this besides specifying the linetypes manually?
best regards,
stefan
Not that I know of. One possibility might be to create a small
reproducible example with base graphics and then post it to R-help.
Hadley
I though its a ggplot related issue.
Printing normal plot and ggplot with the same data, it is difficult to see
the line in the ggplot graph, but not in the normal plot.
df=data.frame(x=1:20, y=rnorm(20, 10, 15))
pdf("/tmp/test.pdf")
ggplot(df) + geom_line(aes(x,y), linetype=9)
plot(df$x, df$y, type="l", lty=9)
dev.off()
But when I print the pdf file, there is not difference between the two
lines, so maybe it's a problem of my laptop display.
best regards,
stefan
Hmmm. It may be a grid issue - I've cc'd Paul Murrell in the hope
that he might have some insight.
Hadley
maybe it is easier to see the differences, when you set the ggplot
background to white too.
library(ggplot2)
theme_set(theme_bw())
pdf("/tmp/test.pdf")
ggplot(df) + geom_line(aes(x,y), linetype=9)
plot(df$x, df$y, type="l", lty=9)
dev.off()
or maybe the problem is somewhere on my side. I will try to test in on
windows within the next days.
Attached is a pdf file, with all axes and grids removed and I see a big
difference between the ggplot line on the left side and the normal plot
in the right side.
Maybe I got it:
It depends on the pdf reader. with evince I don't see anything in the
ggplot plot, with okular and acroread the ggplot line is very faint but
with gv it's ok and both lines are equal.
regards,
stefan
On Tue, Jun 09, 2009 at 07:50:25AM +1200, Paul Murrell wrote:
> Hi
>
> I'm not sure what I'm looking for here. For me, the lines look the same
> on screen (Windows or Linux/Cairo) and in PDF. The lines in PDF are
> much fainter than the lines on screen, and with the grey background in
> ggplot, this does make the line hard to spot *in PDF* for me, BUT the
> ggplot line and the normal plot() line both look the same (the plot()
> one just is easier to spot because it has a white background).
>
> What am I missing?
>
> Paul
> Dr Paul Murrell
> Department of Statistics
> The University of Auckland
> Private Bag 92019
> Auckland
> New Zealand
> 64 9 3737599 x85392
> pa...@stat.auckland.ac.nz
> http://www.stat.auckland.ac.nz/~paul/
>
On preview on the mac, I can't see the left line, but can see the right line.
Hadley