LoginSignup
0
0

More than 5 years have passed since last update.

ggplot2でplotのtype="b"に似たプロットをする。

Last updated at Posted at 2018-01-28

簡単なのは、geom_line()とgeom_point()の間に、背景色と同じ色で大きめの点をプロットするgeom_point()を挿入する方法。

library(ggplot2)

ggplot(mtcars, aes(mpg, wt)) + theme_bw() +
    geom_line() +
    geom_point(size=5, color="white") + # 挿入
    geom_point()

mtcarsは自動車の燃費等に関するデータセット(32台分)。wt: Weight (1000 lbs)、mpg: Miles/(US) gallon。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0