vuecore.plots.basic package#

vuecore.plots.basic.create_bar_plot(data: DataFrame, engine: EngineType = EngineType.PLOTLY, file_path: str = None, **kwargs) Any[source]#

Creates, styles, and optionally saves a bar plot using the specified engine.

This function serves as the main entry point for users to generate bar plots. It validates the provided configuration against the BarConfig schema, retrieves the appropriate plotting builder and saver functions based on the selected engine, builds the plot, and optionally saves it to a file.

Parameters:
  • data (pd.DataFrame) – The DataFrame containing the data to be plotted. Each row represents an observation, and columns correspond to variables.

  • engine (EngineType, optional) – The plotting engine to use for rendering the plot. Defaults to EngineType.PLOTLY.

  • file_path (str, optional) – If provided, the path where the final plot will be saved. The file format is automatically inferred from the file extension (e.g., ‘.html’, ‘.png’, ‘.jpeg’, ‘.svg’). Defaults to None, meaning the plot will not be saved.

  • **kwargs

    Keyword arguments for plot configuration. These arguments are validated against the BarConfig Pydantic model and the engine specific parameters.

    The following parameters are supported:

    • x (str) – Column for x-axis values.

    • y (str) – Column for y-axis values.

    • color (str) – Column to assign color to plot elements.

    • hover_name (str) – Column to appear in bold in the hover tooltip.

    • hover_data (list of str) – Additional columns for the hover tooltip. (default: [])

    • facet_row (str) – Column to create vertical subplots (facets).

    • facet_col (str) – Column to create horizontal subplots (facets).

    • labels (Dict[str, str]) – Dictionary to override column names for titles, legends, etc.

    • color_discrete_map (Dict[str, str]) – Specific color mappings for values in the color column.

    • category_orders (Dict[str, list of str]) – Dictionary to specify the order of categorical values.

    • log_x (bool) – If True, use a logarithmic x-axis. (default: False)

    • log_y (bool) – If True, use a logarithmic y-axis. (default: False)

    • range_x (list of float) – Range for the x-axis, e.g., [0, 100].

    • range_y (list of float) – Range for the y-axis, e.g., [0, 100].

    • title (str) – The main title of the plot. (default: Plotly Plot)

    • x_title (str) – Custom title for the x-axis.

    • y_title (str) – Custom title for the y-axis.

    • subtitle (str) – The subtitle of the plot.

    • template (str) – Plotly template for styling. (default: plotly_white)

    • width (int) – Width of the plot in pixels. (default: 800)

    • height (int) – Height of the plot in pixels. (default: 600)

    • pattern_shape (str) – Column to assign pattern shapes to bars.

    • text (str) – Column for text labels on bars.

    • error_x (str) – Column for x-axis error bars.

    • error_y (str) – Column for y-axis error bars.

    • pattern_shape_map (Dict[str, str]) – Map values to specific pattern shapes.

    • opacity (float) – Overall opacity of markers. (default: 0.8)

    • orientation (str) – Orientation of the bars (‘v’ for vertical, ‘h’ for horizontal). (default: v)

    • barmode (str) – Mode for grouping bars. (default: relative)

Returns:

The final plot object returned by the selected engine. For Plotly, this will typically be a plotly.graph_objects.Figure. The exact type depends on the chosen engine.

Return type:

Any

Raises:
  • pydantic.ValidationError – If the provided keyword arguments do not conform to the BarConfig schema. e.g., a required parameter is missing or a value has an incorrect type.

  • ValueError – Raised by the plotting engine (e.g., Plotly Express) if a column specified in the configuration (e.g., ‘x’, ‘y’, ‘color’) is not found in the provided DataFrame.

Examples

For detailed examples and usage, please refer to the documentation:

  • Jupyter Notebook: docs/api_examples/bar_plot.ipynb -

https://vuecore.readthedocs.io/en/latest/api_examples/bar_plot.html * Python Script: docs/api_examples/bar_plot.py - Multiomics-Analytics-Group/vuecore

