Hey all,
My task is to generate multifaceted plots for an R/Shiny app. The data comes from various dataframes, so I was looking into generating the list() structure found here, in the “Figures as Lists” section. :
This example is for one figure, and I need to have multiple figures for each plot; could anybody either point me towards the spec where I can figure out how to do this, or point me in the right direction? As an example, I’m trying this:
fig = list(
data = list (
list (
x = seq(2000,2025),
y = c(21222.00,21222.00,21222.00,21222.00,21222.00,21222.00,21226.45,20675.77,19591.21,18583.49,17672.87,16849.59,16104.66,15429.89,14817.91,14262.17,13756.82,13296.71,12877.26,12494.43,12144.65,11824.71,11531.72,11263.05,11016.31,10789.32),
type = "scatter"
),
list (
x = seq(2000,2025),
y = c(150703.0,150703.0,150703.0,150703.0,150703.0,150703.0,150701.1,151067.1,152113.7,153732.0,155840.6,158379.5,161295.3,164538.1,168060.5,171816.7,175761.3,179848.9,184033.5,188268.1,192503.7,196693.0,200794.1,204774.1,208608.6,212281.6),
type = "scatter"
)
),
layout = list (
title = 'A Figure Specified By R List',
plot_bgcolor='#e5ecf6',
xaxis = list(
zerolinecolor = '#ffff',
zerolinewidth = 2,
gridcolor = 'ffff'),
yaxis = list(
zerolinecolor = '#ffff',
zerolinewidth = 2,
gridcolor = 'ffff')
)
)
This plots as I would expect; one figure with two traces. I need to create several figures with several traces; I can put more entries in the data section but I’m at a loss as to how to create different figures within the plot.
Thank you for your help!
Jeff