I'm trying to figure out two problems in R ggplot:
- Show only data labels for every N day/data point
- Highlight (make the line bigger and/or dotted) for a specific variable
My code is below:
gplot(data = sales,
aes(x = dates, y = volume, colour = Country, size = ifelse(Country=="US", 1, 0.5) group = Country)) +
geom_line() +
geom_point() +
geom_text(data = sales, aes(label=volume), size=3, vjust = -0.5)
I can't find out a way how to space the data labels as currently they are being shown for each data point per every day and it's very hard to read the plot.
As for #2, unfortunately, the size with ifelse
doesn't work as 'US' line is becoming super huge and I can't change that size not matter what I specify in the first parameter of ifelse
.
Would appreciate any help!