code: def add_or_remove_graph(add_graph, remove_graph, n, exp, gc_children):
      if (add_graph is None or n is None or exp is None) and (
          remove_graph is None
      ):
          return no_update
  
      # Transform the graph data to a figure
      gc_children = [] if gc_children is None else gc_children
  
      # Check if we need to remove a graph
      clicked_btns = [p["prop_id"] for p in callback_context.triggered]
      if any("remove-graph" in btn_name for btn_name in clicked_btns):
          if not len(gc_children):
              return no_update
          return gc_children[:-1]
  
      # No graph needs to be removed -> create a new graph
      uid = str(uuid4())
      new_child = html.Div(
          children=[
              # Note: we also add a dcc.Store component, which will be used to link the
              #       server side cached FigureResampler object
              dcc.Graph(
                  id={"type": "dynamic-graph", "index": uid},
                  figure=go.Figure(),
              ),
              dcc.Loading(
                  dcc.Store(id={"type": "store", "index": uid})
              ),
              # This dcc.Interval components makes sure that the `construct_display_graph`
              # callback is fired once after these components are added to the session
              # its front-end
              dcc.Interval(
                  id={"type": "interval", "index": uid},
                  max_intervals=1,
                  interval=1,
              ),
          ],
      )
      gc_children.append(new_child)
      return gc_children
  
file_path: plotly-resampler/examples/dash_apps/11_sine_generator.py
imports: from uuid import uuid4
  import dash_bootstrap_components
  import numpy
  import plotly.graph_objects
  from dash import MATCH, Input, Output, State, callback_context, dcc, html, no_update
  from dash_extensions.enrich import DashProxy, Serverside, ServersideOutputTransform, Trigger, TriggerTransform
  from plotly_resampler import FigureResampler
label_desc: Use image node_id 1 for calling a global function with example usage: add_or_remove_graph(add_graph, remove_graph, n, exp, gc_children) and returns: gc_children, no_update, gc_children, no_update