code: def plot_causal_graph_networkx(
      causal_graph: nx.Graph,
      layout_prog: Optional[str] = None,
      causal_strengths: Optional[Dict[Tuple[Any, Any], float]] = None,
      colors: Optional[Dict[Union[Any, Tuple[Any, Any]], str]] = None,
      filename: Optional[str] = None,
      display_plot: bool = True,
      label_wrap_length: int = 3,
      figure_size: Optional[Tuple[int, int]] = None,
  ) -> None:
      if causal_strengths is None:
          causal_strengths = {}
      else:
          causal_strengths = deepcopy(causal_strengths)
      if colors is None:
          colors = {}
      else:
          colors = deepcopy(colors)
  
      max_strength = 0.0
      for source, target, strength in causal_graph.edges(
          data="CAUSAL_STRENGTH", default=None
      ):
          if (source, target) not in causal_strengths:
              causal_strengths[(source, target)] = strength
  
          if causal_strengths[(source, target)] is not None:
              max_strength = max(
                  max_strength, abs(causal_strengths[(source, target)])
              )
  
          if (source, target) not in colors:
              colors[(source, target)] = "gray"
  
      for edge in causal_graph.edges:
          if edge[0] == edge[1]:
              raise ValueError(
                  "Node %s has a self-cycle, i.e. a node pointing to itself. Plotting self-cycles is "
                  "currently only supported for plots using Graphviz! Consider installing the corresponding"
                  "requirements." % edge[0]
              )
  
      # Wrapping labels if they are too long
      labels = {}
      for node in causal_graph.nodes:
          if node not in colors:
              colors[node] = "skyblue"
  
          node_name_splits = str(node).split(" ")
          for i in range(1, len(node_name_splits)):
              if len(node_name_splits[i - 1]) > label_wrap_length:
                  node_name_splits[i] = "\n" + node_name_splits[i]
              else:
                  node_name_splits[i] = " " + node_name_splits[i]
  
          labels[node] = "".join(node_name_splits)
  
      from dowhy.utils.plotting import _calc_arrow_width
  
      edge_widths = {
          (s, t): 2
          if causal_strengths[(s, t)] is None
          else _calc_arrow_width(causal_strengths[(s, t)], max_strength)
          for (s, t) in causal_graph.edges()
      }
  
      if layout_prog is not None:
          layout = nx_pydot.pydot_layout(causal_graph, prog=layout_prog)
          if figure_size is not None:
              figure = plt.figure(figsize=figure_size)
          else:
              figure = plt.figure()
  
          nx.draw(
              causal_graph,
              pos=layout,
              node_color=[
                  colors[node] for node in causal_graph.nodes()
              ],
              edge_color=[
                  colors[(s, t)] for (s, t) in causal_graph.edges()
              ],
              labels=labels,
              font_weight="bold",
              node_size=2000,
              arrowsize=20,
              alpha=0.8,
              width=[
                  edge_widths[(s, t)] for (s, t) in causal_graph.edges()
              ],
          )
      else:
          figure = _draw_graph_with_custom_layout(
              causal_graph, colors, edge_widths, figure_size
          )
  
      plt.gca().set_axis_off()
      if display_plot:
          plt.show()
  
      if filename is not None:
          figure.savefig(filename)
  
file_path: dowhy/dowhy/utils/networkx_plotting.py
imports: from copy import deepcopy
  from typing import Any, Dict, List, Optional, Tuple, Union
  import matplotlib.pyplot
  import networkx
  import numpy
  import pandas
  from networkx.drawing import nx_pydot
label_desc: Use image node_id 1 for calling a global function with example usage: plot_causal_graph_networkx(causal_graph, layout_prog, causal_strengths, colors, filename, display_plot, label_wrap_length, figure_size) without return types