You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As stated in the documentation, if the input to values is a named vector the names will be used to match the values to the levels of the scale. Since iris$Species doesn't contain any values matching the names of your vector they will all be set to na.value
In addition to Thomas' comments, the next version will warn you that there are no names/values in common. Not quite sure why it warns twice though.
colors_named_vector<- c(
red="red",
blue="blue",
green="green"
)
library(ggplot2)
ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) +
geom_point() +
scale_color_manual(values=colors_named_vector)
#> Warning: No shared levels found between `names(values)` of the manual scale and the#> data's colour values.#> No shared levels found between `names(values)` of the manual scale and the#> data's colour values.
Ref to: #4087
Try:
it seems as if it has not been fixed
The text was updated successfully, but these errors were encountered: