0

My code is

if (selected_chart_type == "RidgeLine Plot") {
      fig <- plot_ly(data = age_group_populations, x = ~t04cp02, y = ~t04v01, color = ~t04tehname, type = "violin", colors = color_palette) %>%
        layout(title = paste("District Population by Age (Ridge Line Plot) in", selected_district, ",", selected_province),
               xaxis = list(title = "Population (%)"),
               yaxis = list(title = "Age"),
               violinmode = "overlay", # Overlaying violins for better comparison
               template = "plotly_dark")
    }

and the error is

Warning: 'layout' objects don't have these attributes: 'violinmode'

I want to genarate a ridge line plot using these parameters

zx8754
  • 52,746
  • 12
  • 114
  • 209
Zawish
  • 1
  • which version of plotly do you use? Maybe update your package? – pbraeutigm Aug 03 '23 at 07:27
  • Perhaps relevant? https://community.plotly.com/t/unable-to-plot-split-violin-plots-with-layout-attributes-violingap-violingroupgap-and-violinmode/64089 – Jon Spring Aug 03 '23 at 17:11
  • A warning won't prevent plotting. For `violinmode`, `overlay` is the default (so you don't need it). If you want it to be a ridge plot, you probably want to add these arguments to the call for `plot_ly`: `orientation = "h", side = "positive"` I think you'll need to add `fillcolor = ~t04tehname` (along with your color arguments). It looks like you're new to SO; welcome! If you want great answers quickly, [reproducible questions](https://stackoverflow.com/q/5963269) are best, including sample data, like the output from `dput()` or `reprex::reprex()` and any libraries you are using. – Kat Aug 04 '23 at 21:21

0 Answers0