plots

class plots.PlottingReaderFeather(input_files: str, categorical_columns: set[str] = {}, numerical_columns: dict[str, str] | set[str] = {}, sample: float | None = None, sample_seed: int = 23, filter_query: str | None = None)[source]

Bases: YAMLObject

Import the data, saved as [feather/arrow](https://arrow.apache.org/docs/python/feather.html), from the input files

Parameters:
input_files: List[str]

the list of paths to the input files, as literal path or as a regular expression

numerical_columns: List[str]

the columns of the input pandas.DataFrame which have numerical data, all other will be converted to categories to save on memory and improve performance

sample: float

if None, no sampling is done (default). If not None, it is the rate at which the input data is sampled

sample_seed: int

the seed to use for the sampling RNG

Attributes:
yaml_flow_style

Methods

from_yaml(loader, node)

Convert a representation node to a Python object.

to_yaml(dumper, data)

Convert a Python object to a representation node.

prepare

yaml_dumper

prepare()[source]
yaml_tag = '!PlottingReaderFeather'
class plots.PlottingTask(dataset_name: str, output_file: str, plot_type: str | None = None, x: str | None = None, y: str | None = None, z: str | None = None, plot_types: List[str] | None = None, ys: List[str] | None = None, selector: Callable | str | None = None, plot_kwargs: dict | None = None, column: str | None = None, row: str | None = None, hue: str | None = None, style: str | None = None, size: str | None = None, matplotlib_backend: str = 'agg', context: str = 'paper', axes_style: str = 'dark', legend: bool = True, alpha: float = 1.0, xlabel: str | None = None, ylabel: str | None = None, bin_size: float = 10.0, title_template: str | None = None, bbox_inches: str = 'tight', legend_location: str = 'upper left', legend_bbox: str | None = None, legend_labels: str | None = None, legend_title: str | None = None, matplotlib_rc: str | None = None, xrange: str | None = None, yrange: str | None = None, invert_yaxis: bool = False, plot_size: str | None = None, xticklabels: str | None = None, xticks: List[float] | None = None, xticks_minor: List[float] | None = None, yticks: List[float] | None = None, yticks_minor: List[float] | None = None, colormap: str | None = None, grid_transform: Callable[[FacetGrid], FacetGrid] | str | None = None)[source]

Bases: YAMLObject, ExtraCodeFunctionMixin

Generate a plot from the given data.

See [seaborn.lineplot](https://seaborn.pydata.org/generated/seaborn.lineplot.html) for examples of using hue and style. See [seaborn.catplot](https://seaborn.pydata.org/generated/seaborn.catplot.html) for examples of using row and column, . See [seaborn.relplot](https://seaborn.pydata.org/generated/seaborn.relplot.html) for examples of using both hue, style, row and column concurrently.

Parameters:
dataset_name: str

the dataset to operate on

output_file: str

the file path the generated plot is saved to, with the suffix choosing the output format

plot_type: str
the kind of plot to generate, either one of:

box, ‘lineplot’, ‘scatterplot’, ‘boxen’, ‘stripplot’, ‘swarm’, ‘bar’, ‘count’, ‘point’, ‘heat’

x: str

the name of the column with the data to plot on the x-axis

y: str

the name of the column with the data to plot on the y-axis

plot_kwargs:

keyword args that are passed to the plot function. Availabler args depend on the plot_type

selector: Optional[Union[Callable, str]]

a query string for selecting a subset of the input DataFrame for plotting, see [pandas.DataFrame.query](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.query.html) and [indexing](https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#the-query-method)

column: Optional[str]

the column of the input DataFrame to use for partitioning the data and plotting each partition into a separate plot, aligning them all vertically into a column

row: Optional[str]

the column of the input DataFrame to use for partitioning the data and plotting each partition into a separate plot, aligning them all horizontally into a column

hue: Optional[str]

the column of the input DataFrame to use for partitioning the data and plotting each partition into the same plot, with a different color

size: Optional[str]

the column of the input DataFrame to use for partitioning the data and plotting each partition into the same plot, with a different width

style: Optional[str]

the column of the input DataFrame to use for partitioning the data and plotting each partition into the same plot, with a different line style and marker

matplotlib_backend: str

the matplotlib drawing [backend](https://matplotlib.org/stable/users/explain/backends.html) to use

context: str

set the theme [context](https://seaborn.pydata.org/generated/seaborn.set_context.html#seaborn.set_context) for seaborn

axes_style: str

set the seaborn [axes style](https://seaborn.pydata.org/generated/seaborn.axes_style.html#seaborn.axes_style)

legend: bool

whether to add a legend to the plot

alpha: float

the alpha value used in lineplots for lines and markers

xlabel: str

the label to assign to the x-axis

ylabel: str

the label to assign to the y-axis

bin_size: float

the size of the position bin used in heatmaps

title_template: str

the template string to use to label one plot in a grid, for syntax see [seaborn.FacetGrid](https://seaborn.pydata.org/generated/seaborn.FacetGrid.set_titles.html#seaborn.FacetGrid.set_titles)

bbox_inches: Union[str, Tuple[float]]

the bounding box of the figure, as a tuple (xmin, ymin, xmax, ymax), or tight

legend_location: str

the location to place the legend

legend_bbox: str

the bounding box the location is placed in

legend_labels: Optional[List[str]]

the list of labels to assign in the legend

legend_title: Optional[str]

the title of the legend

matplotlib_rc: Optional[str]

the path to load a matplotlib.rc from

yrange: Optional[str]

the value range to use on the y-axis

invert_yaxis: bool

whether to invert the direction of the y-axis

plot_size: Optional[str]

the size of the plot, as a tuple of inches

xticklabels: Optional[str]

the list of labels to assign to the categories on the x-axis

colormap: Optional[str]

the colormap to use for heatmaps

grid_transform: Optional[Union[Callable[[pd.FacetGrid], pd.FacetGrid], str]

The function to call as the last step before saving the plot. This takes the produced FacetGrid as input and returns the modified FacetGrid. The purpose is to allow for arbitrary modification not yet provided by the framework.

Attributes:
yaml_flow_style

Methods

evaluate_function(function, extra_code)

Compile and evaluate the given function and an additional, optional code fragment within a separate global environment and return the executable function object.

from_yaml(loader, node)

Convert a representation node to a Python object.

savefigure(fig, plot_destination_dir, filename)

Save the given figure as PNG & SVG in the given directory with the given filename

to_yaml(dumper, data)

Convert a Python object to a representation node.

eval_grid_transform

get_data

parse_matplotlib_rc

parse_matplotlib_rc_to_kwargs

plot_catplot

plot_data

plot_distribution

plot_heatmap_grid

plot_heatmap_nogrid

plot_heatplot

plot_multiplot

plot_relplot

prepare

set_backend

set_data_repo

set_grid_defaults

set_label_defaults

set_legend_defaults

set_misc_defaults

set_plot_specific_options

set_theme

yaml_dumper

eval_grid_transform()[source]
get_data(dataset_name: str)[source]
parse_matplotlib_rc(matplotlib_rc: str)[source]
parse_matplotlib_rc_to_kwargs(**kwargs)[source]
plot_catplot(df, x='v2x_rate', y='cbr', hue='moduleName', row='dcc', column='traciStart', plot_type='box', **kwargs)[source]
plot_data(data)[source]
plot_distribution(df, x='value', y=None, hue='moduleName', row='dcc', column='traciStart', plot_type='ecdf', **kwargs)[source]
plot_heatmap_grid(df, x, y, z, column)[source]
plot_heatmap_nogrid(df, x, y, z)[source]
plot_heatplot(df, x='posX', y='posX', z='cbr', hue='moduleName', style='prefix', row=None, column=None, **kwargs)[source]
plot_multiplot(figure, selected_data)[source]
plot_relplot(df, x='v2x_rate', y='cbr', hue='moduleName', style='prefix', size=None, row='dcc', column='traciStart', plot_type='line', **kwargs)[source]
prepare()[source]
savefigure(fig, plot_destination_dir, filename, bbox_inches='tight')[source]

Save the given figure as PNG & SVG in the given directory with the given filename

set_backend(backend: str = 'agg')[source]
set_data_repo(data_repo: dict)[source]
set_grid_defaults(grid)[source]
set_label_defaults(xlabel: str | None = None, ylabel: str | None = None, title_template: str | None = None, xticklabels: List[str] | None = None)[source]
set_legend_defaults(legend: bool = True, legend_location: str = 'upper left', legend_bbox: str | None = None, legend_labels: str | None = None, legend_title: str | None = None)[source]
set_misc_defaults(alpha: float = 1.0, bin_size: float = 10.0, bbox_inches: str = 'tight', matplotlib_rc: str | dict | None = None, xrange: str | None = None, yrange: str | None = None, invert_yaxis: bool = False, plot_size: str | None = None, colormap: str | None = None)[source]
set_plot_specific_options(plot_type: str, kwargs: dict)[source]
set_theme(context: str = 'paper', axes_style: str = 'dark')[source]
yaml_tag = '!PlottingTask'
plots.register_constructors()[source]