Base Plot Configurations

In the following, all currently available utopya base plot configuration entries are shown. These can be used with the based_on argument of a plot configuration. By specifying a list of base plot configurations, they can be combined.

For more information, see Plot Configuration Inheritance.

# -- Defaults -----------------------------------------------------------------
# .. A config with defaults styles and helpers ................................
# This can be used then creating a model plot and desiring default styles that
# are consistent with the utopya plot functions' styles
.default_style_and_helpers:
  helpers: &default_helpers
    save_figure:
      bbox_inches: tight

  style: &default_style
    axes.grid: true
    grid.linewidth: .4
    grid.alpha: .5
    legend.fontsize: small

# .. Save as PNG for use in documentation .....................................
.png4docs:
  file_ext: png
  helpers:
    save_figure:
      dpi: 254


# .. Default parameters for creators ..........................................
.creator.universe:
  creator: universe
  universes: all

.creator.multiverse:
  creator: multiverse


# .. Default parameters for animations ........................................
.animation.frames:
  file_ext: pdf
  animation:
    enabled: true
    writer: frames

    writer_kwargs: &default_writer_kwargs
      frames:
        saving:
          dpi: 254
      ffmpeg:
        init:
          fps: 10
        saving:
          dpi: 254

.animation.ffmpeg:
  file_ext: mp4
  animation:
    enabled: true
    writer: ffmpeg
    writer_kwargs: *default_writer_kwargs


# -- Basic plots --------------------------------------------------------------
# .. Basic lineplot from universe data ........................................
.basic_uni.lineplot:
  creator: universe
  universes: all

  module: .basic_uni
  plot_func: lineplot

  # Use default helpers and style
  helpers:
    <<: *default_helpers
  style:
    <<: *default_style

# .. Multiple lineplots from universe data ....................................
.basic_uni.lineplots:
  creator: universe
  universes: all

  module: .basic_uni
  plot_func: lineplots

  # Use default helpers and style
  helpers:
    <<: *default_helpers
  style:
    <<: *default_style

# .. Basic errorbar plot from universe data ...................................
# NOTE Preferably, use the .dag.generic.errorbar function instead! See below.
.basic_uni.errorbar:
  creator: universe
  universes: all

  module: .basic_uni
  plot_func: errorbar

  # Use default helpers and style
  helpers:
    <<: *default_helpers
  style:
    <<: *default_style

  # Passed to plt.errorbar or plt.fill_between
  elinewidth: .5
  fill_between_kwargs:
    linewidth: 0.

# .. Distance map from Universe data .......................................
.basic_uni.distance_map:
  creator: universe
  universes: all

  module: .basic_uni
  plot_func: distance_map

  # Use default helpers and style
  helpers:
    <<: *default_helpers
  style:
    <<: *default_style


# .. Errorbar plot from Multiverse data .......................................
# NOTE Preferably, use the .dag.generic.errorbar function instead! See below.
.basic_mv.errorbar:
  creator: multiverse

  module: .basic_mv
  plot_func: errorbar

  helpers:
    <<: *default_helpers
  style:
    <<: *default_style

  # Passed to plt.errorbar
  elinewidth: .5
  fill_between_kwargs:
    linewidth: 0.


# .. Asymptotic average from Multiverse data ..................................
.basic_mv.asymptotic_average:
  creator: multiverse

  module: .basic_mv
  plot_func: asymptotic_average

  helpers:
    <<: *default_helpers
  style:
    <<: *default_style

  # Passed to plt.errorbar
  linestyle: ''
  elinewidth: .5
  marker: o


# -- CA Plots -----------------------------------------------------------------
# .. A spatial CA plot of a state .............................................
# Supports PlotHelper and animation
.ca.state: &ca_state
  creator: universe
  universes: all

  module: .ca
  plot_func: state

  file_ext: pdf

  default_imshow_kwargs:
    interpolation: 'none'

  # Can use constrained layout, because axis labels don't change
  style:
    figure.constrained_layout.use: true

  helpers:
    <<: *default_helpers
    # NOTE As the PlotHelper.save_figure method is _not_ invoked during
    #      animation, there is no issue with bbox_inches tight

  # All animation configuration for this plot
  animation: &ca_state_animation
    enabled: false  # has to be manually enabled
    writer: frames  # assuming ffmpeg is not installed

    # Configuration for each writer
    writer_kwargs:
      frames:
        saving:
          dpi: 96

      ffmpeg:
        init:
          fps: 10
        saving:
          dpi: 96


# .. .ca.state specializations for different animation writers ................
.ca.state.anim_frames:
  <<: *ca_state

  file_ext: pdf

  time_idx: 0  # value is ignored in animation, but needs be specified

  # Use a different figure size as most animation plots are square
  style: &ca_state_anim_style
    figure.figsize: [6., 5.]

  animation:
    <<: *ca_state_animation
    enabled: true
    writer: frames


