Create Colormaps

Discrete

pandapower.plotting.cmap_discrete(cmap_list)

Can be used to create a discrete colormap.

INPUT:
  • cmap_list (list) - list of tuples, where each tuple represents one range. Each tuple has the form of ((from, to), color).

OUTPUT:
  • cmap - matplotlib colormap

  • norm - matplotlib norm object

EXAMPLE:
>>> from pandapower.plotting import cmap_discrete, create_line_trace, draw_traces
>>> cmap_list = [((20, 50), "green"), ((50, 70), "yellow"), ((70, 100), "red")]
>>> cmap, norm = cmap_discrete(cmap_list)
>>> lc = create_line_trace(net, cmap=cmap, norm=norm)
>>> draw_traces([lc])

Continous

pandapower.plotting.cmap_continous(cmap_list)

Can be used to create a continous colormap.

INPUT:
  • cmap_list (list) - list of tuples, where each tuple represents one color. Each tuple has the form of (center, color). The colorbar is a linear segmentation of the colors between the centers.

OUTPUT:
  • cmap - matplotlib colormap

  • norm - matplotlib norm object

EXAMPLE:
>>> from pandapower.plotting import cmap_continous, create_bus_trace, draw_traces
>>> cmap_list = [(0.97, "blue"), (1.0, "green"), (1.03, "red")]
>>> cmap, norm = cmap_continous(cmap_list)
>>> bc = create_bus_trace(net, cmap=cmap, norm=norm)
>>> draw_traces([bc])