7
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ggplot2やGGallyをplotlyに楽に変換する

Last updated at Posted at 2020-10-17

知らなかったのでメモがてら紹介

  • 作図したものをインタラクティブにしたい
  • plotlyが便利なのは知っているがplotly用のコード整形が面倒

それ、ggplot2が使えれば実現できます

# library(tidyverse)
library(dplyr)
library(ggplot2)
library(plotly)

g<- iris %>% 
  ggplot()+
  aes(x=Sepal.Length,y=Sepal.Width,color=Species)+
  geom_point()

# print(g)
ggplotly(g)

gggs.gif

ggplotly()」これだけでplotlyになっちゃう。素敵。

GGallyだって


library(GGally)

g<- iris %>% 
  GGally::ggpairs(data = ., aes(color = Species))

# print(g)

ggplotly(g)

ggg.gif

以上

便利

7
8
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
7
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?