作者cd12631 (<(◥█◤△◥█◤)>)
看板R_Language
标题Re: [问题] 折线图+长条图呈现
时间Wed Nov 23 01:33:12 2016
想看别种绘图吗?
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
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.34.121.188
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/R_Language/M.1479835999.A.338.html
1F:推 celestialgod: 哈哈哈,推,真的有人刻了 11/23 01:39
2F:推 celestialgod: 偷偷说偷懒的方法其实是直接把ggplot的图,加上ggpl 11/23 01:40
3F:推 celestialgod: otly就好 11/23 01:40
4F:推 samex4x4: 出现第四个套件啦XDD 真的好多画法啊 11/23 09:54
5F:→ clansoda: plotly比较fancy,而且用ggplot的语法就能实现 11/23 11:09
6F:→ clansoda: 端看个人喜好XDD,漂亮的大家都爱阿 11/23 11:09
7F:推 andrew43: 现在是在集七龙珠吗? 11/23 19:14
8F:推 locka: 可以藉机请教cd12631大大怎麽把图放到github.io上的吗? 11/23 23:02
如果是问那个互动网页介面的话
可以参考
https://pages.github.com
或google github pages
我就是利用plotly 做一个网页
然後丢到自己github里 github.io的repository里
※ 编辑: cd12631 (114.34.121.188), 11/24/2016 00:32:47
9F:推 locka: 谢谢cd大!! 我试成功了,感谢! 11/24 00:50