Show all date values on ggplot x axis - R

前端 未结 1 326
死守一世寂寞
死守一世寂寞 2021-01-13 02:27

In the following little dataset, I would like to plot date values on the x axis. I want all ticks of the dates present in the dataframe to be labelled. At the moment it is o

1条回答
  •  伪装坚强ぢ
    2021-01-13 03:03

    You can supply melt$Sample as the breaks. You'll probably also want to rotate the axis labels to avoid overlap.

    ggplot(melt, aes(x = Sample, y = value, colour = variable, group = variable)) +
      facet_wrap(~Treatment) +
      geom_point() +
      geom_line() + 
      scale_x_date(breaks = melt$Sample) + 
      theme(axis.text.x = element_text(angle = 90))
    

    0 讨论(0)
提交回复
热议问题