Ось форматирования на графике поверхности Plotly R

Построение кривой цен на природный газ за 3 месяца. У меня проблемы с осью. Я бы хотел, чтобы вместо количества дней отображались даты.

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")))

person Rhodo    schedule 13.06.2016    source источник


Ответы (1)


Вы это ищете?

plot_ly(y=index(p), z = p, type = "surface")%>%
  layout(title = "3 month Nat Gas curve",
         scene = list(
            xaxis = list(title = "Month"),
            yaxis = list(title = "Days", tickangle = 180),
            zaxis = list(title = "Price")))
person MLavoie    schedule 13.06.2016
comment
это здорово - как мне наклонить текст дат? - person Rhodo; 13.06.2016
comment
Большое спасибо - есть идеи, как поменять местами метки осей на оси x? Последний извините - person Rhodo; 13.06.2016
comment
мы обычно добавляем autorange = reversed, но похоже, что это не работает для 3D-графика - person MLavoie; 13.06.2016