ccvmplotlib#

class ccvmplotlib[source]#

Bases: object

A generic plotting library for a problem solved by a CCVM solver.

static apply_default_ets_styling(fig: Figure, ax: Axes) None[source]#

A method to apply the default styling to a ETS plot.

Parameters:
  • fig (matplotlib.figure.Figure) – A pyplot figure to be set.

  • ax (matplotlib.axes.Axes) – A pyplot axis to be set.

static apply_default_succ_prob_styling(fig: Figure, ax: Axes) None[source]#

A method to apply the default styling to a success probability plot.

Parameters:
  • fig (matplotlib.figure.Figure) – A pyplot figure to be set.

  • ax (matplotlib.axes.Axes) – A pyplot axis to be set.

static apply_default_tts_styling(fig: Figure, ax: Axes) None[source]#

A method to apply the default styling to a TTS plot.

Parameters:
  • fig (matplotlib.figure.Figure) – A pyplot figure to be set.

  • ax (matplotlib.axes.Axes) – A pyplot axis to be set.

static plot_ETS(metadata_filepath: str, problem: str, machine_energy_func: callable, fig: Figure | None = None, ax: Axes | None = None) tuple[Figure, Axes][source]#

Plot a problem-specific Time-To-Solution metadata solved by a CCVM solver.

Parameters:
  • metadata_filepath (str) – A file path to metadata.

  • problem (str) – A problem type.

  • machine_energy_func (callable) – A callback function that calculates the

  • max (energy) –

  • ETS. (which is used to compute the) –

  • fig (matplotlib.figure.Figure, optional) – A pre-generated pyplot figure.

  • None. (Defaults to) –

  • ax (matplotlib.axes.Axes, optional) – A pre-generated pyplot axis.

  • None.

Raises:

ValueError – Raises a ValueError when the plotting data is not valid.

Returns:

Returns a figure and axis that has

the TTS plot with minimal styling.

Return type:

tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]

static plot_TTS(metadata_filepath: str, problem: str, machine_time_func: callable, fig: Figure | None = None, ax: Axes | None = None) tuple[Figure, Axes][source]#

Plot a problem-specific Time-To-Solution metadata solved by a CCVM solver.

Parameters:
  • metadata_filepath (str) – A file path to metadata.

  • problem (str) – A problem type.

  • machine_time_func (callable) – A callback function that calculates the

  • time (machine) –

  • TTS. (which is used to compute the) –

  • fig (matplotlib.figure.Figure, optional) – A pre-generated pyplot figure. Defaults to None.

  • ax (matplotlib.axes.Axes, optional) – A pre-generated pyplot axis. Defaults to None.

Raises:

ValueError – Raises a ValueError when the plotting data is not valid.

Returns:

Returns a figure and axis that has

the TTS plot with minimal styling.

Return type:

tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]

static plot_success_prob(metadata_filepath: str, problem: str, fig: Figure | None = None, ax: Axes | None = None) tuple[Figure, Axes][source]#

Plot a problem-specific success probability result data solved by a CCVM solver.

Parameters:
  • metadata_filepath (str) – A file path to solution data.

  • problem (str) – A problem type.

  • fig (matplotlib.figure.Figure, optional) – A pre-generated pyplot figure. Defaults to None.

  • ax (matplotlib.axes.Axes, optional) – A pre-generated pyplot axis. Defaults to None.

Raises:

ValueError – Raises a ValueError when the plotting data is invalid.

Returns:

Returns a figure and axis that has

the success probability plot with minimal styling.

Return type:

tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]

static set_default_figsize(fig: Figure) None[source]#

A method to set the figure size with default width and height values.

Parameters:

fig (matplotlib.figure.Figure) – A pyplot figure to be resized.

static set_default_grid(ax: Axes) None[source]#

A method to set the grid with default configuration.

Parameters:

ax (matplotlib.axes.Axes) – A pyplot axis to be set.

static set_default_legend(ax: Axes) None[source]#

A method to set the legen with default configuration.

Parameters:

ax (matplotlib.axes.Axes) – A pyplot axis to be set.

static set_default_ticks(ax: Axes) None[source]#

A method to set the x&y ticks with default font size.

Parameters:

ax (matplotlib.axes.Axes) – A pyplot axis to be set.

static set_default_xlabel(ax: Axes, xlabel: str) None[source]#

A method to set the x-label text. Also, it sets font and font size with default values.

Parameters:
  • ax (matplotlib.axes.Axes) – A pyplot axis to be set.

  • xlabel (str) – x-label text.

static set_default_ylabel(ax: Axes, ylabel: str) None[source]#

A method to set the y-label text. Also, it sets font and font size with default values.

Parameters:
  • ax (matplotlib.axes.Axes) – A pyplot axis to be set.

  • ylabel (str) – y-label text.