vuecore.plots.basic.create_box_plot(data: DataFrame, engine: EngineType = EngineType.PLOTLY, file_path: str = None, **kwargs) Any[source]#

Creates, styles, and optionally saves a box plot using the specified engine.

This function serves as the main entry point for users to generate box plots. It validates the provided configuration against the BoxConfig schema, retrieves the appropriate plotting builder and saver functions based on the selected engine, builds the plot, and optionally saves it to a file.

Parameters:
  • data (pd.DataFrame) – The DataFrame containing the data to be plotted. Each row represents an observation, and columns correspond to variables.

  • engine (EngineType, optional) – The plotting engine to use for rendering the plot. Defaults to EngineType.PLOTLY.

  • file_path (str, optional) – If provided, the path where the final plot will be saved. The file format is automatically inferred from the file extension (e.g., ‘.html’, ‘.png’, ‘.jpeg’, ‘.svg’). Defaults to None, meaning the plot will not be saved.

  • **kwargs

    Keyword arguments for plot configuration. These arguments are validated against the BoxConfig Pydantic model and the engine specific parameters.

    The following parameters are supported:

    • x (str) – Column for x-axis values.

    • y (str) – Column for y-axis values.

    • color (str) – Column to assign color to plot elements.

    • hover_name (str) – Column to appear in bold in the hover tooltip.

    • hover_data (list of str) – Additional columns for the hover tooltip. (default: [])

    • facet_row (str) – Column to create vertical subplots (facets).

    • facet_col (str) – Column to create horizontal subplots (facets).

    • labels (Dict[str, str]) – Dictionary to override column names for titles, legends, etc.

    • color_discrete_map (Dict[str, str]) – Specific color mappings for values in the color column.

    • category_orders (Dict[str, list of str]) – Dictionary to specify the order of categorical values.

    • log_x (bool) – If True, use a logarithmic x-axis. (default: False)

    • log_y (bool) – If True, use a logarithmic y-axis. (default: False)

    • range_x (list of float) – Range for the x-axis, e.g., [0, 100].

    • range_y (list of float) – Range for the y-axis, e.g., [0, 100].

    • title (str) – The main title of the plot. (default: Plotly Plot)

    • x_title (str) – Custom title for the x-axis.

    • y_title (str) – Custom title for the y-axis.

    • subtitle (str) – The subtitle of the plot.

    • template (str) – Plotly template for styling. (default: plotly_white)

    • width (int) – Width of the plot in pixels. (default: 800)

    • height (int) – Height of the plot in pixels. (default: 600)

    • orientation (str) – Orientation of the box plots (‘v’ for vertical, ‘h’ for horizontal).

    • boxmode (str) – Mode for grouping boxes. (default: group)

    • notched (bool) – If True, boxes are drawn with notches. (default: False)

    • points (str) – Method to display sample points (‘outliers’, ‘all’, ‘suspectedoutliers’, False). (default: outliers)

Returns:

The final plot object returned by the selected engine. For Plotly, this will typically be a plotly.graph_objects.Figure. The exact type depends on the chosen engine.

Return type:

Any

Raises:
  • pydantic.ValidationError – If the provided keyword arguments do not conform to the BoxConfig schema. e.g., a required parameter is missing or a value has an incorrect type.

  • ValueError – Raised by the plotting engine (e.g., Plotly Express) if a column specified in the configuration (e.g., ‘x’, ‘y’, ‘color’) is not found in the provided DataFrame.

Examples

For detailed examples and usage, please refer to the documentation:

  • Jupyter Notebook: docs/api_examples/box_plot.ipynb -

https://vuecore.readthedocs.io/en/latest/api_examples/box_plot.html * Python Script: docs/api_examples/box_plot.py - Multiomics-Analytics-Group/vuecore

vuecore.plots.basic.create_line_plot(data: DataFrame, engine: EngineType = EngineType.PLOTLY, file_path: str = None, **kwargs) Any[source]#

Creates, styles, and optionally saves a line plot using the specified engine.