.ca.state.anim_ffmpeg:
  <<: *ca_state

  file_ext: mp4

  time_idx: 0  # value is ignored in animation, but needs be specified

  style:
    <<: *ca_state_anim_style

  animation:
    <<: *ca_state_animation
    enabled: true
    writer: ffmpeg


# -- Distributions ------------------------------------------------------------
# .. A histogram plot .........................................................
.distribution.histogram: &histogram
  creator: universe
  universes: all

  module: .distribution
  plot_func: histogram

  helpers:
    <<: *default_helpers
  style:
    <<: *default_style


# .. Plot of a complementary cumulative distribution ..........................
# Based on histogram, but with normalization and complementary cumulation
.distribution.histogram.complementary_cumulative:
  <<: *histogram

  use_unique: true
  mask_repeated: true
  postprocess:
    - normalize_to_sum
    - cumulate_complementary

  # Do a line plot (instead of the default bar plot)
  pyplot_func_name: plot

  # Arguments passed to plt.plot
  linestyle: 'None'
  marker: '.'


# -- Time Series --------------------------------------------------------------
# .. Plot of a single density .................................................
.time_series.density:
  creator: universe
  universes: all

  module: .time_series
  plot_func: density

  helpers:
    <<: *default_helpers
  style:
    <<: *default_style


# .. Plot of multiple densities ...............................................
.time_series.densities:
  creator: universe
  universes: all

  module: .time_series
  plot_func: densities

  # Use default helpers and style
  helpers:
    <<: *default_helpers
  style:
    <<: *default_style


# .. Phase space with colour-coded time .......................................
.time_series.phase_space:
  creator: universe
  universes: all

  module: .time_series
  plot_func: phase_space

  # Use default helpers and style
  helpers:
    <<: *default_helpers
  style:
    <<: *default_style


# -- Bifurcation diagrams -----------------------------------------------------
.attractor.bifurcation_diagram_1d:
  creator: multiverse
  module: .attractor
  plot_func: bifurcation_diagram

  analysis_kwargs: ~

  # Use default helpers and style, but disable grid
  helpers:
    <<: *default_helpers
  style:
    <<: *default_style
    axes.grid: false

.attractor.bifurcation_diagram_2d:
  creator: multiverse
  module: .attractor
  plot_func: bifurcation_diagram

  analysis_kwargs: ~

  # Use default helpers and style, but disable grid
  helpers:
    <<: *default_helpers
  style:
    <<: *default_style
    axes.grid: false


# -----------------------------------------------------------------------------
# -- DAG-based plots ----------------------------------------------------------
# -----------------------------------------------------------------------------
# -- Generic Multiverse or Universe plots -------------------------------------
# .. Time series ..............................................................
.dag.generic.time_series:
  module: .dag.time_series
  plot_func: time_series

  helpers:
    <<: *default_helpers
  style:
    <<: *default_style


# .. Facet Grid ...............................................................
# For conveniently plotting high-dimensional data, using dantro.
#    Docs: https://dantro.readthedocs.io/en/latest/plotting/plot_functions.html
.dag.generic.facet_grid:
  module: &dantro_plots dantro.plot_creators.ext_funcs.generic
  plot_func: facet_grid

  helpers:
    <<: *default_helpers
  style:
    <<: *default_style


# .. Errorbar and Errorbands ..................................................
# For visualizing confidence intervals using error bars or bands (shaded area)
#    Docs: https://dantro.readthedocs.io/en/latest/plotting/plot_functions.html
.dag.generic.errorbar:
  module: *dantro_plots
  plot_func: errorbar

  helpers:
    <<: *default_helpers
  style:
    <<: *default_style

.dag.generic.errorbands:
  module: *dantro_plots
  plot_func: errorbands

  helpers:
    <<: *default_helpers
  style:
    <<: *default_style


# .. Distributions ............................................................
# A histogram plot that supports stacking
.dag.generic.histogram:
  creator: universe
  universes: all

  module: .dag.generic
  plot_func: histogram

  helpers:
    <<: *default_helpers
  style:
    <<: *default_style


# .. Multiplot ................................................................
# Plot one or multiple overlaying functions, also supporting seaborn
#    Docs: https://dantro.readthedocs.io/en/latest/plotting/plot_functions.html
.dag.multiplot:
  module: dantro.plot_creators.ext_funcs.multiplot
  plot_func: multiplot

  helpers:
    <<: *default_helpers
  style:
    <<: *default_style
    

# .. Graph plots ..............................................................
.dag.graph:
  creator: universe
  universes: all

  module: .dag.graph
  plot_func: draw_graph

  graph_drawing:
    nodes:
      colorbar:
        fraction: 0.05
        pad: 0.02
    edges:
      colorbar:
        fraction: 0.05
        pad: 0.02

  helpers:
    <<: *default_helpers