Combine Points with lines with ggplot2

前端 未结 3 1004
一生所求
一生所求 2020-12-05 07:03

I would like to plot a time series that look like this:

\"enter

what I plot wi

3条回答
  •  Happy的楠姐
    2020-12-05 07:29

    The following example using the iris dataset works fine:

    dat = melt(subset(iris, select = c("Sepal.Length","Sepal.Width", "Species")),
          id.vars = "Species")
    ggplot(aes(x = 1:nrow(iris), y = value, color = variable), data = dat) +  
          geom_point() + geom_line()
    

    enter image description here

提交回复
热议问题