Problem with S4 object using scale_shape_manual

I am struggling with a problem with scale_shape_manual and scale_colour_manual from ggplot. Returning an example from ggplot help (scale_colour_manual), we get the following two lines:

p <- qplot(mpg, wt, data = mtcars, colour = factor(cyl)) p + scale_colour_manual(values = c("red","blue", "green")) 

They work great, and I can do whatever I want after that. But if I decided to create a line that creates an object that combines layers

 h <- p + scale_colour_manual(values = c("red","blue", "green")) 

Then any command will offer me a warning message "Setting class (x) to several lines (" manual "," discrete ", ...), the result will no longer be an S4 object." Even very simple:

  a = 2 

However, if I recompile the last line, this will work. Has anyone had the same problem? Can you help me?

The next comment here is a reproducible example.

 library(ggplot2) library(Hmisc) data(mpg) p <- qplot(mpg, wt, data = mtcars, colour = factor(cyl)) h <- p + scale_colour_manual(values = c("red","blue", "green")) a = 2 

UPDATE - Apparently, it was just a version problem, the next version does not work together: R version 3.0.3 (2014-03-06) Hmisc_3.14-3 and ggplot2_0.9.3.1. You can consider disconnecting (package: Hmisc, unload = TRUE) or just accept the warning.

Thanks R

+7
r ggplot2 scale shape
source share

No one has answered this question yet.

See related questions:

thirty
geom_point () and geom_line () for multiple datasets on the same graph in ggplot2
5
Change the color of the line depending on the y value with ggplot2
2
Display and set color in discrete or continuous case
one
How to conditionally adjust color for multiple geom_segment ggplot?
one
Individual points that are not displayed on the chart (but displayed in ggplot2)
one
Unique color ramp using coefficient with positive values ​​below and above 0 using ggplot2
one
labels of chart values ​​with bars
one
The color difference in the graph between the normal variable and the factor variable
0
How to sum data using ggplot2 in R?
0
Change color in 2 different stat_summary ggplot functions

All Articles