plumed_bench_pp.plot

Functions

plot_histo(ax, data, row[, barwidth, ...])

Plot a histogram based on the provided data for a specified row.

plot_histo_relative(ax, data, row, relative_to)

Plots a histogram of the given data relative to the relative_to data.

plot_lines(ax, data, row, *[, ...])

Plot a line chart based on the provided data for a specified row.

plumed_bench_pp.plot.plot_histo(ax: Axes, data: list[dict] | dict[str, DataFrame], row: str, barwidth: float = 0.8, *, normalize_to_cycles: bool | str = False, colors: list | None = None, relative_to: dict[str, DataFrame] | Any = None, relative_to_row: str | None = None, titles: list[str] | None = None, equidistant_bars: bool = True, scale_y_axis: float = 1.0) list[BarContainer]

Plot a histogram based on the provided data for a specified row.

It can be set up to normalize the data to cycles (normalize_to_cycles) and/or relative to another row. normalize_to_cycles can be either a boolean flag or the name of the row to use as base for the cycles: This is useful when using the TOTALTIME row, that is reported as a single cycle.

It can be set up to use a custom x-axis or colors for the bars.

It can be set up to plot relative to another dataset, dividing the value of each column by that number.

Parameters:
  • ax (Axes) – The matplotlib axes to plot the histogram.

  • data (list[dict]|dict[str,DataFrame]) – The data to be plotted.

  • row (str) – The row in the data to be plotted.

  • barwidth (float, optional) – The width of the bars in the histogram. Defaults to 0.8.

  • normalize_to_cycles (bool|str, optional) – Flag to normalize data to cycles, if set to a row name the cycles of that row will be used. Defaults to False.

  • colors (list|None, optional) – The colors for the bars in the histogram. Defaults to None.

  • relative_to (dict[str, DataFrame]| Any, optional) – Data for relative comparison, you can pass a dict contianing the collection of data or the address or index of the desired base in the passed data. Defaults to None.

  • equidistant_bars (bool, optional) – If set to false the center of the groups bars will be in the number of atoms, by default the bars are evenly spaced. Defaults to True.

  • scale_y_axis (float) – scale all the y axis values by this number ingnored if “relative_to is specified. Defaults to 1.0.

Returns:

The list of plotted bars.

Return type:

list

plumed_bench_pp.plot.plot_histo_relative(ax: Axes, data: list[dict] | dict[str, DataFrame], row: str, relative_to: dict[str, DataFrame] | Any, relative_to_row: str | None = None, barwidth: float = 0.8, **kwargs) list[BarContainer]

Plots a histogram of the given data relative to the relative_to data.

Parameters:
  • ax (matplotlib.axes.Axes) – The axes on which to plot the histogram.

  • data (list[dict] | dict[str, pandas.DataFrame]) – The data to plot. It can be a list of dictionaries where each dictionary contains a DataFrame indexed by the name of a kernel. Alternatively, it can be a single dictionary where the keys are the names of the kernels and the values are the corresponding DataFrames.

  • row (str) – The row to plot.

  • relative_to (dict[str, pandas.DataFrame] | Any) – The data to which the values of the current data are relative to. It can be a dictionary where the keys are the names of the kernels and the values are the corresponding DataFrames. Alternatively, it can be a string representing the name of a kernel in the data dictionary.

  • relative_to_row (str | None) – The row in the relative_to data to use for the reference values. If None, the row specified by row is used.

  • barwidth (float) – The width of the bars in the histogram.

  • **kwargs – Additional keyword arguments passed to plot_histo.

Returns:

The bars plotted in the histogram.

Return type:

list[matplotlib.container.BarContainer]

See also

plot_histo: A function that plots a histogram of the given data.

plumed_bench_pp.plot.plot_lines(ax: Axes, data: list[dict] | dict[str, DataFrame], row: str, *, normalize_to_cycles: bool | str = False, colors: list | None = None, relative_to: dict[str, DataFrame] | Any = None, relative_to_row: str | None = None, titles: list[str] | None = None, equidistant_points: bool = False, force_x_ticks: bool = False, plotkwargs: None | dict = None, scale_y_axis: float = 1.0)

Plot a line chart based on the provided data for a specified row.

It can be set up to normalize the data to cycles (normalize_to_cycles) and/or relative to another row. normalize_to_cycles can be either a boolean flag or the name of the row to use as base for the cycles: This is useful when using the TOTALTIME row, that is reported as a single cycle.

It can be set up to use a custom x-axis or colors for the bars.

It can be set up to plot relative to another dataset, dividing the heigh of each point by that number.

Parameters:
  • ax (Axes) – The matplotlib axes to plot the histogram.

  • data (list[dict]|dict[str,DataFrame]) – The data to be plotted.

  • row (str) – The row in the data to be plotted.

  • barwidth (float, optional) – The width of the bars in the histogram. Defaults to 0.8.

  • normalize_to_cycles (bool|str, optional) – Flag to normalize data to cycles, if set to a row name the cycles of that row will be used. Defaults to False.

  • colors (list|None, optional) – The colors for the bars in the histogram. Defaults to None.

  • relative_to (dict[str, DataFrame]| Any, optional) – Data for relative comparison, you can pass a dict contianing the collection of data or the address or index of the desired base in the passed data. Defaults to None.

  • equidistant_points (bool, optional) – If set to True the point on the line will be set at regular interval. Defaults to False.

  • force_x_ticks (bool, optional) – Forces the xaxis ticks to be the x positions of the passed data. Defaults to False.

  • plotkwargs (dict|None, optional) – Extra arguments to pass to the lineplot. Defaults to None.

  • scale_y_axis (float) – scale all the y axis values by this number ingnored if “relative_to is specified. Defaults to 1.0.

Returns:

The list of plotted bars.

Return type:

list