Closed
Description
I'm having some problems when I'm approximating the reproduction of the image below.
scale_color_...
This command adjusts both the color of the line and the color of the edge of the point (shape = 21).
To achieve a similar effect, I made some combinations of type points. The code is as follows:
library(tidyverse)
data <- tibble(lat = c(38:46),
tot = 20+runif(9),
week = 10+runif(9,min = 0,max = 5))
data_tidy <- data |>
pivot_longer(cols = !lat,names_to = 'class',values_to = 'value')
ggplot(data = data_tidy, aes(x = value, y = lat))+
geom_line(aes(color = class),orientation = 'y')+
geom_point(aes(fill = class),color = 'NA', size =3, shape =21)+
geom_point(aes(color = class))+
scale_color_manual(values = c('red','blue'))+
scale_fill_manual(values = c('yellow','green'))
But I'm not sure there is a simpler and more direct way to achieve this effect.
I would like to achieve that the color of points (fill color) and lines is determined by a certain type of attribute, but the color of the edges of the points depends on this attribute but is at the same time different from the fill.
Metadata
Metadata
Assignees
Labels
No labels