How to plot one variable in ggplot?

前端 未结 5 1840
孤独总比滥情好
孤独总比滥情好 2020-12-23 16:48

I\'m searching but still can\'t find an answer to a quite simple question - how can we produce a simple dot plot of one variable with ggplot2 in R?

with plot<

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-23 17:14

    library(ggplot2)
    qplot(1:nrow(iris), Sepal.Length, data = iris, xlab = "Index")
    

    or

    ggplot(data = iris, aes(x = 1:nrow(iris), y = Sepal.Length)) +
        geom_point() +
        labs(x = "Index")
    

提交回复
热议问题