This function serves as the main entry point for users to generate line plots. It validates the provided configuration against the LineConfig schema, retrieves the appropriate plotting builder and saver functions based on the selected engine, builds the plot, and optionally saves it to a file.

Parameters:
  • data (pd.DataFrame) – The DataFrame containing the data to be plotted. Each row represents an observation, and columns correspond to variables.

  • engine (EngineType, optional) – The plotting engine to use for rendering the plot. Defaults to EngineType.PLOTLY.

  • file_path (str, optional) – If provided, the path where the final plot will be saved. The file format is automatically inferred from the file extension (e.g., ‘.html’, ‘.png’, ‘.jpeg’, ‘.svg’). Defaults to None, meaning the plot will not be saved.

  • **kwargs

    Keyword arguments for plot configuration. These arguments are validated against the LineConfig Pydantic model and the engine specific parameters.

    The following parameters are supported:

    • x (str) – Column for x-axis values.

    • y (str) – Column for y-axis values.

    • color (str) – Column to assign color to plot elements.

    • hover_name (str) – Column to appear in bold in the hover tooltip.

    • hover_data (list of str) – Additional columns for the hover tooltip. (default: [])

    • facet_row (str) – Column to create vertical subplots (facets).

    • facet_col (str) – Column to create horizontal subplots (facets).

    • labels (Dict[str, str]) – Dictionary to override column names for titles, legends, etc.

    • color_discrete_map (Dict[str, str]) – Specific color mappings for values in the color column.

    • category_orders (Dict[str, list of str]) – Dictionary to specify the order of categorical values.

    • log_x (bool) – If True, use a logarithmic x-axis. (default: False)

    • log_y (bool) – If True, use a logarithmic y-axis. (default: False)

    • range_x (list of float) – Range for the x-axis, e.g., [0, 100].

    • range_y (list of float) – Range for the y-axis, e.g., [0, 100].

    • title (str) – The main title of the plot. (default: Plotly Plot)

    • x_title (str) – Custom title for the x-axis.

    • y_title (str) – Custom title for the y-axis.

    • subtitle (str) – The subtitle of the plot.

    • template (str) – Plotly template for styling. (default: plotly_white)

    • width (int) – Width of the plot in pixels. (default: 800)

    • height (int) – Height of the plot in pixels. (default: 600)

    • line_group (str) – Column to group data into separate lines.

    • line_dash (str) – Column to assign dash styles to lines.

    • symbol (str) – Column to assign symbols to markers.

    • text (str) – Column for text labels on markers.

    • error_x (str) – Column for x-axis error bars.

    • error_y (str) – Column for y-axis error bars.

    • line_dash_map (Dict[str, str]) – Map values to specific dash styles.

    • symbol_map (Dict[str, str]) – Map values to specific symbols.

    • markers (bool) – If True, displays markers on the lines. (default: False)

    • line_shape (str) – Line shape (e.g., ‘linear’, ‘spline’). (default: linear)

Returns:

The final plot object returned by the selected engine. For Plotly, this will be a plotly.graph_objects.Figure. For Matplotlib, a matplotlib.figure.Figure, etc.

Return type:

Any

Raises:
  • pydantic.ValidationError – If the provided keyword arguments do not conform to the LineConfig schema, e.g., a required parameter is missing or a value has an incorrect type.

  • ValueError – Raised by the plotting engine (e.g., Plotly Express) if a column specified in the configuration (e.g., ‘x’, ‘y’, ‘color’) is not found in the provided DataFrame.

Examples

For detailed examples and usage, please refer to the documentation:

  • Jupyter Notebook: docs/api_examples/line_plot.ipynb -

https://vuecore.readthedocs.io/en/latest/api_examples/scatter_plot.html * Python Script: docs/api_examples/line_plot.py

vuecore.plots.basic.create_scatter_plot(data: DataFrame, engine: EngineType = EngineType.PLOTLY, file_path: str = None, **kwargs) Any[source]#

Creates, styles, and optionally saves a scatter plot using the specified engine.

