root_mcp.extended.tools.plotting module

Plotting tools for ROOT data visualization.

class root_mcp.extended.tools.plotting.PlottingTools(config, file_manager, path_validator, histogram_ops)[source]

Bases: object

Tools for creating plots from ROOT data.

Parameters:
__init__(config, file_manager, path_validator, histogram_ops)[source]

Initialize plotting tools.

Parameters:
plot_histogram_1d(data=None, path=None, tree_name=None, branch=None, bins=None, range=None, selection=None, weights=None, defines=None, output_path='/tmp/histogram.png', title=None, xlabel=None, ylabel='Events', log_y=False, style='default')[source]

Create a 1D histogram plot.

Parameters:
  • data (dict[str, Any] | None) – Pre-calculated histogram data (optional)

  • path (str | None) – File path (optional if data provided)

  • tree_name (str | None) – Tree name (optional if data provided)

  • branch (str | None) – Branch to histogram (optional if data provided)

  • bins (int | None) – Number of bins (optional if data provided)

  • range (tuple[float, float] | None) – (min, max) for histogram

  • selection (str | None) – Optional cut expression

  • weights (str | None) – Optional weight branch

  • defines (dict[str, str] | str | None) – Optional variable definitions (dict or JSON string)

  • output_path (str) – Where to save the plot

  • title (str | None) – Plot title (default: branch name)

  • xlabel (str | None) – X-axis label (default: branch name)

  • ylabel (str) – Y-axis label

  • log_y (bool) – Use logarithmic y-axis

  • style (str) – Plot style (“default”, “publication”, “presentation”)

Returns:

Plot metadata including path and statistics

Return type:

dict[str, Any]

plot_histogram_2d(data=None, path=None, tree_name=None, branch_x=None, branch_y=None, bins_x=None, bins_y=None, range_x=None, range_y=None, selection=None, weights=None, defines=None, output_path='/tmp/histogram_2d.png', title=None, xlabel=None, ylabel=None, colormap='viridis', log_z=False, style='default')[source]

Create a 2D histogram plot.

Parameters:
  • data (dict[str, Any] | None) – Pre-calculated histogram data (optional)

  • path (str | None) – File path (optional if data provided)

  • tree_name (str | None) – Tree name (optional if data provided)

  • branch_x (str | None) – X-axis branch (optional if data provided)

  • branch_y (str | None) – Y-axis branch (optional if data provided)

  • bins_x (int | None) – Number of bins in X (optional if data provided)

  • bins_y (int | None) – Number of bins in Y (optional if data provided)

  • range_x (tuple[float, float] | None) – (min, max) for X axis

  • range_y (tuple[float, float] | None) – (min, max) for Y axis

  • selection (str | None) – Optional cut expression

  • weights (str | None) – Optional weight branch

  • defines (dict[str, str] | str | None) – Optional variable definitions (dict or JSON string)

  • output_path (str) – Where to save the plot

  • title (str | None) – Plot title

  • xlabel (str | None) – X-axis label

  • ylabel (str | None) – Y-axis label

  • colormap (str) – Matplotlib colormap name

  • log_z (bool) – Use logarithmic color scale

  • style (str) – Plot style

Returns:

Plot metadata including path and statistics

Return type:

dict[str, Any]