Where can I get the ggplot2 package(ver 1.0.0)?

17 views
Skip to first unread message

gaopinglei

unread,
Aug 29, 2016, 10:19:47 AM8/29/16
to ggplot2
I leraned ggplot2 for scatter plots from "ggplot2: The Elements for Elegant Data Visualization in R". It is unable to draw a  regression line with the qplot() function in the recent version of ggplot2. I used the following code to draw a scatter plot.
p <- ggplot(mtcars, aes(x=wt, y=mpg, color=cyl, shape=cyl)) +
geom_point() +
geom_smooth(method=lm, se=FALSE, fullrange=TRUE)+
theme_classic()
# Use brewer color palettes
p+scale_color_brewer(palette="Dark2")


The outcome graph supposed to be Figure 1, but I got Figure 2. Where is the lines of x-axis and y-axis? How can I fix it? Mybe I need the old version of ggplot2. I think it would be more easy for me to learn.



Brandon Hurr

unread,
Aug 29, 2016, 4:41:33 PM8/29/16
to gaopinglei, ggplot2
This is a known bug that is expected to be rolled out in ggplot2.2.0 in due course. 


You can get around it by defining the color of each of the elements for x and y:
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
theme(axis.line.x = element_line(colour="black"), axis.line.y = element_line(colour="black"))

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages