title: Plotly Dash : Persist or store state of Graph and DataTable component
body: <p>I have a multi-page/tab dash application and often switch between pages/tab. I have a <code>plotly Graph</code>, a <code>mapbox</code> component that is updated on button click.</p>
  <p>I'd like to be able to save the state of the <code>graph</code> and reference it in other tabs/functions. With inputs and others fields, I have used the <code>persistence</code> property, however, I do not see a way to do the same for <code>Graph figure</code>.</p>
  <pre><code>layout = html.Div([
  
              dash_table.DataTable(id='dt-table'),
              dcc.Graph(id='map-graph1'),
              dbc.Button(&quot;Run&quot;, id=&quot;run-button&quot;),
  
  ]),
  
  # Update map graph
  
  @app.callback(Output(&quot;map-graph1&quot;, &quot;figure&quot;),
            [
                Input(&quot;address&quot;, &quot;value&quot;),
                Input(&quot;type&quot;, &quot;value&quot;),
                Input(&quot;button&quot;, &quot;n_clicks&quot;)
            ]
           )
  def update_graph(address, type, n_clicks):
  
      data = []
  
      ....
      ....
      ....
      ....
  
      data.append({
  
                  &quot;type&quot;: &quot;scattermapbox&quot;,
                  &quot;lat&quot;: [lat],
                  &quot;lon&quot;: [lng],
                  &quot;name&quot;: &quot;Location&quot;,
                  &quot;showlegend&quot;: False,
                  &quot;hoverinfo&quot;: &quot;text&quot;,
                  &quot;mode&quot;: &quot;markers&quot;,
                  &quot;marker&quot;: {
                      &quot;symbol&quot;: &quot;circle&quot;,
                      &quot;size&quot;: 12,
                      &quot;opacity&quot;: 0.7
                      }
                  }
      )
  
      # Get lat long from geocoding api
      if n_clicks:
  
         result = calc_func(address, type)
  
         # Property Location
         data.append({
                      &quot;type&quot;: &quot;scattermapbox&quot;,
                      &quot;lat&quot;: [Lat],
                      &quot;lon&quot;: [Long],
                      &quot;hovertext&quot;: price,
                      &quot;textfont&quot;: {&quot;size&quot;: 22},
                      &quot;textposition&quot;: 'top-right',
                      &quot;showlegend&quot;: False,
                      &quot;hoverinfo&quot;: &quot;text&quot;,
                      &quot;mode&quot;: &quot;text+markers&quot;,
                      &quot;marker&quot;: {
                                 &quot;symbol&quot;: &quot;suitcase&quot;,
                                 &quot;size&quot;: 28,
                                 &quot;opacity&quot;: 0.7
                      }
                     }
          )
  
  
         layout = {
                   &quot;autosize&quot;: True,
                   &quot;hovermode&quot;: &quot;closest&quot;,
                   &quot;mapbox&quot;: {
                              &quot;accesstoken&quot;: MAPBOX_KEY,
                              &quot;bearing&quot;: 0,
                              &quot;center&quot;: {
                                         &quot;lat&quot;: layout_lat,
                                         &quot;lon&quot;: layout_lon
                              },
                              &quot;pitch&quot;: 0,
                              &quot;zoom&quot;: zoom,
                              &quot;style&quot;: &quot;outdoors&quot;,
                    }
                   }
  
  return {&quot;data&quot;: data, &quot;layout&quot;: layout}
  
  # Update DataTable
  @app.callback(Output(&quot;comps-table&quot;, &quot;data&quot;),
            [
                Input(&quot;address&quot;, &quot;value&quot;),
                Input(&quot;type&quot;, &quot;value&quot;),
                Input(&quot;comps-button&quot;, &quot;n_clicks&quot;)
            ]
           )
  def update_table(address, type, n_clicks):
  
      if n_clicks:
  
         result = calc_func(address, type, market)
         result_df = result['df_lease']
  
         df = pd.DataFrame(result_df, columns = ['Address','Type','Market'])
  
          df = df[df['Type'] == &quot;Type1&quot;]
          df_data = df.to_dict('rows')
  
          return (df_data)
  
      else:
  
          return (no_update)
  </code></pre>