This function serves as the main entry point for users to generate scatter plots. It validates the provided configuration against the ScatterConfig schema, retrieves the appropriate plotting builder and saver functions based on the selected engine, builds the plot, and optionally saves it to a file.

Parameters:
  • data (pd.DataFrame) – The DataFrame containing the data to be plotted. Each row represents an observation, and columns correspond to variables.

  • engine (EngineType, optional) – The plotting engine to use for rendering the plot. Defaults to EngineType.PLOTLY.

  • file_path (str, optional) – If provided, the path where the final plot will be saved. The file format is automatically inferred from the file extension (e.g., ‘.html’, ‘.png’, ‘.jpeg’, ‘.svg’). Defaults to None, meaning the plot will not be saved.

  • **kwargs

    Keyword arguments for plot configuration. These arguments are validated against the ScatterConfig Pydantic model and the engine specific parameters.

    The following parameters are supported:

    • x (str) – Column for x-axis values.

    • y (str) – Column for y-axis values.

    • color (str) – Column to assign color to plot elements.

    • hover_name (str) – Column to appear in bold in the hover tooltip.

    • hover_data (list of str) – Additional columns for the hover tooltip. (default: [])

    • facet_row (str) – Column to create vertical subplots (facets).

    • facet_col (str) – Column to create horizontal subplots (facets).

    • labels (Dict[str, str]) – Dictionary to override column names for titles, legends, etc.

    • color_discrete_map (Dict[str, str]) – Specific color mappings for values in the color column.

    • category_orders (Dict[str, list of str]) – Dictionary to specify the order of categorical values.

    • log_x (bool) – If True, use a logarithmic x-axis. (default: False)

    • log_y (bool) – If True, use a logarithmic y-axis. (default: False)

    • range_x (list of float) – Range for the x-axis, e.g., [0, 100].

    • range_y (list of float) – Range for the y-axis, e.g., [0, 100].

    • title (str) – The main title of the plot. (default: Plotly Plot)

    • x_title (str) – Custom title for the x-axis.

    • y_title (str) – Custom title for the y-axis.

    • subtitle (str) – The subtitle of the plot.

    • template (str) – Plotly template for styling. (default: plotly_white)

    • width (int) – Width of the plot in pixels. (default: 800)

    • height (int) – Height of the plot in pixels. (default: 600)

    • symbol (str) – Column to assign marker symbols.

    • size (str) – Column to determine marker size.

    • text (str) – Column for text labels on markers.

    • error_x (str) – Column for x-axis error bars.

    • error_y (str) – Column for y-axis error bars.

    • symbol_map (Dict[str, str]) – Specific symbol mappings for symbol column values.

    • size_max (int) – Maximum size for markers. (default: 20)

    • opacity (float) – Overall opacity of markers. (default: 0.8)

    • trendline (str) – Trendline type (ols/lowess/rolling/expanding/ewm).

    • trendline_options (dict) – Advanced options for trendline configuration.

    • marker_line_width (float) – Width of marker border lines. (default: 0.5)

    • marker_line_color (str) – Color of marker border lines. (default: DarkSlateGrey)

    • color_by_density (bool) – Color points by density instead of category. (default: False)

Returns:

The final plot object returned by the selected engine. For Plotly, this will be a plotly.graph_objects.Figure. For Matplotlib, a matplotlib.figure.Figure, etc.

Return type:

Any

Raises:
  • pydantic.ValidationError – If the provided keyword arguments do not conform to the ScatterConfig schema, e.g. a required parameter is missing or a value has an incorrect type.

  • ValueError – Raised by the plotting engine (e.g., Plotly Express) if a column specified in the configuration (e.g., ‘x’, ‘y’, ‘color’) is not found in the provided DataFrame.

Examples

For detailed examples and usage, please refer to the documentation:

  • Jupyter Notebook: docs/api_examples/scatter_plot.ipynb -

https://vuecore.readthedocs.io/en/latest/api_examples/scatter_plot.html * Python Script: docs/api_examples/scatter_plot.py - Multiomics-Analytics-Group/vuecore

Submodules#