想看別種繪圖嗎?
plotly: 我這不是來了嗎?
借用celestialgod的data frame作範例
library(plotly)
dt <- data.frame(
x = 1:8,
freq = c(120,130,140,150,160,170,170,180),
earn = c(3,3,5,4,6,7,3,5) * 0.1
)
dt_earn_plotly <- plot_ly(data = dt, x=dt$x, y=dt$earn, type = "scatter",
mode = "liners", name = "earn")
dt_freq_plotly <- plot_ly(data = dt, x=dt$x, y=dt$freq, type = "bar", name =
"freq")
dt_plotly <- subplot(dt_earn_plotly, dt_freq_plotly, nrows = 2, shareX =
TRUE)
dt_plotly
圖: http://yichunsung.github.io/plotly.png
互動介面: http://yichunsung.github.io/plotly
Code可能在Github上你會看得比較清楚:
https://github.com/yichunsung/R_Application/blob/master/plotly%20sample.R