简体   繁体   English

如何使用 tsibble object 生成时间序列 plot?

[英]How do I produce a time series plot using a tsibble object?

I am having difficulty producing a time series plot with a tsibble object as an input.我很难以 tsibble object 作为输入来生成时间序列 plot。

I am using the following code:我正在使用以下代码:

library(Ecdat)
library(tsibble)
library(ggplot2)
library(fable)
library(fabletools)
library(feasts)
inflation <- as.numeric(Mishkin[, 1])
data_ts <- ts(inflation,start=c(1950,2), frequency = 12)
data_tsbl <- as_tsibble(data_ts)

gg <- data_tsbl %>% ggplot2::autoplot(vars(value),xlab = "Month")
gg

I get an error: Ignoring unknown parameters: xlab.我收到一个错误:忽略未知参数:xlab。

Is there a way I can fix this?有没有办法解决这个问题?

autoplot() creates a ggplot object, and you specify the xlab after that: autoplot()创建一个 ggplot object,然后指定xlab

data_tsbl %>% ggplot2::autoplot(vars(value))+xlab("Month")

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM