Skip to content

Error in scale_x_continuous() when calling plot #24

Description

@haansn08

When I try to call the plot function on the estimated model, I get the following error:

$ R

R version 4.5.3 (2026-03-11) -- "Reassured Reassurer"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(mfbvar)
> prior_obj <- set_prior(Y = mf_usa, n_lags = 4, n_reps = 2000)
     mod_minn <- estimate_mfbvar(prior_obj, prior = "minn")
> plot(mod_minn)
Error in `scale_x_continuous()`:
! `breaks` and `labels` must have the same length.
Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()
<error/rlang_error>
Error in `scale_x_continuous()`:
! `breaks` and `labels` must have the same length.
---
Backtrace:1. ├─base::plot(mod_minn)
 2. └─mfbvar:::plot.mfbvar_minn(mod_minn)
 3.   └─ggplot2::scale_x_continuous(breaks = as.numeric(breaks), labels = break_labels)
 4.     └─ggplot2::continuous_scale(...)
 5.       └─ggplot2:::check_breaks_labels(breaks, labels, call = call)
Run rlang::last_trace(drop = FALSE) to see 2 hidden frames.
> sessionInfo()
R version 4.5.3 (2026-03-11)
Platform: x86_64-pc-linux-gnu
Running under: Arch Linux

Matrix products: default
BLAS:   /usr/lib/libblas.so.3.12.0
LAPACK: /usr/lib/liblapack.so.3.12.0  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: Europe/Vienna
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] mfbvar_0.5.6

loaded via a namespace (and not attached):
 [1] vctrs_0.7.2           cli_3.6.5             rlang_1.1.7
 [4] generics_0.1.4        S7_0.2.1              labeling_0.4.3
 [7] RcppParallel_5.1.11-2 glue_1.8.0            zoo_1.8-15
[10] stochvol_3.2.9        scales_1.4.0          grid_4.5.3
[13] tibble_3.3.1          lifecycle_1.0.5       compiler_4.5.3
[16] dplyr_1.2.0           GIGrvg_0.8            coda_0.19-4.1
[19] RColorBrewer_1.1-3    Rcpp_1.1.1            timechange_0.4.0
[22] pkgconfig_2.0.3       farver_2.1.2          lattice_0.22-9
[25] R6_2.6.1              tidyselect_1.2.1      parallel_4.5.3
[28] pillar_1.11.1         magrittr_2.0.4        withr_3.0.2
[31] tools_4.5.3           gtable_0.3.6          lubridate_1.9.5
[34] ggplot2_4.0.2
>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions