Commands being ignored but no error sign (scale_y_continuous, scale_linetype_manual)

There are two things I'd like to change on my graph, but the commands are being ignored and there is no error showing for either. First is the scale for y axis - I want the full numbers displayed, not with e. Secondly, I'd like to add different line types for each "Medium". But I don't know how to fix this, since the commands are simply being ignored. I attached a picture of how it looks like right now.

Here is my code:

ggplot(LR, aes(day, cc, colour = Medium))+
  stat_summary(geom="line", fun = "mean")+
  stat_summary(
    geom = "errorbar",
    fun.data = mean_se
  )+
  theme_bw()+
  scale_color_brewer(palette = "Dark2") +
  scale_y_continuous(limits = c(100000, 300000000))+
  labs(title = "Cell count",
       x = "Time [day]",
       y = "Cell count [cells/mL]") +
  theme(plot.title = element_text(hjust = 0.5))

Here is what I've already tried for changing the lines:

 LINES <- c("BBM + 3N" = "solid", "BBM + NH4Cl" = "dotted", "DM KNO3" = "solid", "DM urea" = "dashed")

ggplot(LR, aes(day, cc, colour = Medium))+
  stat_summary(geom="line", fun = "mean")+
  stat_summary(
    geom = "errorbar",
    fun.data = mean_se
  )+
  theme_bw()+
  scale_color_brewer(palette = "Dark2") +
  scale_y_continuous(limits = c(100000, 300000000))+
  labs(title = "Cell count",
       x = "Time [day]",
       y = "Cell count [cells/mL]") +
  theme(plot.title = element_text(hjust = 0.5))+
scale_linetype_manual(values = LINES)

LR is really helpful to work a problem like this. Ginning up data to replicate the result to be tweaked is a real deterrent. See the reprex FAQ,

Well actually it does what it should do.
It sounds a bit redundant, but before using scale_linetype_manual() you need to define which aesthetics define the line, in other words you have to add "linetype = Medium" e.g. into the aes() of the main call.

Also the y-axis scale is numeric, you just want to change the representation of the numbers.
Here the "label_number()" function in the scales package may help.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.