vuecore.engines.plotly.scatter module#
- vuecore.engines.plotly.scatter.build(data: DataFrame, config: ScatterConfig) Figure [source]#
Creates a Plotly scatter plot from a DataFrame and a Pydantic configuration.
This function acts as a bridge between the abstract plot definition and the Plotly Express implementation. It translates the validated ScattereConfig into the arguments for plotly.express.scatter and also forwards any additional, unvalidated keyword arguments from plotly. The resulting figure is then customized with layout and theme settings using plotly.graph_objects. (https://plotly.com/python-api-reference/generated/plotly.express.scatter.html).
- Parameters:
data (pd.DataFrame) – The DataFrame containing the plot data.
config (ScatterConfig) – The validated Pydantic model object with all plot configurations.
- Returns:
A plotly.graph_objects.Figure object representing the scatter plot.
- Return type:
go.Figure
- vuecore.engines.plotly.scatter.scatter_preprocess(data, plot_args, config)[source]#
Preprocess data and arguments for scatter plots with density coloring.
This function handles special preprocessing for scatter plots, particularly for density-based coloring.
- Parameters:
data (pd.DataFrame) – The DataFrame containing the plot data.
plot_args (dict) – Dictionary of arguments to be passed to the Plotly Express scatter function.
config (ScatterConfig) – The validated Pydantic model with all scatter plot configurations.
- Returns:
A tuple containing: - data : pd.DataFrame
The original DataFrame (unchanged).
- plot_argsdict
The modified plot arguments dictionary with color settings adjusted based on the configuration.
- Return type:
Notes
When density coloring is enabled, this function calculates density values for the data points and uses them for color mapping, removing any discrete color mapping that might conflict with continuous coloring.