linetype 9 and pdf

15 views
Skip to first unread message

s...@z107.de

unread,
Jun 5, 2009, 2:40:22 PM6/5/09
to ggp...@googlegroups.com
hi,

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

hadley wickham

unread,
Jun 6, 2009, 6:32:25 AM6/6/09
to s...@z107.de, ggp...@googlegroups.com

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


--
http://had.co.nz/

s...@z107.de

unread,
Jun 6, 2009, 6:50:31 AM6/6/09
to ggp...@googlegroups.com
hi,

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

hadley wickham

unread,
Jun 8, 2009, 11:19:46 AM6/8/09
to s...@z107.de, ggp...@googlegroups.com, Paul Murrell
> 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.

Hmmm. It may be a grid issue - I've cc'd Paul Murrell in the hope
that he might have some insight.

Hadley


--
http://had.co.nz/

s...@z107.de

unread,
Jun 9, 2009, 12:57:35 PM6/9/09
to Paul Murrell, hadley wickham, ggp...@googlegroups.com
hey,

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/
>

3-2x1.pdf

s...@z107.de

unread,
Jun 10, 2009, 11:56:34 AM6/10/09
to Paul Murrell, hadley wickham, ggp...@googlegroups.com
I don't know why, but the last file seems to be broken.
here it is again.
3-2x1.pdf

hadley wickham

unread,
Jun 11, 2009, 8:40:28 PM6/11/09
to s...@z107.de, Paul Murrell, ggp...@googlegroups.com
> 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.

On preview on the mac, I can't see the left line, but can see the right line.

Hadley

--
http://had.co.nz/

Reply all
Reply to author
Forward
0 new messages