0
制定3個月的天然氣價格曲線。我有一些軸問題。我希望能夠顯示日期而不是天數。曲線圖中的格式化軸圖R
library(ggplot2)
library(Quandl)
library(magrittr)
require(plotly)
#Get first 3 month on the nat gas curve data from Quandl
my_start_date <- "2013-01-05"
gas1<-Quandl("CHRIS/CME_NG1", start_date = my_start_date, type = "xts")
gas2<-Quandl("CHRIS/CME_NG2", start_date = my_start_date, type = "xts")
gas3<-Quandl("CHRIS/CME_NG3", start_date = my_start_date, type = "xts")
#isolate the last prices
gas1a<-gas1[,"Last"]
gas2a<-gas2[,"Last"]
gas3a<-gas3[,"Last"]
p <- merge(as.zoo(gas1a), as.zoo(gas2a), as.zoo(gas3a), all = FALSE)
#3d graph
plot_ly(z = p, type = "surface")%>%
layout(title = "3 month Nat Gas curve",
scene = list(
xaxis = list(title = "Month"),
yaxis = list(title = "Days"),
zaxis = list(title = "Price")))
多數民衆贊成在偉大的 - 我如何角度日期的文字? – Rhodo
我更新了我的答案:-) – MLavoie
非常感謝你,任何想法如何在x軸上反轉軸標籤?最後一個對不起 – Rhodo