简体   繁体   English

编辑时间序列分解图

[英]Editing the time series- decomposed plots

Is it possible to remove the empty grey boxes (highlighted inside red circle) present to the right side of the decomposed plots (attached)?是否可以删除分解图(已附)右侧的空灰色框(红色圆圈内突出显示)?

Also, it is possible to change the title fonts (highlighted inside green circle) of the individual to Times New Roman or any other fonds of choice?此外,是否可以将个人的标题 fonts(在绿色圆圈内突出显示)更改为 Times New Roman 或任何其他喜欢的字体?

The r code used for creating the plot is as below用于创建plot的r代码如下

autoplot(decompose(x, type = "additive"))+labs(y=expression(Chl[a]~(µg/L)), x="Year") + ggtitle(expression(Decomposed~Chl[a]~Time~Series~BB1)) + theme(plot.title=element_text(hjust=0.5))

time series- decomposed plots时间序列分解图

时间序列分解图

In the forecast package it is not possible to position the scale bars on the left.在预测 package 中,左侧的比例尺不可能为 position。 You would have to remove the scale bars and add them to the left yourself manually.您将不得不删除比例尺并手动将它们添加到左侧。 This can be done by setting autoplot(x, range.bars = FALSE) .这可以通过设置autoplot(x, range.bars = FALSE)来完成。

You can specify the font family in ggplot2 by setting the appropriate theme() text field to element_text(family = ***) .您可以通过将适当的theme()文本字段设置为element_text(family = ***)来指定 ggplot2 中的字体系列。

I have used USAccDeaths as an example dataset here:我在这里使用USAccDeaths作为示例数据集:

library(fpp2)
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
#> ── Attaching packages ────────────────────────────────────────────── fpp2 2.4 ──
#> ✓ ggplot2   3.3.5.9000     ✓ fma       2.4       
#> ✓ forecast  8.15           ✓ expsmooth 2.3
#> 
autoplot(decompose(USAccDeaths, type = "additive"))+
  labs(y=expression(Chl[a]~(µg/L)), x="Year") + 
  ggtitle(expression(Decomposed~Chl[a]~Time~Series~BB1)) +
  theme(
    plot.title=element_text(hjust=0.5),
    text = element_text(family = "Times New Roman", size = 15)
  )

Created on 2021-08-26 by the reprex package (v2.0.0)reprex package (v2.0.0) 创建于 2021-08-26

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

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