Questions tagged [autoplot]
30 questions
0
votes
1 answer
How to combine the line series in two plots rendered in autoplot into a single plot, sharing the same y-axis and with two different x-axes?
In the below code, I render two separate plots using the autoplot() function. The first plot (transPlot1) allows the user to transform the data series via slider input, whereas the 2nd plot shows the original untransformed series (transPlot2) and is…

Village.Idyot
- 1,359
- 2
- 8
0
votes
1 answer
Why is the autoplot function giving an error in this example from publication "Forecasting: Principles and Practice" not working?
I am working through section 2.2 "Time Plots" of publication Forecasting: Principles and Practice by Hyndman and Athanasopoulos (https://otexts.com/fpp3/time-plots.html) and I can't get the autoplot() function referenced therein to work. I assume…

Curious Jorge - user9788072
- 2,548
- 1
- 9
- 22
0
votes
1 answer
How to turn VAR graph forecast in fpp3 R package?
Hi have the following dataset:
library(tidyverse)
library(dplyr)
library(tidymodels)
library(fpp3)
library(tsibble)
library(timetk)
chess.data <- read.csv("https://raw.githubusercontent.com/rhozon/datasets/master/fidedfv3.csv", head = TRUE, sep =…

Rodrigo H. Ozon
- 125
- 7
0
votes
1 answer
r Change line width of eigenvectors in autoplot pca
In R, one can easily display eigenvectors in PCA ordination plots using the autoplot function from the ggfortify package, as per the sample code below:
library(ggfortify)
library(ggrepel)
data(iris)
df <- iris[1:4]
pca_res <- prcomp(df, scale. =…

maurobio
- 1,480
- 4
- 27
- 38
0
votes
0 answers
Can't plot my time series data and training data on the same graph, with different colours?
Im trying to plot both the original data and my training data on the same graph with this code:
timeseries <- ts(df$new_cases_per_million, start=c(2021,2), end=c(2022,3), frequency=52)
ts_train <-…

Tuey
- 1
- 2
0
votes
1 answer
attributes in autoplot() function do not do anything , R
I have a dataset with time, status ( 1=death, 0 = censored), treatement =1,2 .
I create my survival object km_2, I want to plot Kaplan-Meijer plot using autoplot(). I do not know what my mistake is but setting the attributes ( legendLabs for example…

Mathica
- 1,241
- 1
- 5
- 17
0
votes
0 answers
Select a single forecast plot using fable::autoplot
I'm using example data from the Forecasting: Principles and Practice textbook chapter on VAR models here to make forecast plots using the fable package.
I'd like to be able to select a single plot from those returned by autoplot. For example, in the…

meenaparam
- 1,949
- 2
- 17
- 29
0
votes
1 answer
Autoplot in shiny with Select Input not working
I'm trying to create an autoplot that will show a plot based on what variable the user selects, but it just shows up as a straight line even though the name on the y axis does change depening on what the user chooses. Here is a basic version of the…

An Bha
- 1
0
votes
1 answer
Removing gap between historical and forecasted in autoplot from forecast package
?autoplot.forecast
If showgap=FALSE, the gap between the historical observations and the forecasts is removed.
However, for me it is not removed.
library(forecast)
d <- ts(rnorm(36), start = c(2021, 1), frequency = 12)
fc <- snaive(d, h =…

MLEN
- 2,162
- 2
- 20
- 36
0
votes
0 answers
Structural breaks in R: plotting trends
I'm trying to replicate the structure of the next grapich with ggplot2, but I did not find how to make it.
I have ts data and I want to add the regression lines for each of the structural breaks computed in my unit root test analysis.
…

Lucas Guzman
- 1
- 1
0
votes
0 answers
R - Timeseries, autoplot(), scale_y_continuous(), and the disappearing geom_abline()
I'm attempting to fit a regression line to the some data (mens400 from the fpp2 library).
library(fpp2)
library(forecast)
m400 <- tslm(mens400 ~ tm400)
I'd like to produce a plot of the data with the regression line included.
autoplot(mens400) +
…

Englishman Bob
- 377
- 2
- 13
0
votes
1 answer
Add sample info to dataset in PCA (R)
Im a biologist, not a programmer so please be gentle.
So I have a dataset that looks like
Genes Patient1 Patient2 Patient3
A 324 433 343
B 431 342 124
Z 232 234 267
then I have…

Athon
- 1
- 5
0
votes
0 answers
how to display corresponding legend when using scale_shape_identity()?
Hello I Have a plot showing a PCA reuslt, the issue is that I want to show how the points behave in the plot accoriding to two variables, let's say sample date and depth of sampling:
I use autoplot for this porpuse:
autoplot(PCA_results, data =…

Valentin
- 399
- 2
- 10
0
votes
1 answer
R autoplot works when running line-by-line but not when source-ing R script
I'm observing a very strange behaviour with R.
The following code works when I type it in line-by-line into an instance of R run from my terminal. (OS is Debian Linux.)
However it does not work when I try and run source("script.R").
It also does not…

FreelanceConsultant
- 13,167
- 27
- 115
- 225
0
votes
1 answer
DCA : Labelling points with autoplot or ggplot2
I find very difficult to put labels for sites with a DCA in a autoplot or ggplot.
I also want to differentiate the points on the autoplot/ggplot according to their groups.
This is the data and the code I used and it went well until the command for…

jammah
- 25
- 5