From 567c4287bcc48b29c7221e6b63f003efb8585dd1 Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Tue, 4 Jun 2024 16:39:40 -0500 Subject: [PATCH 01/11] wip --- plugins/plotly-express/.gitignore | 3 +- plugins/plotly-express/docs/Makefile | 20 + plugins/plotly-express/docs/README.md | 6 + plugins/plotly-express/docs/area.md | 6 + plugins/plotly-express/docs/bar.md | 5 + plugins/plotly-express/docs/box.md | 5 + plugins/plotly-express/docs/candlestick.md | 5 + plugins/plotly-express/docs/conf.py | 46 ++ plugins/plotly-express/docs/funnel-area.md | 5 + plugins/plotly-express/docs/funnel.md | 6 + plugins/plotly-express/docs/histogram.md | 5 + plugins/plotly-express/docs/icicle.md | 5 + plugins/plotly-express/docs/layer-plots.md | 6 + plugins/plotly-express/docs/line-3d.md | 6 + plugins/plotly-express/docs/line-polar.md | 5 + plugins/plotly-express/docs/line-ternary.md | 6 + plugins/plotly-express/docs/line.md | 5 + plugins/plotly-express/docs/make.bat | 35 ++ plugins/plotly-express/docs/ohlc.md | 6 + plugins/plotly-express/docs/pie.md | 5 + plugins/plotly-express/docs/scatter-3d.md | 5 + plugins/plotly-express/docs/scatter-polar.md | 6 + .../plotly-express/docs/scatter-ternary.md | 6 + plugins/plotly-express/docs/scatter.md | 5 + plugins/plotly-express/docs/strip.md | 6 + plugins/plotly-express/docs/sub-plots.md | 6 + plugins/plotly-express/docs/sunburst.md | 5 + plugins/plotly-express/docs/timeline.md | 6 + plugins/plotly-express/docs/treemap.md | 6 + plugins/plotly-express/docs/violin.md | 6 + .../deephaven/plot/express/plots/_layer.py | 18 +- .../src/deephaven/plot/express/plots/area.py | 115 ++--- .../src/deephaven/plot/express/plots/bar.py | 248 +++------- .../plot/express/plots/distribution.py | 264 ++++------ .../deephaven/plot/express/plots/financial.py | 83 ++-- .../plot/express/plots/hierarchial.py | 261 ++++------ .../src/deephaven/plot/express/plots/line.py | 454 ++++++------------ .../src/deephaven/plot/express/plots/maps.py | 437 ++++++----------- .../src/deephaven/plot/express/plots/pie.py | 42 +- .../deephaven/plot/express/plots/scatter.py | 420 +++++----------- .../deephaven/plot/express/plots/subplots.py | 36 +- 41 files changed, 1010 insertions(+), 1616 deletions(-) create mode 100644 plugins/plotly-express/docs/Makefile create mode 100644 plugins/plotly-express/docs/conf.py create mode 100644 plugins/plotly-express/docs/make.bat diff --git a/plugins/plotly-express/.gitignore b/plugins/plotly-express/.gitignore index 3356dc1ce..ece8ca322 100644 --- a/plugins/plotly-express/.gitignore +++ b/plugins/plotly-express/.gitignore @@ -5,4 +5,5 @@ dist/ *.egg-info/ .idea .DS_store -__pycache__/ \ No newline at end of file +__pycache__/ +/docs/build/ \ No newline at end of file diff --git a/plugins/plotly-express/docs/Makefile b/plugins/plotly-express/docs/Makefile new file mode 100644 index 000000000..ed8809902 --- /dev/null +++ b/plugins/plotly-express/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/plugins/plotly-express/docs/README.md b/plugins/plotly-express/docs/README.md index cf2941ea5..6a96f0b01 100644 --- a/plugins/plotly-express/docs/README.md +++ b/plugins/plotly-express/docs/README.md @@ -94,3 +94,9 @@ Deephaven's Plotly Express plugin is licensed under the [Apache License 2.0](htt ## Acknowledgments We would like to express our gratitude to the Plotly and the Plotly Express team for creating a remarkable plotting library and making it open-source. Their work forms the foundation of the Deephaven Plotly Express plugin. + +```{toctree} +:maxdepth: 3 +:glob: +* +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/area.md b/plugins/plotly-express/docs/area.md index 05d5139ed..dd7a04793 100644 --- a/plugins/plotly-express/docs/area.md +++ b/plugins/plotly-express/docs/area.md @@ -12,3 +12,9 @@ Area plots are useful for: 4. **Time Series Analysis**: For time-dependent data, area plots are valuable for displaying changes in categorical contributions and overall trends over time. ## Examples + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.area +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/bar.md b/plugins/plotly-express/docs/bar.md index ee703d49c..cf35db4ff 100644 --- a/plugins/plotly-express/docs/bar.md +++ b/plugins/plotly-express/docs/bar.md @@ -14,3 +14,8 @@ Advantages of bar plots include: Bar plots have limitations and are not suitable for certain scenarios. They are not ideal for continuous data, ineffective for multi-dimensional data exceeding two dimensions, and unsuitable for time-series data trends. Additionally, they become less practical with extremely sparse datasets and are inadequate for representing complex interactions or correlations among multiple variables. ## Examples + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.bar +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/box.md b/plugins/plotly-express/docs/box.md index 6c03cea1f..4961ac2ac 100644 --- a/plugins/plotly-express/docs/box.md +++ b/plugins/plotly-express/docs/box.md @@ -12,3 +12,8 @@ Box plots are useful for: 4. **Robustness**: Box plots are robust to extreme values and data skewness, providing a reliable means of visualizing data distributions even in the presence of outliers or non-normal data. ## Examples + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.box +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/candlestick.md b/plugins/plotly-express/docs/candlestick.md index 1dc318221..1b55c4ffe 100644 --- a/plugins/plotly-express/docs/candlestick.md +++ b/plugins/plotly-express/docs/candlestick.md @@ -16,3 +16,8 @@ Candlestick plots are useful for: 4. **Visualizing Variation in Price Data**: Candlestick charts offer a visually intuitive way to represent variability in price data, making them valuable for traders and analysts who prefer a visual approach to data analysis. ## Examples + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.candlestick +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/conf.py b/plugins/plotly-express/docs/conf.py new file mode 100644 index 000000000..43f4be772 --- /dev/null +++ b/plugins/plotly-express/docs/conf.py @@ -0,0 +1,46 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html +import os +import sys + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = "deephaven" +copyright = "2024, Deephaven Data Labs" +author = "Deephaven Data Labs" +release = "0.7.0" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "myst_parser", + "sphinx_markdown_builder", + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", +] + +python_maximum_signature_line_length = 20 + +source_suffix = [".rst", ".md"] # Can use either rst or markdown files as input + +root_doc = "README" + +suppress_warnings = ["myst.header"] + +# exclude build directory +exclude_patterns = ["build", "Thumbs.db", ".DS_Store"] + +from deephaven_server import Server + +s = Server(port=10075) +s.start() + +# Sphinx - need py 3.9 for latest versions for python_maximum_signature_line_length +# myst-parser +# sphinx-markdown-builder +# deephaven-server +# dx wheel diff --git a/plugins/plotly-express/docs/funnel-area.md b/plugins/plotly-express/docs/funnel-area.md index 066315d93..1cee81224 100644 --- a/plugins/plotly-express/docs/funnel-area.md +++ b/plugins/plotly-express/docs/funnel-area.md @@ -12,3 +12,8 @@ Funnel area plots are useful for: 4. **Data Funneling**: When representing data where values funnel through stages or categories. ## Examples + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.funnel_area +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/funnel.md b/plugins/plotly-express/docs/funnel.md index 61740f8a6..10aca2333 100644 --- a/plugins/plotly-express/docs/funnel.md +++ b/plugins/plotly-express/docs/funnel.md @@ -10,3 +10,9 @@ Funnel plots are useful for: 2. **Sequential Processes**: Funnel plots are suitable for visualizing data within sequential processes, where data typically funnels through various stages. 3. **Data Distribution**: When you want to gain insights into the distribution of data at each stage within a process, and you can represent multiple categories as stacked bars for comparative analysis. 4. **Efficiency Assessment**: To assess the efficiency and effectiveness of a process, particularly when evaluating the attrition or conversion of elements at each stage. + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.funnel +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/histogram.md b/plugins/plotly-express/docs/histogram.md index ea0faf040..b5b5cf14f 100644 --- a/plugins/plotly-express/docs/histogram.md +++ b/plugins/plotly-express/docs/histogram.md @@ -12,3 +12,8 @@ Histogram plots are useful for: 4. **Density Estimation**: Histograms can serve as the basis for density estimation methods, helping to model and understand underlying data distributions, which is crucial in statistical analysis and machine learning. ## Examples + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.histogram +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/icicle.md b/plugins/plotly-express/docs/icicle.md index 7d4f6bf61..006863c92 100644 --- a/plugins/plotly-express/docs/icicle.md +++ b/plugins/plotly-express/docs/icicle.md @@ -12,3 +12,8 @@ Icicle plots are useful for: 4. **Comparative Analysis**: The consistent and proportional layout of icicle charts makes them effective for comparing the size and structure of different branches within the hierarchy. Users can easily identify and compare the relative importance or size of various categories, facilitating better decision-making and resource allocation. ## Examples + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.icicle +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/layer-plots.md b/plugins/plotly-express/docs/layer-plots.md index 618c6ad5a..38d66aaed 100644 --- a/plugins/plotly-express/docs/layer-plots.md +++ b/plugins/plotly-express/docs/layer-plots.md @@ -5,3 +5,9 @@ title: Layer plots To "layer" or "stack" multiple plots on top of each other, use the `layer` function. This is useful if you want to combine multiple plots of different types into a single plot, such as a scatter plot and a line plot. By default, last plot given will be used for the layout. The `which_layout` parameter can be used to specify which plot's layout should be used. The `specs` parameter can be used to specify the domains of each plot. ## Examples + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.layer +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/line-3d.md b/plugins/plotly-express/docs/line-3d.md index 9fa27d896..7adb7ab35 100644 --- a/plugins/plotly-express/docs/line-3d.md +++ b/plugins/plotly-express/docs/line-3d.md @@ -14,3 +14,9 @@ Alternatives to 3D line plots include: - **Scatter Plots with Color or Size Mapping**: These can be used to represent three variables with the addition of color or size mapping to signify the third dimension. - **Surface Plots**: When visualizing continuous data over a 3D space, surface plots may be more appropriate, as they create a continuous surface representation. + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.line_3d +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/line-polar.md b/plugins/plotly-express/docs/line-polar.md index 14e0c98c6..20734f3e7 100644 --- a/plugins/plotly-express/docs/line-polar.md +++ b/plugins/plotly-express/docs/line-polar.md @@ -12,3 +12,8 @@ Polar line plots are useful for: 4. **Circular Data Exploration**: They can be used to explore and analyze data where the angular or periodic nature of the data is a significant aspect, making them useful in fields like meteorology, geophysics, and biology. ## Examples + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.line_polar +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/line-ternary.md b/plugins/plotly-express/docs/line-ternary.md index a9fb0e197..76fe1232a 100644 --- a/plugins/plotly-express/docs/line-ternary.md +++ b/plugins/plotly-express/docs/line-ternary.md @@ -9,3 +9,9 @@ Ternary line plots are useful for: 1. **Compositional Data Representation**: Ternary line plots are suitable for representing compositional data where the total proportion remains constant, allowing for the visualization of how components change relative to one another. 2. **Multivariate Data Analysis**: They are useful in multivariate data analysis to visualize relationships and trends among three variables or components that are interrelated. 3. **Optimization Studies**: Ternary line plots can be applied in optimization studies to understand how adjustments in the proportions of three components impact the overall composition, aiding in informed decision-making. + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.line_ternary +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/line.md b/plugins/plotly-express/docs/line.md index 267041318..85ea03e91 100644 --- a/plugins/plotly-express/docs/line.md +++ b/plugins/plotly-express/docs/line.md @@ -397,3 +397,8 @@ scatter_plot_opacity = dx.scatter( opacity=0.5 ) ``` + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.line +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/make.bat b/plugins/plotly-express/docs/make.bat new file mode 100644 index 000000000..8f56bebd6 --- /dev/null +++ b/plugins/plotly-express/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/plugins/plotly-express/docs/ohlc.md b/plugins/plotly-express/docs/ohlc.md index b14dd1aae..c4289a83e 100644 --- a/plugins/plotly-express/docs/ohlc.md +++ b/plugins/plotly-express/docs/ohlc.md @@ -13,3 +13,9 @@ OHLC (Open-High-Low-Close) plots are useful for: 3. **Quantitative Analysis**: OHLC data can be leveraged for quantitative analysis, statistical modeling, and the development of trading strategies, making them valuable in algorithmic and systematic trading. ## Examples + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.ohlc +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/pie.md b/plugins/plotly-express/docs/pie.md index cc0914f64..fec122746 100644 --- a/plugins/plotly-express/docs/pie.md +++ b/plugins/plotly-express/docs/pie.md @@ -15,3 +15,8 @@ Limitations of pie plots include: 2. **Comparison Complexity**: Comparing the sizes of slices in a pie plot is less precise than with other chart types, such as bar plots or stacked bar charts. This makes it less suitable for situations where accurate quantitative comparisons are crucial. ## Examples + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.pie +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/scatter-3d.md b/plugins/plotly-express/docs/scatter-3d.md index 8c0e1c4b1..c9525bbf3 100644 --- a/plugins/plotly-express/docs/scatter-3d.md +++ b/plugins/plotly-express/docs/scatter-3d.md @@ -133,3 +133,8 @@ scatter_plot_color_column = dx.scatter_3d( color_discrete_map="identity" ) ``` + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.scatter_3d +``` diff --git a/plugins/plotly-express/docs/scatter-polar.md b/plugins/plotly-express/docs/scatter-polar.md index 4ec1b6b23..0fcf4c366 100644 --- a/plugins/plotly-express/docs/scatter-polar.md +++ b/plugins/plotly-express/docs/scatter-polar.md @@ -11,3 +11,9 @@ Polar scatter plots are useful for: 3. **Angular or Periodic Data Relationships**: Polar scatter plots aid in exploring relationships and correlations in data with angular or periodic dependencies, making them suitable for applications where understanding circular patterns is essential. ## Examples + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.scatter_polar +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/scatter-ternary.md b/plugins/plotly-express/docs/scatter-ternary.md index b4c532d5c..148031b26 100644 --- a/plugins/plotly-express/docs/scatter-ternary.md +++ b/plugins/plotly-express/docs/scatter-ternary.md @@ -11,3 +11,9 @@ Ternary scatter plots are useful for: 3. **Optimization Studies**: Ternary scatter plots aid in optimization studies to understand how adjustments in the proportions of three components impact the overall composition, making them valuable in informed decision-making processes. ## Examples + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.scatter_ternary +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/scatter.md b/plugins/plotly-express/docs/scatter.md index 2154c8fdd..5736fed65 100644 --- a/plugins/plotly-express/docs/scatter.md +++ b/plugins/plotly-express/docs/scatter.md @@ -444,3 +444,8 @@ scatter_plot_opacity = dx.scatter( opacity=0.5 ) ``` + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.scatter +``` diff --git a/plugins/plotly-express/docs/strip.md b/plugins/plotly-express/docs/strip.md index bccc147a3..94466eedf 100644 --- a/plugins/plotly-express/docs/strip.md +++ b/plugins/plotly-express/docs/strip.md @@ -12,3 +12,9 @@ Strip plots are useful for: 4. **Comparing Data Categories**: Comparing the distribution and spread of data across different categories or groups, making it useful for categorical data analysis. ## Examples + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.strip +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/sub-plots.md b/plugins/plotly-express/docs/sub-plots.md index 574c35da2..12de28a65 100644 --- a/plugins/plotly-express/docs/sub-plots.md +++ b/plugins/plotly-express/docs/sub-plots.md @@ -5,3 +5,9 @@ title: Sub plots Multiple sub plots can be combined into one plot using the `make_subplots` function. This function accepts multiple plot objects, and returns a single plot object. The plot objects can be any of the plot types supported by Deephaven Express. They can be arranged in a grid, or in a single row or column. The `shared_xaxes` and `shared_yaxes` parameters can be used to share axes between plots. ## Examples + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.make_subplots +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/sunburst.md b/plugins/plotly-express/docs/sunburst.md index 864ccdab8..1c9bfb4c4 100644 --- a/plugins/plotly-express/docs/sunburst.md +++ b/plugins/plotly-express/docs/sunburst.md @@ -11,3 +11,8 @@ Sunburst plots are useful for: 3. **Drill-Down Data Exploration**: Developers can implement sunburst plots for drill-down data exploration, allowing users to interactively explore and delve deeper into hierarchical data by clicking on sectors to reveal lower-level categories or information. This use case is valuable in applications that require detailed hierarchical data analysis. ## Examples + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.sunburst +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/timeline.md b/plugins/plotly-express/docs/timeline.md index db328bd93..0fb29e8c1 100644 --- a/plugins/plotly-express/docs/timeline.md +++ b/plugins/plotly-express/docs/timeline.md @@ -5,3 +5,9 @@ title: Timeline Plot Timeline plots in offer a means to visualize time-related data, displaying events, durations, or activities along a time axis. Developers can utilize these plots for applications that require users to understand temporal patterns and relationships, such as project management, event scheduling, and historical data analysis. ## Examples + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.timeline +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/treemap.md b/plugins/plotly-express/docs/treemap.md index e0fc0a8ba..136ccdad7 100644 --- a/plugins/plotly-express/docs/treemap.md +++ b/plugins/plotly-express/docs/treemap.md @@ -11,3 +11,9 @@ Treemap plots are useful for: 3. **Data Summarization**: Treemaps are effective for summarizing large amounts of hierarchical data into a compact, visual format. Developers can use treemaps to provide users with an overview of hierarchical data, and users can drill down into specific categories for more detailed information. ## Examples + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.treemap +``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/violin.md b/plugins/plotly-express/docs/violin.md index a4f1acf30..ee37eddba 100644 --- a/plugins/plotly-express/docs/violin.md +++ b/plugins/plotly-express/docs/violin.md @@ -12,3 +12,9 @@ Violin plots are useful for: 4. **Multimodal Data**: They are particularly useful when dealing with data that exhibits multiple modes or peaks, as they can reveal these underlying patterns effectively. ## Examples + + +## API Reference +```{eval-rst} +.. autofunction:: deephaven.plot.express.violin +``` \ No newline at end of file diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/_layer.py b/plugins/plotly-express/src/deephaven/plot/express/plots/_layer.py index eff6f569d..db852a36d 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/_layer.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/_layer.py @@ -1,7 +1,8 @@ from __future__ import annotations from functools import partial -from typing import Any, Callable, cast, Tuple +from typing import Any, Callable, cast, Tuple, TypedDict + from plotly.graph_objs import Figure @@ -10,12 +11,6 @@ from deephaven.execution_context import make_user_exec_ctx -# The function layer in this file is exempt from the styleguide rule that types should not be in the -# description if there is a type annotation. - -from typing import TypedDict - - class LayerSpecDict(TypedDict, total=False): x: list[float] | None y: list[float] | None @@ -538,12 +533,11 @@ def layer( figures. Args: - *figs: DeephavenFigure | Figure: The charts to layer - which_layout: int | None: (Default value = None) None to layer layouts, or an + *figs: The charts to layer + which_layout: None to layer layouts, or an index of which arg to take the layout from. Currently only valid if domains are not specified. - specs: list[dict[str, Any]] | None: - A list of dictionaries that contains keys of "x" and "y" + specs: A list of dictionaries that contains keys of "x" and "y" that have values that are lists of two floats from 0 to 1. The chart that corresponds with a domain will be resized to that domain. Either x or y can be excluded if only resizing on one axis. @@ -552,7 +546,7 @@ def layer( Can also specify "matched_xaxis" or "matched_yaxis" to add this figure to a match group. All figures with the same value of this group will have matching axes. - unsafe_update_figure: Callable: An update function that takes a plotly figure + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. Note that diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/area.py b/plugins/plotly-express/src/deephaven/plot/express/plots/area.py index 75f9d2796..9e5c016ae 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/area.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/area.py @@ -10,9 +10,6 @@ from ..shared import default_callback from ..deephaven_figure import DeephavenFigure -# The functions in this file are exempt from the styleguide rule that types should not be in the description if there -# is a type annotation. - def area( table: Table | None = None, @@ -59,133 +56,95 @@ def area( """Returns an area chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | list[str] | None: (Default value = None) - A column or list of columns that contain x-axis values. - y: str | list[str] | None: (Default value = None) - A column or list of columns that contain y-axis values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + x: A column or list of columns that contain x-axis values. + y: A column or list of columns that contain y-axis values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, color, pattern_shape, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. - pattern_shape: str | list[str] | None: (Default value = None) - A column or list of columns that contain pattern shape values. + pattern_shape: A column or list of columns that contain pattern shape values. The value is used for a plot by on pattern shape. See pattern_shape_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See symbol_map for additional behaviors. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - pattern_shape_sequence: list[str] | None: (Default value = None) - A list of patterns to sequentially apply + pattern_shape_sequence: A list of patterns to sequentially apply to the series. The patterns loop, so if there are more series than patterns, patterns will be reused. - pattern_shape_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + pattern_shape_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to patterns. - symbol_sequence: list[str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. - symbol_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. If "identity", the values are taken as literal symbols. If "by" or ("by", dict) where dict is as described above, the symbols are forced to by - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. - size_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by - xaxis_sequence: list[str] | None: (Default value = None) - A list of x axes to assign series to. Odd numbers + xaxis_sequence: A list of x axes to assign series to. Odd numbers starting with 1 are created on the bottom x axis and even numbers starting with 2 are created on the top x axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. - yaxis_sequence: list[str] | None: (Default value = None) - A list of y axes to assign series to. Odd numbers + yaxis_sequence: A list of y axes to assign series to. Odd numbers starting with 1 are created on the left y axis and even numbers starting with 2 are created on the top y axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. - markers: bool: (Default value = False) - True to draw markers on the line, False to not. Default False - groupnorm: str | None: (Default value = None) - Set to 'fraction' to plot the fraction out of + markers: True to draw markers on the line, False to not. Default False + groupnorm: Set to 'fraction' to plot the fraction out of the total value of all points at that x value, 'percent' to take the fraction and multiply by 100. Note that if multiple y axes are specified, the groupnorm is taken per axis. - log_x: bool | list[bool]: (Default value = False) - A boolean or list of booleans that specify if + log_x: A boolean or list of booleans that specify if the corresponding axis is a log axis or not. The booleans loop, so if there are more series than booleans, booleans will be reused. - log_y: bool | list[bool]: (Default value = False) - A boolean or list of booleans that specify if + log_y: A boolean or list of booleans that specify if the corresponding axis is a log axis or not. The booleans loop, so if there are more series than booleans, booleans will be reused. - range_x: list[int] | list[list[int]] | None: (Default value = None) - A list of two numbers or a list of lists of two numbers + range_x: A list of two numbers or a list of lists of two numbers that specify the range of the x axes. None can be specified for no range The ranges loop, so if there are more axes than ranges, ranges will be reused. - range_y: list[int] | list[list[int]] | None: (Default value = None) - A list of two numbers or a list of lists of two numbers + range_y: A list of two numbers or a list of lists of two numbers that specify the range of the y axes. None can be specified for no range The ranges loop, so if there are more axes than ranges, ranges will be reused. - yaxis_titles: list[str] | None: (Default value = None) - A list of titles to sequentially apply to the y axes. The titles do not - loop. - xaxis_titles: list[str] | None: (Default value = None) - A list of titles to sequentially apply to the x axes. The titles do not - loop. - line_shape: str: (Default value = 'linear') - The line shape for all lines created. One of 'linear', + yaxis_titles: A list of titles to sequentially apply to the y axes. The titles do not + loop. + xaxis_titles: A list of titles to sequentially apply to the x axes. The titles do not + loop. + line_shape: The line shape for all lines created. One of 'linear', 'spline', 'vhv', 'hvh', 'vh', 'hv'. Default 'linear' - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -194,7 +153,7 @@ def area( mappings. Returns: - DeephavenFigure: A DeephavenFigure that contains the area chart + A DeephavenFigure that contains the area chart """ args = locals() diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/bar.py b/plugins/plotly-express/src/deephaven/plot/express/plots/bar.py index e2bd97504..ca03cd7e7 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/bar.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/bar.py @@ -11,9 +11,6 @@ from ..shared import default_callback from ..deephaven_figure import generate_figure, DeephavenFigure -# The functions in this file are exempt from the styleguide rule that types should not be in the description if there -# is a type annotation. - def bar( table: Table | None = None, @@ -57,119 +54,84 @@ def bar( """Returns a bar chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | list[str] | None: (Default value = None) - A column or list of columns that contain x-axis values. - y: str | list[str] | None: (Default value = None) - A column or list of columns that contain y-axis values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + x: A column or list of columns that contain x-axis values. + y: A column or list of columns that contain y-axis values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain color and pattern_shape. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - pattern_shape: str | list[str] | None: (Default value = None) - A column or list of columns that contain pattern shape values. + pattern_shape: A column or list of columns that contain pattern shape values. The value is used for a plot by on pattern shape. See pattern_shape_map for additional behaviors. - error_x: str | None: (Default value = None) - A column with x error bar values. + error_x: A column with x error bar values. These form the error bars in both the positive and negative direction if error_x_minus is not specified, and the error bars in only the positive direction if error_x_minus is specified. None can be used to specify no error bars on the corresponding series. - error_x_minus: str | None: (Default value = None) - A column with x error bar values. + error_x_minus: A column with x error bar values. These form the error bars in the negative direction, and are ignored if error_x is not specified. - error_y: str | None: (Default value = None) - A column with x error bar values. + error_y: A column with x error bar values. These form the error bars in both the positive and negative direction if error_y_minus is not specified, and the error bars in only the positive direction if error_y_minus is specified. None can be used to specify no error bars on the corresponding series. - error_y_minus: str | None: (Default value = None) - A column with y error bar values. + error_y_minus: A column with y error bar values. These form the error bars in the negative direction, and are ignored if error_y is not specified. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. If "identity", the values are taken as literal colors. If "by" or ("by", dict) where dict is as described above, the colors are forced to by - pattern_shape_sequence: list[str] | None: (Default value = None) - A list of patterns to sequentially apply + pattern_shape_sequence: A list of patterns to sequentially apply to the series. The patterns loop, so if there are more series than patterns, patterns will be reused. - pattern_shape_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + pattern_shape_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to patterns. If "identity", the values are taken as literal patterns. If "by" or ("by", dict) where dict is as described above, the patterns are forced to by - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number | None: (Default value = None) - A number that is the midpoint of the color axis - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - barmode: str: (Default value = 'relative') - If 'relative', bars are stacked. If 'overlay', bars are drawn on top + barmode: If 'relative', bars are stacked. If 'overlay', bars are drawn on top of each other. If 'group', bars are drawn next to each other. - log_x: bool | list[bool]: (Default value = False) - A boolean or list of booleans that specify if + log_x: A boolean or list of booleans that specify if the corresponding axis is a log axis or not. The booleans loop, so if there are more series than booleans, booleans will be reused. - log_y: bool | list[bool]: (Default value = False) - A boolean or list of booleans that specify if + log_y: A boolean or list of booleans that specify if the corresponding axis is a log axis or not. The booleans loop, so if there are more series than booleans, booleans will be reused. - range_x: list[int] | list[list[int]] | None: (Default value = None) - A list of two numbers or a list of lists of two numbers + range_x: A list of two numbers or a list of lists of two numbers that specify the range of the x axes. None can be specified for no range The ranges loop, so if there are more axes than ranges, ranges will be reused. - range_y: list[int] | list[list[int]] | None: (Default value = None) - A list of two numbers or a list of lists of two numbers + range_y: A list of two numbers or a list of lists of two numbers that specify the range of the y axes. None can be specified for no range The ranges loop, so if there are more axes than ranges, ranges will be reused. - text_auto: bool | str: (Default value = False) - If True, display the value at each bar. + text_auto: If True, display the value at each bar. If a string, specifies a plotly texttemplate. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -178,7 +140,7 @@ def bar( mappings. Returns: - DeephavenFigure: A DeephavenFigure that contains the bar chart + A DeephavenFigure that contains the bar chart """ args = locals() @@ -271,87 +233,59 @@ def timeline( """Returns a timeline (otherwise known as a gantt chart) Args: - table: Table | None: (Default value = None) - A table to pull data from. - x_start: str | None: (Default value = None) - A column that contains starting x-axis values. Must be a `java.time.Instant` column. - x_end: str | None: (Default value = None) - A column that contains ending x-axis values. Must be a `java.time.Instant` column. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + x_start: A column that contains starting x-axis values. Must be a `java.time.Instant` column. + x_end: A column that contains ending x-axis values. Must be a `java.time.Instant` column. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain color and pattern_shape. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - pattern_shape: str | list[str] | None: (Default value = None) - A column or list of columns that contain pattern shape values. + pattern_shape: A column or list of columns that contain pattern shape values. The value is used for a plot by on pattern shape. See pattern_shape_map for additional behaviors. - y: str | None: (Default value = None) - A column that contains y-axis labels - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + y: A column that contains y-axis labels + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. If "identity", the values are taken as literal colors. If "by" or ("by", dict) where dict is as described above, the colors are forced to by - pattern_shape_sequence: list[str] | None: (Default value = None) - A list of patterns to sequentially apply + pattern_shape_sequence: A list of patterns to sequentially apply to the series. The patterns loop, so if there are more series than patterns, patterns will be reused. - pattern_shape_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + pattern_shape_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to patterns. If "identity", the values are taken as literal patterns. If "by" or ("by", dict) where dict is as described above, the patterns are forced to by - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number | None: (Default value = None) - A number that is the midpoint of the color axis - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - range_x: list[int] | list[list[int]] | None: (Default value = None) - A list of two numbers or a list of lists of two numbers + range_x: A list of two numbers or a list of lists of two numbers that specify the range of the x axes. None can be specified for no range The ranges loop, so if there are more axes than ranges, ranges will be reused. - range_y: list[int] | list[list[int]] | None: (Default value = None) - A list of two numbers or a list of lists of two numbers + range_y: A list of two numbers or a list of lists of two numbers that specify the range of the y axes. None can be specified for no range The ranges loop, so if there are more axes than ranges, ranges will be reused. - title: str | None: (Default value = None) - The title of the chart - template: str: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -395,79 +329,53 @@ def frequency_bar( """Returns a bar chart that contains the counts of the specified columns Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | list[str] | None: (Default value = None) - A column or list of columns that contain x-axis values. + table: A table to pull data from. + x: A column or list of columns that contain x-axis values. Only one of x or y can be specified. If x is specified, the bars are drawn vertically. - y: str | list[str] | None: (Default value = None) - A column or list of columns that contain y-axis values. + y: A column or list of columns that contain y-axis values. Only one of x or y can be specified. If y is specified, the bars are drawn horizontally. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain color and pattern_shape. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. - pattern_shape: str | list[str] | None: (Default value = None) - A column or list of columns that contain pattern shape values. + pattern_shape: A column or list of columns that contain pattern shape values. The value is used for a plot by on pattern shape. See pattern_shape_map for additional behaviors. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence | None: list[str]: (Default value = None) - A list of colors to sequentially apply to + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - pattern_shape_sequence: list[str] | None: (Default value = None) - A list of patterns to sequentially apply + pattern_shape_sequence: A list of patterns to sequentially apply to the series. The patterns loop, so if there are more series than patterns, patterns will be reused. - pattern_shape_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + pattern_shape_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to patterns. - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - barmode: str: (Default value = 'relative') - If 'relative', bars are stacked. If 'overlay', bars are drawn on top + barmode: If 'relative', bars are stacked. If 'overlay', bars are drawn on top of each other. If 'group', bars are drawn next to each other. - log_x: bool - A boolean that specifies if the corresponding axis is a log + log_x: A boolean that specifies if the corresponding axis is a log axis or not. - log_y: bool - A boolean that specifies if the corresponding axis is a log + log_y: A boolean that specifies if the corresponding axis is a log axis or not. - range_x: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the x-axis. - range_y: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the y-axis. - text_auto: bool | str: (Default value = False) - If True, display the value at each bar. + range_x: A list of two numbers that specify the range of the x-axis. + range_y: A list of two numbers that specify the range of the y-axis. + text_auto: If True, display the value at each bar. If a string, specifies a plotly texttemplate. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/distribution.py b/plugins/plotly-express/src/deephaven/plot/express/plots/distribution.py index 48e089b6c..a3f902977 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/distribution.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/distribution.py @@ -26,9 +26,6 @@ unsafe_figure_update_wrapper, ) -# The functions in this file are exempt from the styleguide rule that types should not be in the description if there -# is a type annotation. - def violin( table: Table | None = None, @@ -55,66 +52,46 @@ def violin( """Returns a violin chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | list[str] | None: (Default value = None) - A column name or list of columns that contain x-axis values. + table: A table to pull data from. + x: A column name or list of columns that contain x-axis values. Only one of x or y can be specified. If x is specified, the violins are drawn horizontally. - y: str | list[str] | None: (Default value = None) - A column name or list of columns that contain y-axis values. + y: A column name or list of columns that contain y-axis values. Only one of x or y can be specified. If y is specified, the violins are drawn vertically. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain color. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - violinmode: str: (Default value = 'group') - Default 'group', which draws the violins next + violinmode: Default 'group', which draws the violins next to each other or 'overlay' which draws them on top of each other. - log_x: bool - A boolean that specifies if the corresponding axis is a log + log_x: A boolean that specifies if the corresponding axis is a log axis or not. - log_y: bool - A boolean that specifies if the corresponding axis is a log + log_y: A boolean that specifies if the corresponding axis is a log axis or not. - range_x: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the x-axis. - range_y: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the y-axis. - points: bool | str: (Default value = 'outliers') - Default 'outliers', which draws points outside the whiskers. + range_x: A list of two numbers that specify the range of the x-axis. + range_y: A list of two numbers that specify the range of the y-axis. + points: Default 'outliers', which draws points outside the whiskers. 'suspectedoutliers' draws points below 4*Q1-3*Q3 and above 4*Q3-3*Q1. 'all' draws all points and False draws no points. - box: bool: (Default value = False) - Draw boxes inside the violin if True. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + box: Draw boxes inside the violin if True. + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -159,66 +136,46 @@ def box( """Returns a box chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | list[str] | None: (Default value = None) - A column name or list of columns that contain x-axis values. + table: A table to pull data from. + x: A column name or list of columns that contain x-axis values. Only one of x or y can be specified. If x is specified, the boxes are drawn horizontally. - y: str | list[str] | None: (Default value = None) - A column name or list of columns that contain y-axis values. + y: A column name or list of columns that contain y-axis values. Only one of x or y can be specified. If y is specified, the boxes are drawn vertically. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain color. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence | None: list[str]: (Default value = None) - A list of colors to sequentially apply to + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence | None: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - boxmode: str: (Default value = 'group') - Default 'group', which draws the boxes next + boxmode: Default 'group', which draws the boxes next to each other or 'overlay' which draws them on top of each other. - log_x: bool - A boolean that specifies if the corresponding axis is a log + log_x: A boolean that specifies if the corresponding axis is a log axis or not. - log_y: bool - A boolean that specifies if the corresponding axis is a log + log_y: A boolean that specifies if the corresponding axis is a log axis or not. - range_x: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the x-axis. - range_y: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the y-axis. - points: bool | str: (Default value = 'outliers') - Default 'outliers', which draws points outside the whiskers. + range_x: A list of two numbers that specify the range of the x-axis. + range_y: A list of two numbers that specify the range of the y-axis. + points: Default 'outliers', which draws points outside the whiskers. 'suspectedoutliers' draws points below 4*Q1-3*Q3 and above 4*Q3-3*Q1. 'all' draws all points and False draws no points. - notched: bool: (Default value = False) - If True boxes are drawn with notches - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + notched: If True boxes are drawn with notches + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -261,60 +218,42 @@ def strip( """Returns a strip chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | list[str] | None: (Default value = None) - A column name or list of columns that contain x-axis values. + table: A table to pull data from. + x: A column name or list of columns that contain x-axis values. Only one of x or y can be specified. If x is specified, the strips are drawn horizontally. - y: str | list[str] | None: (Default value = None) - A column name or list of columns that contain y-axis values. + y: A column name or list of columns that contain y-axis values. Only one of x or y can be specified. If y is specified, the strips are drawn vertically. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain color. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - stripmode: str: (Default value = 'group') - Default 'group', which draws the strips next + stripmode: Default 'group', which draws the strips next to each other or 'overlay' which draws them on top of each other. - log_x: bool - A boolean that specifies if the corresponding axis is a log + log_x: A boolean that specifies if the corresponding axis is a log axis or not. - log_y: bool - A boolean that specifies if the corresponding axis is a log + log_y: A boolean that specifies if the corresponding axis is a log axis or not. - range_x: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the x-axis. - range_y: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the y-axis. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + range_x: A list of two numbers that specify the range of the x-axis. + range_y: A list of two numbers that specify the range of the y-axis. + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -416,98 +355,69 @@ def histogram( """Returns a histogram Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | list[str] | None: (Default value = None) - A column name or list of columns that contain x-axis values. + table: A table to pull data from. + x: A column name or list of columns that contain x-axis values. Only one of x or y can be specified. If x is specified, the bars are drawn horizontally. - y: str | list[str] | None: (Default value = None) - A column name or list of columns that contain y-axis values. + y: A column name or list of columns that contain y-axis values. Only one of x or y can be specified. If y is specified, the bars are drawn vertically. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain color. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. - pattern_shape: str | list[str] | None: (Default value = None) - A column or list of columns that contain pattern shape values. + pattern_shape: A column or list of columns that contain pattern shape values. The value is used for a plot by on pattern shape. See pattern_shape_map for additional behaviors. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - pattern_shape_sequence: list[str] | None: (Default value = None) - A list of patterns to sequentially apply + pattern_shape_sequence: A list of patterns to sequentially apply to the series. The patterns loop, so if there are more series than patterns, patterns will be reused. - pattern_shape_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + pattern_shape_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to patterns. - marginal: str | None: (Default value = None) - The type of marginal; histogram, violin, rug, box - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + marginal: The type of marginal; histogram, violin, rug, box + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - barmode: str: (Default value = 'relative') - If 'relative', bars are stacked. If + barmode: If 'relative', bars are stacked. If 'overlay', bars are drawn on top of each other. If 'group', bars are drawn next to each other. - barnorm: str | None: (Default value = None) - If 'fraction', the value of the bar is divided by all bars at that + barnorm: If 'fraction', the value of the bar is divided by all bars at that location. If 'percentage', the result is the same but multiplied by 100. - histnorm: str | None: (Default value = None) - If 'probability', the value at this bin is divided out of the total + histnorm: If 'probability', the value at this bin is divided out of the total of all bins in this column. If 'percent', result is the same as 'probability' but multiplied by 100. If 'density', the value is divided by the width of the bin. If 'probability density', the value is divided out of the total of all bins in this column and the width of the bin. - log_x: bool - A boolean that specifies if the corresponding axis is a log + log_x: A boolean that specifies if the corresponding axis is a log axis or not. - log_y: bool - A boolean that specifies if the corresponding axis is a log + log_y: A boolean that specifies if the corresponding axis is a log axis or not. - range_x: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the x-axis. - range_y: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the y-axis. - range_bins: list[int]: - A list of two numbers that specify the range of data that is used. - histfunc: str: (Default value = 'count') - The function to use when aggregating within bins. One of + range_x: A list of two numbers that specify the range of the x-axis. + range_y: A list of two numbers that specify the range of the y-axis. + range_bins: A list of two numbers that specify the range of data that is used. + histfunc: The function to use when aggregating within bins. One of 'avg', 'count', 'count_distinct', 'max', 'median', 'min', 'std', 'sum', or 'var' - cumulative: bool: (Default value = False) - If True, values are cumulative. - nbins: int: (Default value = 10) - The number of bins to use. - text_auto: bool | str: (Default value = False) - If True, display the value at each bar. + cumulative: If True, values are cumulative. + nbins: The number of bins to use. + text_auto: If True, display the value at each bar. If a string, specifies a plotly texttemplate. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/financial.py b/plugins/plotly-express/src/deephaven/plot/express/plots/financial.py index c06704507..89bf41195 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/financial.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/financial.py @@ -8,9 +8,6 @@ from ..shared import default_callback from ..deephaven_figure import draw_ohlc, draw_candlestick, DeephavenFigure -# The functions in this file are exempt from the styleguide rule that types should not be in the description if there -# is a type annotation. - def ohlc( table: Table | None = None, @@ -30,46 +27,33 @@ def ohlc( """Returns an ohlc chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | None: (Default value = None) - The column containing x-axis data - open: str | list[str] | None: (Default value = None) - The column containing the open data - high: str | list[str] | None: (Default value = None) - The column containing the high data - low: str | list[str] | None: (Default value = None) - The column containing the low data - close: str | list[str] | None: (Default value = None) - The column containing the close data - increasing_color_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + table: A table to pull data from. + x: The column containing x-axis data + open: The column containing the open data + high: The column containing the high data + low: The column containing the low data + close: The column containing the close data + increasing_color_sequence: A list of colors to sequentially apply to the series on increasing bars. The colors loop, so if there are more series than colors, colors will be reused. - decreasing_color_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + decreasing_color_sequence: A list of colors to sequentially apply to the series on decreasing bars. The colors loop, so if there are more series than colors, colors will be reused. - xaxis_sequence: list[str] | None: (Default value = None) - A list of x axes to assign series to. Odd numbers + xaxis_sequence: A list of x axes to assign series to. Odd numbers starting with 1 are created on the bottom x axis and even numbers starting with 2 are created on the top x axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. - yaxis_sequence: list[str] | None: (Default value = None) - A list of y axes to assign series to. Odd numbers + yaxis_sequence: A list of y axes to assign series to. Odd numbers starting with 1 are created on the left y axis and even numbers starting with 2 are created on the top y axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. - yaxis_titles: list[str] | None: (Default value = None) - A list of titles to sequentially apply to the y axes. The titles do not + yaxis_titles: A list of titles to sequentially apply to the y axes. The titles do not loop. - xaxis_titles: list[str] | None: (Default value = None) - A list of titles to sequentially apply to the x axes. The titles do not + xaxis_titles: A list of titles to sequentially apply to the x axes. The titles do not loop. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -107,47 +91,34 @@ def candlestick( ) -> DeephavenFigure: """Returns a candlestick chart - Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | None: (Default value = None) - The column containing x-axis data - open: str | list[str] | None: (Default value = None) - The column containing the open data - high: str | list[str] | None: (Default value = None) - The column containing the high data - low: str | list[str] | None: (Default value = None) - The column containing the low data - close: str | list[str] | None: (Default value = None) - The column containing the close data - increasing_color_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + Args: + table: A table to pull data from. + x: The column containing x-axis data + open: The column containing the open data + high: The column containing the high data + low: The column containing the low data + close: The column containing the close data + increasing_color_sequence: A list of colors to sequentially apply to the series on increasing bars. The colors loop, so if there are more series than colors, colors will be reused. - decreasing_color_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + decreasing_color_sequence: A list of colors to sequentially apply to the series on decreasing bars. The colors loop, so if there are more series than colors, colors will be reused. - xaxis_sequence: list[str] | None: (Default value = None) - A list of x axes to assign series to. Odd numbers + xaxis_sequence: A list of x axes to assign series to. Odd numbers starting with 1 are created on the bottom x axis and even numbers starting with 2 are created on the top x axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. - yaxis_sequence: list[str] | None: (Default value = None) - A list of y axes to assign series to. Odd numbers + yaxis_sequence: A list of y axes to assign series to. Odd numbers starting with 1 are created on the left y axis and even numbers starting with 2 are created on the top y axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. - yaxis_titles: list[str] | None: (Default value = None) - A list of titles to sequentially apply to the y axes. The titles do not + yaxis_titles: A list of titles to sequentially apply to the y axes. The titles do not loop. - xaxis_titles: list[str] | None: (Default value = None) - A list of titles to sequentially apply to the x axes. The titles do not + xaxis_titles: A list of titles to sequentially apply to the x axes. The titles do not loop. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/hierarchial.py b/plugins/plotly-express/src/deephaven/plot/express/plots/hierarchial.py index 2143c17c1..89bfe04d3 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/hierarchial.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/hierarchial.py @@ -11,9 +11,6 @@ from ..shared import default_callback from ..deephaven_figure import DeephavenFigure -# The functions in this file are exempt from the styleguide rule that types should not be in the description if there -# is a type annotation. - def treemap( table: Table | None = None, @@ -38,53 +35,35 @@ def treemap( """Returns a treemap chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - names: str | None: (Default value = None) - The column containing names of the sections - values: str | None: (Default value = None) - The column containing values of the sections - parents: str | None: (Default value = None) - The column containing parents of the sections - ids: str | None: (Default value = None) - The column containing ids of the sections. Unlike values, these + table: A table to pull data from. + names: The column containing names of the sections + values: The column containing values of the sections + parents: The column containing parents of the sections + ids: The column containing ids of the sections. Unlike values, these must be unique. Values are used for ids if ids are not specified. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number | None: (Default value = None) - A number that is the midpoint of the color axis - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - branchvalues: str | None: (Default value = None) - Set to 'total' to take the value at a level to include + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + title: The title of the chart + template: The template for the chart. + branchvalues: Set to 'total' to take the value at a level to include all descendants and 'remainder' to the value as the remainder after subtracting leaf values. - maxdepth: int | None: (Default value = None) - Sets the total number of visible levels. Set to -1 to + maxdepth: Sets the total number of visible levels. Set to -1 to render all levels. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -124,53 +103,35 @@ def sunburst( """Returns a sunburst chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - names: str | None: (Default value = None) - The column containing names of the sections - values: str | None: (Default value = None) - The column containing values of the sections - parents: str | None: (Default value = None) - The column containing parents of the sections - ids: str | None: (Default value = None) - The column containing ids of the sections. Unlike values, these + table: A table to pull data from. + names: The column containing names of the sections + values: The column containing values of the sections + parents: The column containing parents of the sections + ids: The column containing ids of the sections. Unlike values, these must be unique. Values are used for ids if ids are not specified. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + hover_name: A column that contains names to bold in the hover tooltip. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number | None: (Default value = None) - A number that is the midpoint of the color axis - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - branchvalues: str | None: (Default value = None) - Set to 'total' to take the value at a level to include + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + labels: A dictionary of labels mapping columns to new labels. + title: The title of the chart + template: The template for the chart. + branchvalues: Set to 'total' to take the value at a level to include all descendants and 'remainder' to the value as the remainder after subtracting leaf values. - maxdepth: int | None: (Default value = None) - Sets the total number of visible levels. Set to -1 to + maxdepth: Sets the total number of visible levels. Set to -1 to render all levels. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -210,53 +171,35 @@ def icicle( """Returns a icicle chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - names: str | None: (Default value = None) - The column containing names of the sections - values: str | None: (Default value = None) - The column containing values of the sections - parents: str | None: (Default value = None) - The column containing parents of the sections - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + table: A table to pull data from. + names: The column containing names of the sections + values: The column containing values of the sections + parents: The column containing parents of the sections + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - ids: str | None: (Default value = None) - The column containing ids of the sections. Unlike values, these + ids: The column containing ids of the sections. Unlike values, these must be unique. Values are used for ids if ids are not specified. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + hover_name: A column that contains names to bold in the hover tooltip. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number | None: (Default value = None) - A number that is the midpoint of the color axis - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - branchvalues: str | None: (Default value = None) - Set to 'total' to take the value at a level to include + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + labels: A dictionary of labels mapping columns to new labels. + title: The title of the chart + template: The template for the chart. + branchvalues: Set to 'total' to take the value at a level to include all descendants and 'remainder' to the value as the remainder after subtracting leaf values. - maxdepth: int | None: (Default value = None) - Sets the total number of visible levels. Set to -1 to + maxdepth: Sets the total number of visible levels. Set to -1 to render all levels. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -298,62 +241,42 @@ def funnel( """Returns a funnel chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | list[str] | None: (Default value = None) - A column or list of columns that contain x-axis values. - y: str | list[str] | None: (Default value = None) - A column or list of columns that contain y-axis values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + x: A column or list of columns that contain x-axis values. + y: A column or list of columns that contain y-axis values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain color and pattern_shape. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - orientation: str | None: (Default value = None) - "h" for horizontal or "v" for vertical - log_x: bool - A boolean that specifies if the corresponding axis is a log + orientation: "h" for horizontal or "v" for vertical + log_x: A boolean that specifies if the corresponding axis is a log axis or not. - log_y: bool - A boolean that specifies if the corresponding axis is a log + log_y: A boolean that specifies if the corresponding axis is a log axis or not. - range_x: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the x-axis. - range_y: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the y-axis. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + range_x: A list of two numbers that specify the range of the x-axis. + range_y: A list of two numbers that specify the range of the y-axis. + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -387,38 +310,26 @@ def funnel_area( """Returns a funnel area chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - names: str | None: (Default value = None) - The column containing names of the sections - values: str | None: (Default value = None) - The column containing values of the sections - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + table: A table to pull data from. + names: The column containing names of the sections + values: The column containing values of the sections + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + title: The title of the chart + template: The template for the chart. + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/line.py b/plugins/plotly-express/src/deephaven/plot/express/plots/line.py index e225f3fae..43ed2213f 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/line.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/line.py @@ -10,9 +10,6 @@ from ..shared import default_callback from ..deephaven_figure import DeephavenFigure -# The functions in this file are exempt from the styleguide rule that types should not be in the description if there -# is a type annotation. - def line( table: Table | None = None, @@ -66,162 +63,117 @@ def line( """Returns a line chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | list[str] | None: (Default value = None) - A column or list of columns that contain x-axis values. - y: str | list[str] | None: (Default value = None) - A column or list of columns that contain y-axis values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + x: A column or list of columns that contain x-axis values. + y: A column or list of columns that contain y-axis values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - line_dash: str | list[str] | None: (Default value = None) - A column or list of columns that contain line_dash values. + line_dash: A column or list of columns that contain line_dash values. The value is used for a plot by on line_dash. See line_dash_map for additional behaviors. - width: str | list[str] | None: (Default value = None) - A column or list of columns that contain width values. + width: A column or list of columns that contain width values. The value is used for a plot by on width. See width_map for additional behaviors. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - error_x: str | None: (Default value = None) - A column with x error bar values. + error_x: A column with x error bar values. These form the error bars in both the positive and negative direction if error_x_minus is not specified, and the error bars in only the positive direction if error_x_minus is specified. None can be used to specify no error bars on the corresponding series. - error_x_minus: str | None: (Default value = None) - A column with x error bar values. + error_x_minus: A column with x error bar values. These form the error bars in the negative direction, and are ignored if error_x is not specified. - error_y: str | None: (Default value = None) - A column with x error bar values. + error_y: A column with x error bar values. These form the error bars in both the positive and negative direction if error_y_minus is not specified, and the error bars in only the positive direction if error_y_minus is specified. None can be used to specify no error bars on the corresponding series. - error_y_minus: str | None: (Default value = None) - A column with y error bar values. + error_y_minus: A column with y error bar values. These form the error bars in the negative direction, and are ignored if error_y is not specified. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - line_dash_sequence: list[str] | None: (Default value = None) - A list of line dashes to sequentially apply to + line_dash_sequence: A list of line dashes to sequentially apply to the series. The dashes loop, so if there are more series than dashes, dashes will be reused. - line_dash_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + line_dash_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to line_dash. - symbol_sequence: list[str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. - symbol_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. If "identity", the values are taken as literal symbols. If "by" or ("by", dict) where dict is as described above, the symbols are forced to by - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence:A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. - size_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by - width_sequence: list[str] | None: (Default value = None) - A list of widths to sequentially apply to + width_sequence: A list of widths to sequentially apply to the series. The widths loop, so if there are more series than widths, widths will be reused. - width_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + width_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to width. - xaxis_sequence: list[str] | None: (Default value = None) - A list of x axes to assign series to. Odd numbers + xaxis_sequence: A list of x axes to assign series to. Odd numbers starting with 1 are created on the bottom x axis and even numbers starting with 2 are created on the top x axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. - yaxis_sequence: list[str] | None: (Default value = None) - A list of y axes to assign series to. Odd numbers + yaxis_sequence: A list of y axes to assign series to. Odd numbers starting with 1 are created on the left y axis and even numbers starting with 2 are created on the top y axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. - markers: bool: (Default value = False) - True to draw markers on the line, False to not. Default False - log_x: bool | list[bool]: (Default value = False) - A boolean or list of booleans that specify if + markers: True to draw markers on the line, False to not. Default False + log_x: A boolean or list of booleans that specify if the corresponding axis is a log axis or not. The booleans loop, so if there are more series than booleans, booleans will be reused. - log_y: bool | list[bool]: (Default value = False) - A boolean or list of booleans that specify if + log_y: A boolean or list of booleans that specify if the corresponding axis is a log axis or not. The booleans loop, so if there are more series than booleans, booleans will be reused. - range_x: list[int] | list[list[int]] | None: (Default value = None) - A list of two numbers or a list of lists of two numbers + range_x: A list of two numbers or a list of lists of two numbers that specify the range of the x axes. None can be specified for no range The ranges loop, so if there are more axes than ranges, ranges will be reused. - range_y: list[int] | list[list[int]] | None: (Default value = None) - A list of two numbers or a list of lists of two numbers + range_y: A list of two numbers or a list of lists of two numbers that specify the range of the y axes. None can be specified for no range The ranges loop, so if there are more axes than ranges, ranges will be reused. - yaxis_titles: list[str] | None: (Default value = None) - A list of titles to sequentially apply to the y axes. The titles do not + yaxis_titles: A list of titles to sequentially apply to the y axes. The titles do not loop. - xaxis_titles: list[str] | None: (Default value = None) - A list of titles to sequentially apply to the x axes. The titles do not + xaxis_titles: A list of titles to sequentially apply to the x axes. The titles do not loop. - line_shape: str: (Default value = 'linear') - The line shape for all lines created. One of 'linear', + line_shape: The line shape for all lines created. One of 'linear', 'spline', 'vhv', 'hvh', 'vh', 'hv'. Default 'linear' - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - render_mode: str (Default value = "svg") - Either "svg" or "webgl". Setting to "webgl" will lead to a more + title: The title of the chart + template: The template for the chart. + render_mode: Either "svg" or "webgl". Setting to "webgl" will lead to a more performant plot but there may be graphical bugs. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -290,143 +242,99 @@ def line_3d( """Returns a 3D line chart Args: - table: Table: (Default value = None) - A table to pull data from. - x: str | None: (Default value = None) - A column that contains x-axis values. - y: str | None: (Default value = None) - A column that contains y-axis values. - z: str | None: (Default value = None) - A column that contains z-axis values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + x: A column that contains x-axis values. + y: A column that contains y-axis values. + z: A column that contains z-axis values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - line_dash: str | list[str] | None: (Default value = None) - A column or list of columns that contain line_dash values. + line_dash: A column or list of columns that contain line_dash values. The value is used for a plot by on line_dash. See line_dash_map for additional behaviors. - width: str | list[str] | None: (Default value = None) - A column or list of columns that contain width values. + width: A column or list of columns that contain width values. The value is used for a plot by on width. See width_map for additional behaviors. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - error_x: str | None: (Default value = None) - A column with x error bar values. These form the error + error_x: A column with x error bar values. These form the error bars in both the positive and negative direction if error_x_minus is not specified, and the error bars in only the positive direction if error_x_minus is specified. - error_x_minus: str | None: (Default value = None) - A column with x error bar values. These form + error_x_minus: A column with x error bar values. These form the error bars in the negative direction, and are ignored if error_x is not specified. - error_y: str | None: (Default value = None) - A column with y error bar values. These form the error + error_y: A column with y error bar values. These form the error bars in both the positive and negative direction if error_y_minus is not specified, and the error bars in only the positive direction if error_y_minus is specified. - error_y_minus: str | None: (Default value = None) - A column with y error bar values. These form + error_y_minus: A column with y error bar values. These form the error bars in the negative direction, and are ignored if error_y is not specified. - error_z: str | None: (Default value = None) - A column with z error bar values. These form the error + error_z: A column with z error bar values. These form the error bars in both the positive and negative direction if error_z_minus is not specified, and the error bars in only the positive direction if error_z_minus is specified. - error_z_minus: str | None: (Default value = None) - A column with z error bar values. These form + error_z_minus: A column with z error bar values. These form the error bars in the negative direction, and are ignored if error_z - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - line_dash_sequence: list[str] | None: (Default value = None) - A list of line dashes to sequentially apply to + line_dash_sequence: A list of line dashes to sequentially apply to the series. The dashes loop, so if there are more series than dashes, dashes will be reused. - line_dash_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + line_dash_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to line_dash. - symbol_sequence: list[str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. - symbol_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. If "identity", the values are taken as literal symbols. If "by" or ("by", dict) where dict is as described above, the symbols are forced to by - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. - size_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by - width_sequence: list[str] | None: (Default value = None) - A list of widths to sequentially apply to + width_sequence: A list of widths to sequentially apply to the series. The widths loop, so if there are more series than widths, widths will be reused. - width_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + width_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to width. - markers: bool: (Default value = False) - True to draw markers on the line, False to not. Default False - log_x: bool: (Default value = False) - A boolean that specifies if the corresponding axis is a log + markers: True to draw markers on the line, False to not. Default False + log_x: A boolean that specifies if the corresponding axis is a log axis or not. - log_y: bool: (Default value = False) - A boolean that specifies if the corresponding axis is a log + log_y: A boolean that specifies if the corresponding axis is a log axis or not. - log_z: bool: (Default value = False) - A boolean that specifies if the corresponding axis is a log + log_z: A boolean that specifies if the corresponding axis is a log axis or not. - range_x: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the x axis. - range_y: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the y axis. - range_z: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the z axis. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + range_x: A list of two numbers that specify the range of the x axis. + range_y: A list of two numbers that specify the range of the y axis. + range_z: A list of two numbers that specify the range of the z axis. + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -489,119 +397,80 @@ def line_polar( """Returns a polar scatter chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - r: str | None: (Default value = None) - A column that contains r values. - theta: str | None: (Default value = None) - A column that contains theta values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + r: A column that contains r values. + theta: A column that contains theta values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - line_dash: str | list[str] | None: (Default value = None) - A column or list of columns that contain line_dash values. + line_dash: A column or list of columns that contain line_dash values. The value is used for a plot by on line_dash. See line_dash_map for additional behaviors. - width: str | list[str] | None: (Default value = None) - A column or list of columns that contain width values. + width: A column or list of columns that contain width values. The value is used for a plot by on width. See width_map for additional behaviors. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - line_dash_sequence: list[str] | None: (Default value = None) - A list of line dashes to sequentially apply to + line_dash_sequence: A list of line dashes to sequentially apply to the series. The dashes loop, so if there are more series than dashes, dashes will be reused. - line_dash_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + line_dash_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to line_dash. - symbol_sequence: list[str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. - symbol_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. If "identity", the values are taken as literal symbols. If "by" or ("by", dict) where dict is as described above, the symbols are forced to by - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. - size_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by - width_sequence: list[str] | None: (Default value = None) - A list of widths to sequentially apply to + width_sequence: A list of widths to sequentially apply to the series. The widths loop, so if there are more series than widths, widths will be reused. - width_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + width_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to width. - markers: bool: (Default value = False) - True to draw markers on the line, False to not. Default False - direction: (Default value = 'clockwise') - Which direction points are drawn. Can be 'clockwise' or + markers: True to draw markers on the line, False to not. Default False + direction: Which direction points are drawn. Can be 'clockwise' or 'counterclockwise' - start_angle: int: (Default value = 90) - Sets start angle. - line_close: bool: (Default value = False) - True draw a line between first and last point, False to not. - line_shape: str: (Default value = 'linear') - The line shape for all lines created. One of 'linear', 'spline'. - range_r: list[int] | None: (Default value = None) - A list of two numbers that specify the range of r. - range_theta: list[int] (Default value = None): (Default value = None) - A list of two numbers that specify the range of theta. - log_r: bool - A boolean that specifies if the corresponding axis is a log + start_angle: Sets start angle. + line_close: True draw a line between first and last point, False to not. + line_shape: The line shape for all lines created. One of 'linear', 'spline'. + range_r: A list of two numbers that specify the range of r. + range_theta: A list of two numbers that specify the range of theta. + log_r: A boolean that specifies if the corresponding axis is a log axis or not. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - render_mode: str (Default value = "svg") - Either "svg" or "webgl". Setting to "webgl" will lead to a more + title: The title of the chart + template: The template for the chart. + render_mode: Either "svg" or "webgl". Setting to "webgl" will lead to a more performant plot but there may be graphical bugs. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -660,104 +529,71 @@ def line_ternary( """Returns a ternary line chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - a: str | None: - A column that contains a-axis values. - b: str | None: - A column that contains b-axis values. - c: str | None: - A column that contains c-axis values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + a: A column that contains a-axis values. + b: A column that contains b-axis values. + c: A column that contains c-axis values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - line_dash: str | list[str] | None: (Default value = None) - A column or list of columns that contain line_dash values. + line_dash: A column or list of columns that contain line_dash values. The value is used for a plot by on line_dash. See line_dash_map for additional behaviors. - width: str | list[str] | None: (Default value = None) - A column or list of columns that contain width values. + width: A column or list of columns that contain width values. The value is used for a plot by on width. See width_map for additional behaviors. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - line_dash_sequence: list[str] | None: (Default value = None) - A list of line dashes to sequentially apply to + line_dash_sequence: A list of line dashes to sequentially apply to the series. The dashes loop, so if there are more series than dashes, dashes will be reused. - line_dash_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + line_dash_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to line_dash. - symbol_sequence: list[str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. - symbol_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. If "identity", the values are taken as literal symbols. If "by" or ("by", dict) where dict is as described above, the symbols are forced to by - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. - size_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by - width_sequence: list[str] | None: (Default value = None) - A list of widths to sequentially apply to + width_sequence: A list of widths to sequentially apply to the series. The widths loop, so if there are more series than widths, widths will be reused. - width_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + width_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to width. - markers: bool: (Default value = False) - True to draw markers on the line, False to not. Default False - line_shape: str: (Default value = 'linear') - The line shape for all lines created. One of 'linear', 'spline'. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + markers: True to draw markers on the line, False to not. Default False + line_shape: The line shape for all lines created. One of 'linear', 'spline'. + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/maps.py b/plugins/plotly-express/src/deephaven/plot/express/plots/maps.py index bb54a0b34..297125467 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/maps.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/maps.py @@ -10,9 +10,6 @@ from ._private_utils import process_args from ..shared import default_callback -# The functions in this file are exempt from the styleguide rule that types should not be in the description if there -# is a type annotation. - def scatter_geo( table: Table | None = None, @@ -59,93 +56,63 @@ def scatter_geo( Create a scatter_geo plot Args: - table: Table | None: (Default value = None) - A table to pull data from. - lat: str | None: (Default value = None) - A column name to use for latitude values. - lon: str | None: (Default value = None) - A column name to use for longitude values. - locations: str | None: (Default value = None) - A column name to use for location values. - locationmode: str | None: (Default value = None) - A location mode to use. + table: A table to pull data from. + lat: A column name to use for latitude values. + lon: A column name to use for longitude values. + locations: A column name to use for location values. + locationmode: A location mode to use. One of ‘ISO-3’, ‘USA-states’, or ‘country names’. These map locations to predefined geographic regions. - geojson: str | dict | None: (Default value = None) - GeoJSON data to use for geographic regions. - featureidkey: (Default value = "id") - The feature ID key to use for geographic regions. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + geojson: GeoJSON data to use for geographic regions. + featureidkey: The feature ID key to use for geographic regions. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. This is overriden if "color" is specified. - color_discrete_map: - str | tuple[str, dict[str | tuple[str], str]] - | dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. If "identity", the values are taken as literal colors. If "by" or ("by", dict) where dict is as described above, the colors are forced to by - symbol_sequence: list[str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. This is overriden if "symbol" is specified. - symbol_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. This is overriden if "size" is specified. - size_map: - str | tuple[str, dict[str | tuple[str], str]] - | dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number: (Default value = None) - A number that is the midpoint of the color axis - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - projection: str | None: (Default value = None) - The projection type to use. + projection: The projection type to use. Default depends on scope. One of 'equirectangular', 'mercator', 'orthographic', 'natural earth', 'kavrayskiy7', 'miller', 'robinson', 'eckert4', 'azimuthal equal area', @@ -153,27 +120,20 @@ def scatter_geo( 'conic equidistant', 'gnomonic', 'stereographic', 'mollweide', 'hammer', 'transverse mercator', 'albers usa', 'winkel tripel', 'aitoff', or 'sinusoidal' - scope: str | None: (Default value = None) - The scope of the map. + scope: The scope of the map. Default of 'world', but forced to 'usa' if projection is 'albers usa' One of 'world', 'usa', 'europe', 'asia', 'africa', 'north america', or 'south america' - center: dict[str, float] | None: (Default value = None) - A dictionary of center coordinates. + center: A dictionary of center coordinates. The keys should be 'lat' and 'lon' and the values should be floats that represent the lat and lon of the center of the map. - fitbounds: str: (Default value = False) - One of False, 'locations', or 'geojson' + fitbounds: One of False, 'locations', or 'geojson' If 'locations' or 'geojson', the map will zoom to the extent of the locations or geojson bounds respectively. - basemap_visible: bool | None: (Default value = None) - If True, the basemap layer is visible. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + basemap_visible: If True, the basemap layer is visible. + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -228,97 +188,66 @@ def scatter_mapbox( Create a scatter_mapbox plot Args: - table: Table | None: (Default value = None) - A table to pull data from. - lat: str | None: (Default value = None) - A column name to use for latitude values. - lon: str | None: (Default value = None) - A column name to use for longitude values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + lat: A column name to use for latitude values. + lon: A column name to use for longitude values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: - str | tuple[str, dict[str | tuple[str], str]] - | dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. If "identity", the values are taken as literal colors. If "by" or ("by", dict) where dict is as described above, the colors are forced to by - symbol_sequence: dict[str | tuple[str], str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. - symbol_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. This is overriden is "size" is specified. - size_map: - str | tuple[str, dict[str | tuple[str], str]] - | dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number | None: (Default value = None) - A number that is the midpoint of the color axis - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - zoom: float | None: (Default value = None) - The zoom level of the map. - center: dict[str, float] | None: (Default value = None) - A dictionary of center coordinates. + zoom: The zoom level of the map. + center: A dictionary of center coordinates. The keys should be 'lat' and 'lon' and the values should be floats that represent the lat and lon of the center of the map. - mapbox_style: str: (Default value = "open-street-map") - The style of the map. + mapbox_style: The style of the map. One of 'open-street-map', 'white-bg', 'carto-positron', 'carto-darkmatter', and 'stamen-terrain', 'stamen-toner', 'stamen-watercolor' - title: str: | None (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -376,102 +305,73 @@ def line_geo( Create a line_geo plot Args: - table: Table | None: (Default value = None) - A table to pull data from. - lat: str | None: (Default value = None) - A column name to use for latitude values. - lon: str | None: (Default value = None) - A column name to use for longitude values. - locations: str | None: (Default value = None) - A column name to use for location values. - locationmode: str | None: (Default value = None) - A location mode to use. + table: A table to pull data from. + lat: A column name to use for latitude values. + lon: A column name to use for longitude values. + locations: A column name to use for location values. + locationmode: A location mode to use. One of ‘ISO-3’, ‘USA-states’, or ‘country names’. These map locations to predefined geographic regions. - geojson: str | dict | None: (Default value = None) - GeoJSON data to use for geographic regions. - featureidkey: (Default value = "id") - The feature ID key to use for geographic regions. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + geojson: GeoJSON data to use for geographic regions. + featureidkey: The feature ID key to use for geographic regions. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - width: str | None: (Default value = None) - A column or list of columns that contain width values. + width: A column or list of columns that contain width values. If only one column is passed, and it contains numeric values, the value is used as a width. Otherwise, the value is used for a plot by on width. See width_map for additional behaviors. - line_dash: str | None: (Default value = None) - A column or list of columns that contain line_dash values. + line_dash: A column or list of columns that contain line_dash values. If only one column is passed, and it contains numeric values, the value is used as a line_dash. Otherwise, the value is used for a plot by on line_dash. See line_dash_map for additional behaviors. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. This is overriden if "color" is specified. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - symbol_sequence: list[str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. This is overriden if "symbol" is specified. - symbol_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than sizes, sizes will be reused. This is overriden if "size" is specified. - size_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. - width_sequence: list[str] | None: (Default value = None) - A list of widths to sequentially apply to the + width_sequence: A list of widths to sequentially apply to the markers in the series. The widths loop, so if there are more series than widths, widths will be reused. This is overriden if "width" is specified. - width_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + width_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. - line_dash_sequence: list[str] | None: (Default value = None) - A list of line_dashes to sequentially apply to the + line_dash_sequence: A list of line_dashes to sequentially apply to the markers in the series. The widths loop, so if there are more series than widths, widths will be reused. This is overriden if "line_dash" is specified. - line_dash_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + line_dash_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to line_dash. - markers: bool: (Default value = False) - If True, markers are shown. - projection: str | None: (Default value = None) - The projection type to use. + markers: If True, markers are shown. + projection: The projection type to use. Default depends on scope. One of 'equirectangular', 'mercator', 'orthographic', 'natural earth', 'kavrayskiy7', 'miller', 'robinson', 'eckert4', 'azimuthal equal area', @@ -479,27 +379,20 @@ def line_geo( 'conic equidistant', 'gnomonic', 'stereographic', 'mollweide', 'hammer', 'transverse mercator', 'albers usa', 'winkel tripel', 'aitoff', or 'sinusoidal' - scope: str | None: (Default value = None) - The scope of the map. + scope: The scope of the map. Default of 'world', but forced to 'usa' if projection is 'albers usa' One of 'world', 'usa', 'europe', 'asia', 'africa', 'north america', or 'south america' - center: dict[str, float] | None: (Default value = None) - A dictionary of center coordinates. + center: A dictionary of center coordinates. The keys should be 'lat' and 'lon' and the values should be floats that represent the lat and lon of the center of the map. - fitbounds: str: (Default value = False) - One of False, 'locations', or 'geojson' + fitbounds: One of False, 'locations', or 'geojson' If 'locations' or 'geojson', the map will zoom to the extent of the locations or geojson bounds respectively. - basemap_visible: bool | None: (Default value = None) - If True, the basemap layer is visible. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + basemap_visible: If True, the basemap layer is visible. + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -551,104 +444,75 @@ def line_mapbox( Create a line_mapbox plot Args: - table: Table | None: (Default value = None) - A table to pull data from. - lat: str | None: (Default value = None) - A column name to use for latitude values. - lon: str | None: (Default value = None) - A column name to use for longitude values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + lat: A column name to use for latitude values. + lon: A column name to use for longitude values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - width: str | list[str] | None: (Default value = None) - A column or list of columns that contain width values. + width: A column or list of columns that contain width values. If only one column is passed, and it contains numeric values, the value is used as a width. Otherwise, the value is used for a plot by on width. See width_map for additional behaviors. - line_dash: str | list[str] | None: (Default value = None) - A column or list of columns that contain line_dash values. + line_dash: A column or list of columns that contain line_dash values. If only one column is passed, and it contains numeric values, the value is used as a line_dash. Otherwise, the value is used for a plot by on line_dash. See line_dash_map for additional behaviors. - text: str | None: - A column that contains text annotations. - hover_name str | None: - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. This is overriden if "color" is specified. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - symbol_sequence: list[str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. This is overriden if "symbol" is specified. - symbol_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than sizes, sizes will be reused. This is overriden if "size" is specified. - size_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. - width_sequence: list[str]: (Default value = None) - A list of widths to sequentially apply to the + width_sequence: A list of widths to sequentially apply to the markers in the series. The widths loop, so if there are more series than widths, widths will be reused. This is overriden if "width" is specified. - width_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + width_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. - line_dash_sequence: list[str] | None: (Default value = None) - A list of line_dashes to sequentially apply to the + line_dash_sequence: A list of line_dashes to sequentially apply to the markers in the series. The widths loop, so if there are more series than widths, widths will be reused. This is overriden if "line_dash" is specified. - line_dash_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + line_dash_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to line_dash. - zoom: float | None: (Default value = None) - The zoom level of the map. - center: dict[str, float] | None: (Default value = None) - A dictionary of center coordinates. + zoom: The zoom level of the map. + center: A dictionary of center coordinates. The keys should be 'lat' and 'lon' and the values should be floats that represent the lat and lon of the center of the map. - mapbox_style: str: (Default value = "open-street-map") - The style of the map. + mapbox_style: The style of the map. One of 'open-street-map', 'white-bg', 'carto-positron', 'carto-darkmatter', and 'stamen-terrain', 'stamen-toner', 'stamen-watercolor' - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -688,45 +552,28 @@ def density_mapbox( Create a density_mapbox plot Args: - table: Table | None: (Default value = None) - A table to pull data from. - lat: str | None: (Default value = None) - A column name to use for latitude values. - lon: str | None: (Default value = None) - A column name to use for longitude values. - z: str | None: (Default value = None) - A column name to use for z values. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number | None: (Default value = None) - A number that is the midpoint of the color axis - radius: int: (Default value = 30) - The radius of each point. - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + table: A table to pull data from. + lat: A column name to use for latitude values. + lon: A column name to use for longitude values. + z: A column name to use for z values. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + radius: The radius of each point. + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - zoom: float | None: (Default value = None) - The zoom level of the map. - center: dict[str, float] | None: (Default value = None) - A dictionary of center coordinates. + zoom: The zoom level of the map. + center: A dictionary of center coordinates. The keys should be 'lat' and 'lon' and the values should be floats that represent the lat and lon of the center of the map. - mapbox_style: str: (Default value = "open-street-map") - The style of the map. + mapbox_style: The style of the map. One of 'open-street-map', 'white-bg', 'carto-positron', 'carto-darkmatter', and 'stamen-terrain', 'stamen-toner', 'stamen-watercolor' - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/pie.py b/plugins/plotly-express/src/deephaven/plot/express/plots/pie.py index 8eda0fa68..28da93d3d 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/pie.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/pie.py @@ -10,9 +10,6 @@ from ..shared import default_callback from ..deephaven_figure import DeephavenFigure -# The functions in this file are exempt from the styleguide rule that types should not be in the description if there -# is a type annotation. - def pie( table: Table | None = None, @@ -33,38 +30,25 @@ def pie( Args: - table: Table | None: (Default value = None) - A table to pull data from. - names: str | None: (Default value = None) - The column containing names of the pie slices - values: str | None: (Default value = None) - The column containing values of the pie slices - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + table: A table to pull data from. + names: The column containing names of the pie slices + values: The column containing values of the pie slices + color: A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. - hover_name: str | None: (Default value = None) - A column that contain names to bold in the hover tooltip.. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + hover_name: A column that contain names to bold in the hover tooltip.. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: dict[str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + title: The title of the chart + template: The template for the chart. + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - hole: float | None: (Default value = None) - Fraction of the radius to cut out of the center of the pie. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + hole: Fraction of the radius to cut out of the center of the pie. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/scatter.py b/plugins/plotly-express/src/deephaven/plot/express/plots/scatter.py index c2fa9e87b..71e20f44f 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/scatter.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/scatter.py @@ -11,9 +11,6 @@ from ..shared import default_callback from ..deephaven_figure import DeephavenFigure -# The functions in this file are exempt from the styleguide rule that types should not be in the description if there -# is a type annotation. - def scatter( table: Table | None = None, @@ -68,155 +65,110 @@ def scatter( """Returns a scatter chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | list[str] | None: (Default value = None) - A column or list of columns that contain x-axis values. - y: str | list[str] | None: (Default value = None) - A column or list of columns that contain y-axis values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + x: A column or list of columns that contain x-axis values. + y: A column or list of columns that contain y-axis values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - error_x: str | None: (Default value = None) - A column with x error bar values. + error_x: A column with x error bar values. These form the error bars in both the positive and negative direction if error_x_minus is not specified, and the error bars in only the positive direction if error_x_minus is specified. None can be used to specify no error bars on the corresponding series. - error_x_minus: str | None: (Default value = None) - A column with x error bar values. + error_x_minus: A column with x error bar values. These form the error bars in the negative direction, and are ignored if error_x is not specified. - error_y: str | None: (Default value = None) - A column with x error bar values. + error_y: A column with x error bar values. These form the error bars in both the positive and negative direction if error_y_minus is not specified, and the error bars in only the positive direction if error_y_minus is specified. None can be used to specify no error bars on the corresponding series. - error_y_minus: str | None: (Default value = None) - A column with y error bar values. + error_y_minus: A column with y error bar values. These form the error bars in the negative direction, and are ignored if error_y is not specified. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. If "identity", the values are taken as literal colors. If "by" or ("by", dict) where dict is as described above, the colors are forced to by - symbol_sequence: list[str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. - symbol_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. If "identity", the values are taken as literal symbols. If "by" or ("by", dict) where dict is as described above, the symbols are forced to by - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. This is overriden is "size" is specified. - size_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by - xaxis_sequence: list[str] | None: (Default value = None) - A list of x axes to assign series to. Odd numbers + xaxis_sequence: A list of x axes to assign series to. Odd numbers starting with 1 are created on the bottom x axis and even numbers starting with 2 are created on the top x axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. - yaxis_sequence: list[str] | None: (Default value = None) - A list of y axes to assign series to. Odd numbers + yaxis_sequence: A list of y axes to assign series to. Odd numbers starting with 1 are created on the left y axis and even numbers starting with 2 are created on the top y axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number | None: (Default value = None) - A number that is the midpoint of the color axis - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - marginal_x: str | None: (Default value = None) - The type of x-axis marginal; histogram, violin, rug, box - marginal_y: str | None: (Default value = None) - The type of y-axis marginal; histogram, violin, rug, box - log_x: bool | list[bool]: (Default value = False) - A boolean or list of booleans that specify if + marginal_x: The type of x-axis marginal; histogram, violin, rug, box + marginal_y: The type of y-axis marginal; histogram, violin, rug, box + log_x: A boolean or list of booleans that specify if the corresponding axis is a log axis or not. The booleans loop, so if there are more series than booleans, booleans will be reused. - log_y: bool | list[bool]: (Default value = False) - A boolean or list of booleans that specify if + log_y: A boolean or list of booleans that specify if the corresponding axis is a log axis or not. The booleans loop, so if there are more series than booleans, booleans will be reused. - range_x: list[int] | list[list[int]] | None: (Default value = None) - A list of two numbers or a list of lists of two numbers + range_x: A list of two numbers or a list of lists of two numbers that specify the range of the x axes. None can be specified for no range The ranges loop, so if there are more axes than ranges, ranges will be reused. - range_y: list[int] | list[list[int]] | None: (Default value = None) - A list of two numbers or a list of lists of two numbers + range_y: A list of two numbers or a list of lists of two numbers that specify the range of the y axes. None can be specified for no range The ranges loop, so if there are more axes than ranges, ranges will be reused. - yaxis_titles: list[str] | None: (Default value = None) - A list of titles to sequentially apply to the y axes. The titles do not + yaxis_titles: A list of titles to sequentially apply to the y axes. The titles do not loop. - xaxis_titles: list[str] | None: (Default value = None) - A list of titles to sequentially apply to the x axes. The titles do not + xaxis_titles: A list of titles to sequentially apply to the x axes. The titles do not loop. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - render_mode: str (Default value = "webgl") - Either "svg" or "webgl". The default is "webgl" as it leads to a more + title: The title of the chart + template: The template for the chart. + render_mode: Either "svg" or "webgl". The default is "webgl" as it leads to a more performant plot but there may be graphical bugs, in which case it is recommended to switch to "svg" - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -285,135 +237,92 @@ def scatter_3d( """Returns a 3D scatter chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - x: str | None: (Default value = None) - A column that contains x-axis values. - y: str | None: (Default value = None) - A column that contains y-axis values. - z: str | None: (Default value = None) - A column that contains z-axis values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + x: A column that contains x-axis values. + y: A column that contains y-axis values. + z: A column that contains z-axis values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - error_x: str | None: (Default value = None) - A column with x error bar values. These form the error + error_x: A column with x error bar values. These form the error bars in both the positive and negative direction if error_x_minus is not specified, and the error bars in only the positive direction if error_x_minus is specified. - error_x_minus: str | None: (Default value = None) - A column with x error bar values. These form + error_x_minus: A column with x error bar values. These form the error bars in the negative direction, and are ignored if error_x is not specified. - error_y: str | None: (Default value = None) - A column with y error bar values. These form the error + error_y: A column with y error bar values. These form the error bars in both the positive and negative direction if error_y_minus is not specified, and the error bars in only the positive direction if error_y_minus is specified. - error_y_minus: str | None: (Default value = None) - A column with y error bar values. These form + error_y_minus: A column with y error bar values. These form the error bars in the negative direction, and are ignored if error_y is not specified. - error_z: str | None: (Default value = None) - A column with z error bar values. These form the error + error_z: A column with z error bar values. These form the error bars in both the positive and negative direction if error_z_minus is not specified, and the error bars in only the positive direction if error_z_minus is specified. - error_z_minus: str | None: (Default value = None) - A column with z error bar values. These form + error_z_minus: A column with z error bar values. These form the error bars in the negative direction, and are ignored if error_z is not specified. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. If "identity", the values are taken as literal colors. If "by" or ("by", dict) where dict is as described above, the colors are forced to by - symbol_sequence: list[str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. - symbol_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. If "identity", the values are taken as literal symbols. If "by" or ("by", dict) where dict is as described above, the symbols are forced to by - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. This is overriden is "size" is specified. - size_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number | None: (Default value = None) - A number that is the midpoint of the color axis - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - log_x: bool: (Default value = False) - A boolean that specifies if the corresponding axis is a log + log_x: A boolean that specifies if the corresponding axis is a log axis or not. - log_y: bool: (Default value = False) - A boolean that specifies if the corresponding axis is a log + log_y: A boolean that specifies if the corresponding axis is a log axis or not. - log_z: bool: (Default value = False) - A boolean that specifies if the corresponding axis is a log + log_z: A boolean that specifies if the corresponding axis is a log axis or not. - range_x: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the x axis. - range_y: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the y axis. - range_z: list[int] | None: (Default value = None) - A list of two numbers that specify the range of the z axis. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + range_x: A list of two numbers that specify the range of the x axis. + range_y: A list of two numbers that specify the range of the y axis. + range_z: A list of two numbers that specify the range of the z axis. + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -474,107 +383,71 @@ def scatter_polar( """Returns a polar scatter chart Args: - table: Table | None: (Default value = None) - A table to pull data from. - r: str | None: (Default value = None) - A column that contains r values. - theta: str | None: (Default value = None) - A column that contains theta values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + r: A column that contains r values. + theta: A column that contains theta values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence: list[str] | None: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. If "identity", the values are taken as literal colors. If "by" or ("by", dict) where dict is as described above, the colors are forced to by - symbol_sequence: list[str] | None: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. - symbol_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. If "identity", the values are taken as literal symbols. If "by" or ("by", dict) where dict is as described above, the symbols are forced to by - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. This is overriden is "size" is specified. - size_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number | None: (Default value = None) - A number that is the midpoint of the color axis - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - direction: (Default value = 'clockwise') - Which direction points are drawn. Can be 'clockwise' or + direction: Which direction points are drawn. Can be 'clockwise' or 'counterclockwise' - start_angle: int: (Default value = 90) - Sets start angle. - range_r: list[int] | None: (Default value = None) - A list of two numbers that specify the range of r. - range_theta: list[int] | None: (Default value = None) - A list of two numbers that specify the range of theta. - log_r: bool - A boolean that specifies if the corresponding axis is a log + start_angle: Sets start angle. + range_r: A list of two numbers that specify the range of r. + range_theta: A list of two numbers that specify the range of theta. + log_r: A boolean that specifies if the corresponding axis is a log axis or not. - title: str | None:: (Default value = None) - The title of the chart - template: str | None:: (Default value = None) - The template for the chart. - render_mode: str (Default value = "webgl") - Either "svg" or "webgl". The default is "webgl" as it leads to a more + title: The title of the chart + template: The template for the chart. + render_mode: Either "svg" or "webgl". The default is "webgl" as it leads to a more performant plot but there may be graphical bugs, in which case it is recommended to switch to "svg" - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. @@ -630,93 +503,62 @@ def scatter_ternary( """Returns a ternary scatter chart Args: - table: Table | None:: (Default value = None) - A table to pull data from. - a: str | None: (Default value = None) - A column that contains a-axis values. - b: str | None: (Default value = None) - A column that contains b-axis values. - c: str | None: (Default value = None) - A column that contains c-axis values. - by: str | list[str] | None: (Default value = None) - A column or list of columns that contain values to plot the figure traces by. + table: A table to pull data from. + a: A column that contains a-axis values. + b: A column that contains b-axis values. + c: A column that contains c-axis values. + by: A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified - by_vars: str | list[str]: (Default value = "color") - A string or list of string that contain design elements to plot by. + by_vars: A string or list of string that contain design elements to plot by. Can contain size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. - color: str | list[str] | None:: (Default value = None) - A column or list of columns that contain color values. + color: A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. - symbol: str | list[str] | None: (Default value = None) - A column or list of columns that contain symbol values. + symbol: A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. - size: str | list[str] | None: (Default value = None) - A column or list of columns that contain size values. + size: A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. - text: str | None: (Default value = None) - A column that contains text annotations. - hover_name: str | None: (Default value = None) - A column that contains names to bold in the hover tooltip. - labels: dict[str, str] | None: (Default value = None) - A dictionary of labels mapping columns to new labels. - color_discrete_sequence | None: list[str]: (Default value = None) - A list of colors to sequentially apply to + text: A column that contains text annotations. + hover_name: A column that contains names to bold in the hover tooltip. + labels: A dictionary of labels mapping columns to new labels. + color_discrete_sequence: A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. - color_discrete_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + color_discrete_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. If "identity", the values are taken as literal colors. If "by" or ("by", dict) where dict is as described above, the colors are forced to by - symbol_sequence: list[str] | None:: (Default value = None) - A list of symbols to sequentially apply to the + symbol_sequence: A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. - symbol_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + symbol_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to symbols. If "identity", the values are taken as literal symbols. If "by" or ("by", dict) where dict is as described above, the symbols are forced to by - size_sequence: list[str] | None: (Default value = None) - A list of sizes to sequentially apply to the + size_sequence: A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. This is overriden is "size" is specified. - size_map: - str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | dict[ - str | tuple[str], str] | None: (Default value = None) - If dict, the keys should be strings of the column values (or a tuple + size_map: If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by - color_continuous_scale: list[str] | None: (Default value = None) - A list of colors for a continuous scale - range_color: list[Number] | None: (Default value = None) - A list of two numbers that form the endpoints of the color axis - color_continuous_midpoint: Number | None: (Default value = None) - A number that is the midpoint of the color axis - opacity: float | None: (Default value = None) - Opacity to apply to all markers. 0 is completely transparent + color_continuous_scale: A list of colors for a continuous scale + range_color: A list of two numbers that form the endpoints of the color axis + color_continuous_midpoint: A number that is the midpoint of the color axis + opacity: Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. - title: str | None: (Default value = None) - The title of the chart - template: str | None: (Default value = None) - The template for the chart. - unsafe_update_figure: Callable: (Default value = default_callback) - An update function that takes a plotly figure + title: The title of the chart + template: The template for the chart. + unsafe_update_figure: An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/subplots.py b/plugins/plotly-express/src/deephaven/plot/express/plots/subplots.py index 1d613ae7a..d08014951 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/subplots.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/subplots.py @@ -8,9 +8,6 @@ from ._layer import layer, LayerSpecDict from .. import DeephavenFigure -# The function make_subplots in this file is exempt from the styleguide rule that types should not be in the -# description if there is a type annotation. - # generic grid that is a list of lists of anything T = TypeVar("T") Grid = List[List[T]] @@ -227,37 +224,26 @@ def make_subplots( should be passed. Args: - *figs: Figure | DeephavenFigure - Figures to use. Should be used with rows and/or cols. - rows: int | None: (Default value = None) - A list of rows in the resulting subplot grid. This is + *figs: Figures to use. Should be used with rows and/or cols. + rows: A list of rows in the resulting subplot grid. This is calculated from cols and number of figs provided if not passed but cols is. One of rows or cols should be provided if passing figs directly. - cols: int | None: (Default value = None) - A list of cols in the resulting subplot grid. This is + cols: A list of cols in the resulting subplot grid. This is calculated from rows and number of figs provided if not passed but rows is. One of rows or cols should be provided if passing figs directly. - shared_xaxes: str | bool | None: (Default value = None) - "rows", "cols"/True, "all" or None depending on what axes + shared_xaxes: "rows", "cols"/True, "all" or None depending on what axes should be shared - shared_yaxes: str | bool | None: (Default value = None) - "rows"/True, "cols", "all" or None depending on what axes + shared_yaxes: "rows"/True, "cols", "all" or None depending on what axes should be shared - grid: list[list[Figure | DeephavenFigure]] | None: (Default value = None) - A grid (list of lists) of figures to draw. None can be + grid: A grid (list of lists) of figures to draw. None can be provided in a grid entry - horizontal_spacing: float | None: (Default value = None) - Spacing between each column. Default 0.2 / cols - vertical_spacing: float | None: (Default value = None) - Spacing between each row. Default 0.3 / rows - column_widths: list[float]: (Default value = None) - The widths of each column. Should sum to 1. - row_heights: list[float] | None: (Default value = None) - The heights of each row. Should sum to 1. - specs: list[SubplotSpecDict] | Grid[SubplotSpecDict] | None: - (Default value = None) + horizontal_spacing: Spacing between each column. Default 0.2 / cols + vertical_spacing: Spacing between each row. Default 0.3 / rows + column_widths: The widths of each column. Should sum to 1. + row_heights: The heights of each row. Should sum to 1. + specs: (Default value = None) A list or grid of dicts that contain specs. An empty dictionary represents no specs, and None represents no figure, either to leave a gap on the subplots on provide room for a figure spanning From 5735edce12441636dfddbb71bc0ff1a3843afebf Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Wed, 5 Jun 2024 17:28:58 -0500 Subject: [PATCH 02/11] wip --- plugins/plotly-express/README.md | 16 ++++++++++++++++ plugins/plotly-express/docs/README.md | 6 ------ plugins/plotly-express/docs/conf.py | 13 +++---------- plugins/plotly-express/docs/deephaven_figure.rst | 4 ++++ plugins/plotly-express/docs/index.rst | 6 ++++++ plugins/plotly-express/docs/post_make.py | 5 +++++ plugins/plotly-express/docs/requirements.txt | 4 ++++ 7 files changed, 38 insertions(+), 16 deletions(-) create mode 100644 plugins/plotly-express/docs/deephaven_figure.rst create mode 100644 plugins/plotly-express/docs/index.rst create mode 100644 plugins/plotly-express/docs/post_make.py create mode 100644 plugins/plotly-express/docs/requirements.txt diff --git a/plugins/plotly-express/README.md b/plugins/plotly-express/README.md index 6efae57fb..e4d923c1c 100644 --- a/plugins/plotly-express/README.md +++ b/plugins/plotly-express/README.md @@ -54,3 +54,19 @@ source = new_table( fig = dx.bar(table=source, x="Categories", y="Values") ``` + +## Docs +Docs can be built locally from the docs folder. + +Install the necessary dependencies: +```shell +pip install -r requirements.txt +pip install ../dist/deephaven_plugin_plotly_express-*.whl +``` +then run the docs make and post make commands: +```shell +make markdown +python post_make.py +``` + +Note that these built files should not be committed to the repository. \ No newline at end of file diff --git a/plugins/plotly-express/docs/README.md b/plugins/plotly-express/docs/README.md index 6a96f0b01..cf2941ea5 100644 --- a/plugins/plotly-express/docs/README.md +++ b/plugins/plotly-express/docs/README.md @@ -94,9 +94,3 @@ Deephaven's Plotly Express plugin is licensed under the [Apache License 2.0](htt ## Acknowledgments We would like to express our gratitude to the Plotly and the Plotly Express team for creating a remarkable plotting library and making it open-source. Their work forms the foundation of the Deephaven Plotly Express plugin. - -```{toctree} -:maxdepth: 3 -:glob: -* -``` \ No newline at end of file diff --git a/plugins/plotly-express/docs/conf.py b/plugins/plotly-express/docs/conf.py index 43f4be772..72ad63a69 100644 --- a/plugins/plotly-express/docs/conf.py +++ b/plugins/plotly-express/docs/conf.py @@ -18,16 +18,15 @@ extensions = [ "myst_parser", - "sphinx_markdown_builder", "sphinx.ext.autodoc", "sphinx.ext.napoleon", + "sphinx_markdown_builder", ] -python_maximum_signature_line_length = 20 - source_suffix = [".rst", ".md"] # Can use either rst or markdown files as input -root_doc = "README" +# show hints in the description so that the function definition is not cluttered +autodoc_typehints = "description" suppress_warnings = ["myst.header"] @@ -38,9 +37,3 @@ s = Server(port=10075) s.start() - -# Sphinx - need py 3.9 for latest versions for python_maximum_signature_line_length -# myst-parser -# sphinx-markdown-builder -# deephaven-server -# dx wheel diff --git a/plugins/plotly-express/docs/deephaven_figure.rst b/plugins/plotly-express/docs/deephaven_figure.rst new file mode 100644 index 000000000..ddc058240 --- /dev/null +++ b/plugins/plotly-express/docs/deephaven_figure.rst @@ -0,0 +1,4 @@ + +.. autoclass:: deephaven.plot.express.DeephavenFigure + :members: + :inherited-members: \ No newline at end of file diff --git a/plugins/plotly-express/docs/index.rst b/plugins/plotly-express/docs/index.rst new file mode 100644 index 000000000..db58152d3 --- /dev/null +++ b/plugins/plotly-express/docs/index.rst @@ -0,0 +1,6 @@ + +.. toctree:: + :maxdepth: 2 + :glob: + + * diff --git a/plugins/plotly-express/docs/post_make.py b/plugins/plotly-express/docs/post_make.py new file mode 100644 index 000000000..916269f3a --- /dev/null +++ b/plugins/plotly-express/docs/post_make.py @@ -0,0 +1,5 @@ +import os + +os.system("cp -r _assets build/markdown/_assets") + +# bug 1: in translator.py, set literal_emphasis to None diff --git a/plugins/plotly-express/docs/requirements.txt b/plugins/plotly-express/docs/requirements.txt new file mode 100644 index 000000000..8b2344281 --- /dev/null +++ b/plugins/plotly-express/docs/requirements.txt @@ -0,0 +1,4 @@ +deephaven-server +Sphinx +myst_parser +sphinx_markdown_builder \ No newline at end of file From 18416e2c29549304829cd7899682d2403940292f Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Thu, 6 Jun 2024 10:03:59 -0500 Subject: [PATCH 03/11] wip --- plugins/plotly-express/docs/conf.py | 5 +++++ plugins/plotly-express/docs/deephaven_figure.rst | 4 ---- plugins/plotly-express/docs/post_make.py | 16 +++++++++++++++- plugins/plotly-express/docs/requirements.txt | 2 +- .../src/deephaven/plot/express/plots/bar.py | 4 ++-- .../deephaven/plot/express/plots/hierarchial.py | 8 ++++---- .../src/deephaven/plot/express/plots/maps.py | 11 ++++++----- 7 files changed, 33 insertions(+), 17 deletions(-) delete mode 100644 plugins/plotly-express/docs/deephaven_figure.rst diff --git a/plugins/plotly-express/docs/conf.py b/plugins/plotly-express/docs/conf.py index 72ad63a69..2715ee15e 100644 --- a/plugins/plotly-express/docs/conf.py +++ b/plugins/plotly-express/docs/conf.py @@ -16,6 +16,11 @@ # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration +# monkey patch to remove literal_emphasis rendering - it doesn't work well with type hints +from sphinx_markdown_builder.translator import PREDEFINED_ELEMENTS + +PREDEFINED_ELEMENTS["literal_emphasis"] = None + extensions = [ "myst_parser", "sphinx.ext.autodoc", diff --git a/plugins/plotly-express/docs/deephaven_figure.rst b/plugins/plotly-express/docs/deephaven_figure.rst deleted file mode 100644 index ddc058240..000000000 --- a/plugins/plotly-express/docs/deephaven_figure.rst +++ /dev/null @@ -1,4 +0,0 @@ - -.. autoclass:: deephaven.plot.express.DeephavenFigure - :members: - :inherited-members: \ No newline at end of file diff --git a/plugins/plotly-express/docs/post_make.py b/plugins/plotly-express/docs/post_make.py index 916269f3a..d12cf72c8 100644 --- a/plugins/plotly-express/docs/post_make.py +++ b/plugins/plotly-express/docs/post_make.py @@ -2,4 +2,18 @@ os.system("cp -r _assets build/markdown/_assets") -# bug 1: in translator.py, set literal_emphasis to None +# remove the index.md +os.system("rm build/markdown/index.md") + +# go through each markdown file, look for ### deephaven.plot.express then excape any < characters +# this ensures function default values are shown +for root, dirs, files in os.walk("build/markdown"): + for file in files: + if file.endswith(".md"): + with open(os.path.join(root, file), "r") as f: + lines = f.readlines() + with open(os.path.join(root, file), "w") as f: + for line in lines: + if "### deephaven.plot.express" in line: + line = line.replace("<", "\\<") + f.write(line) diff --git a/plugins/plotly-express/docs/requirements.txt b/plugins/plotly-express/docs/requirements.txt index 8b2344281..f4dd7dc57 100644 --- a/plugins/plotly-express/docs/requirements.txt +++ b/plugins/plotly-express/docs/requirements.txt @@ -1,4 +1,4 @@ deephaven-server Sphinx myst_parser -sphinx_markdown_builder \ No newline at end of file +sphinx_markdown_builder==0.6.6 \ No newline at end of file diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/bar.py b/plugins/plotly-express/src/deephaven/plot/express/plots/bar.py index ca03cd7e7..372763d9e 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/bar.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/bar.py @@ -229,7 +229,7 @@ def timeline( title: str | None = None, template: str | None = None, unsafe_update_figure: Callable = default_callback, -): +) -> DeephavenFigure: """Returns a timeline (otherwise known as a gantt chart) Args: @@ -325,7 +325,7 @@ def frequency_bar( title: str | None = None, template: str | None = None, unsafe_update_figure: Callable = default_callback, -): +) -> DeephavenFigure: """Returns a bar chart that contains the counts of the specified columns Args: diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/hierarchial.py b/plugins/plotly-express/src/deephaven/plot/express/plots/hierarchial.py index 89bfe04d3..ce6295695 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/hierarchial.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/hierarchial.py @@ -31,7 +31,7 @@ def treemap( branchvalues: str | None = None, maxdepth: int | None = None, unsafe_update_figure: Callable = default_callback, -): +) -> DeephavenFigure: """Returns a treemap chart Args: @@ -99,7 +99,7 @@ def sunburst( branchvalues: str | None = None, maxdepth: int | None = None, unsafe_update_figure: Callable = default_callback, -): +) -> DeephavenFigure: """Returns a sunburst chart Args: @@ -167,7 +167,7 @@ def icicle( branchvalues: str | None = None, maxdepth: int | None = None, unsafe_update_figure: Callable = default_callback, -): +) -> DeephavenFigure: """Returns a icicle chart Args: @@ -306,7 +306,7 @@ def funnel_area( template: str | None = None, opacity: float | None = None, unsafe_update_figure: Callable = default_callback, -): +) -> DeephavenFigure: """Returns a funnel area chart Args: diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/maps.py b/plugins/plotly-express/src/deephaven/plot/express/plots/maps.py index 297125467..61af14358 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/maps.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/maps.py @@ -9,6 +9,7 @@ from ._private_utils import process_args from ..shared import default_callback +from ..deephaven_figure import DeephavenFigure def scatter_geo( @@ -51,7 +52,7 @@ def scatter_geo( title: str | None = None, template: str | None = None, unsafe_update_figure: Callable = default_callback, -): +) -> DeephavenFigure: """ Create a scatter_geo plot @@ -183,7 +184,7 @@ def scatter_mapbox( title: str | None = None, template: str | None = None, unsafe_update_figure: Callable = default_callback, -): +) -> DeephavenFigure: """ Create a scatter_mapbox plot @@ -300,7 +301,7 @@ def line_geo( title: str | None = None, template: str | None = None, unsafe_update_figure: Callable = default_callback, -): +) -> DeephavenFigure: """ Create a line_geo plot @@ -439,7 +440,7 @@ def line_mapbox( title: str | None = None, template: str | None = None, unsafe_update_figure: Callable = default_callback, -): +) -> DeephavenFigure: """ Create a line_mapbox plot @@ -547,7 +548,7 @@ def density_mapbox( title: str | None = None, template: str | None = None, unsafe_update_figure: Callable = default_callback, -): +) -> DeephavenFigure: """ Create a density_mapbox plot From 8dd33863efc8152532b6a2a91b56ef48c34ccd68 Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Thu, 6 Jun 2024 10:50:54 -0500 Subject: [PATCH 04/11] wip --- plugins/plotly-express/README.md | 5 ++--- plugins/plotly-express/docs/conf.py | 2 -- .../plotly-express/docs/{post_make.py => make_docs.py} | 10 ++++++++-- 3 files changed, 10 insertions(+), 7 deletions(-) rename plugins/plotly-express/docs/{post_make.py => make_docs.py} (77%) diff --git a/plugins/plotly-express/README.md b/plugins/plotly-express/README.md index e4d923c1c..321499e7f 100644 --- a/plugins/plotly-express/README.md +++ b/plugins/plotly-express/README.md @@ -63,10 +63,9 @@ Install the necessary dependencies: pip install -r requirements.txt pip install ../dist/deephaven_plugin_plotly_express-*.whl ``` -then run the docs make and post make commands: +then run the docs make script: ```shell -make markdown -python post_make.py +python make_docs.py ``` Note that these built files should not be committed to the repository. \ No newline at end of file diff --git a/plugins/plotly-express/docs/conf.py b/plugins/plotly-express/docs/conf.py index 2715ee15e..a6109b443 100644 --- a/plugins/plotly-express/docs/conf.py +++ b/plugins/plotly-express/docs/conf.py @@ -33,8 +33,6 @@ # show hints in the description so that the function definition is not cluttered autodoc_typehints = "description" -suppress_warnings = ["myst.header"] - # exclude build directory exclude_patterns = ["build", "Thumbs.db", ".DS_Store"] diff --git a/plugins/plotly-express/docs/post_make.py b/plugins/plotly-express/docs/make_docs.py similarity index 77% rename from plugins/plotly-express/docs/post_make.py rename to plugins/plotly-express/docs/make_docs.py index d12cf72c8..b32da7433 100644 --- a/plugins/plotly-express/docs/post_make.py +++ b/plugins/plotly-express/docs/make_docs.py @@ -1,11 +1,17 @@ import os +os.system("make clean") + +print("Building markdown") +os.system("make markdown") + +print("Copying assets") os.system("cp -r _assets build/markdown/_assets") +os.system("cp sidebar.json build/markdown/sidebar.json") -# remove the index.md os.system("rm build/markdown/index.md") -# go through each markdown file, look for ### deephaven.plot.express then excape any < characters +# go through each markdown file, look for ### deephaven.plot.express then escape any < characters # this ensures function default values are shown for root, dirs, files in os.walk("build/markdown"): for file in files: From 7353a83dee28b12510209ad8572547d7a9859b23 Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Thu, 6 Jun 2024 15:45:32 -0500 Subject: [PATCH 05/11] comments --- plugins/plotly-express/{docs => }/Makefile | 6 ++-- plugins/plotly-express/README.md | 4 +-- plugins/plotly-express/{docs => }/conf.py | 0 plugins/plotly-express/docs/make_docs.py | 25 --------------- plugins/plotly-express/{docs => }/make.bat | 4 +-- plugins/plotly-express/make_docs.py | 32 +++++++++++++++++++ .../{docs => }/requirements.txt | 0 7 files changed, 39 insertions(+), 32 deletions(-) rename plugins/plotly-express/{docs => }/Makefile (89%) rename plugins/plotly-express/{docs => }/conf.py (100%) delete mode 100644 plugins/plotly-express/docs/make_docs.py rename plugins/plotly-express/{docs => }/make.bat (90%) create mode 100644 plugins/plotly-express/make_docs.py rename plugins/plotly-express/{docs => }/requirements.txt (100%) diff --git a/plugins/plotly-express/docs/Makefile b/plugins/plotly-express/Makefile similarity index 89% rename from plugins/plotly-express/docs/Makefile rename to plugins/plotly-express/Makefile index ed8809902..e3c274ced 100644 --- a/plugins/plotly-express/docs/Makefile +++ b/plugins/plotly-express/Makefile @@ -3,10 +3,10 @@ # You can set these variables from the command line, and also # from the environment for the first two. -SPHINXOPTS ?= +SPHINXOPTS ?= -c . SPHINXBUILD ?= sphinx-build -SOURCEDIR = . -BUILDDIR = build +SOURCEDIR = docs +BUILDDIR = docs/build # Put it first so that "make" without argument is like "make help". help: diff --git a/plugins/plotly-express/README.md b/plugins/plotly-express/README.md index 321499e7f..dfdf134ab 100644 --- a/plugins/plotly-express/README.md +++ b/plugins/plotly-express/README.md @@ -56,12 +56,12 @@ fig = dx.bar(table=source, x="Categories", y="Values") ``` ## Docs -Docs can be built locally from the docs folder. +Docs can be built locally Install the necessary dependencies: ```shell pip install -r requirements.txt -pip install ../dist/deephaven_plugin_plotly_express-*.whl +pip install dist/deephaven_plugin_plotly_express-*.whl ``` then run the docs make script: ```shell diff --git a/plugins/plotly-express/docs/conf.py b/plugins/plotly-express/conf.py similarity index 100% rename from plugins/plotly-express/docs/conf.py rename to plugins/plotly-express/conf.py diff --git a/plugins/plotly-express/docs/make_docs.py b/plugins/plotly-express/docs/make_docs.py deleted file mode 100644 index b32da7433..000000000 --- a/plugins/plotly-express/docs/make_docs.py +++ /dev/null @@ -1,25 +0,0 @@ -import os - -os.system("make clean") - -print("Building markdown") -os.system("make markdown") - -print("Copying assets") -os.system("cp -r _assets build/markdown/_assets") -os.system("cp sidebar.json build/markdown/sidebar.json") - -os.system("rm build/markdown/index.md") - -# go through each markdown file, look for ### deephaven.plot.express then escape any < characters -# this ensures function default values are shown -for root, dirs, files in os.walk("build/markdown"): - for file in files: - if file.endswith(".md"): - with open(os.path.join(root, file), "r") as f: - lines = f.readlines() - with open(os.path.join(root, file), "w") as f: - for line in lines: - if "### deephaven.plot.express" in line: - line = line.replace("<", "\\<") - f.write(line) diff --git a/plugins/plotly-express/docs/make.bat b/plugins/plotly-express/make.bat similarity index 90% rename from plugins/plotly-express/docs/make.bat rename to plugins/plotly-express/make.bat index 8f56bebd6..472b6f930 100644 --- a/plugins/plotly-express/docs/make.bat +++ b/plugins/plotly-express/make.bat @@ -7,8 +7,8 @@ REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) -set SOURCEDIR=. -set BUILDDIR=build +set SOURCEDIR=docs +set BUILDDIR=docs/build %SPHINXBUILD% >NUL 2>NUL if errorlevel 9009 ( diff --git a/plugins/plotly-express/make_docs.py b/plugins/plotly-express/make_docs.py new file mode 100644 index 000000000..d0a02b3d3 --- /dev/null +++ b/plugins/plotly-express/make_docs.py @@ -0,0 +1,32 @@ +import os + +BUILT_DOCS = "docs/build/markdown" + +os.system("make clean") + +print("Building markdown") +os.system("make markdown") + +print("Copying assets") +os.system(f"cp -r docs/_assets {BUILT_DOCS}/_assets") +os.system(f"cp docs/sidebar.json {BUILT_DOCS}/sidebar.json") + +os.system(f"rm {BUILT_DOCS}/index.md") + +# go through each markdown file, look for ### deephaven.plot.express then escape any < characters +# this ensures function default values are shown +for root, dirs, files in os.walk(BUILT_DOCS): + for file in files: + if file.endswith(".md"): + with open(os.path.join(root, file), "r") as f: + lines = f.readlines() + with open(os.path.join(root, file), "w") as f: + for line in lines: + if "### deephaven.plot.express." in line: + # first add the lines here + line = line.replace("### deephaven.plot.express.", "") + before = "\n\n```python\n" + after = "```\n\n\n" + line = before + line + after + # then here + f.write(line) diff --git a/plugins/plotly-express/docs/requirements.txt b/plugins/plotly-express/requirements.txt similarity index 100% rename from plugins/plotly-express/docs/requirements.txt rename to plugins/plotly-express/requirements.txt From 671232dd31cb55b92be21e3b8487096dcb23ff3f Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Thu, 6 Jun 2024 16:59:16 -0500 Subject: [PATCH 06/11] wip --- plugins/plotly-express/make_docs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/plotly-express/make_docs.py b/plugins/plotly-express/make_docs.py index d0a02b3d3..5b31339ec 100644 --- a/plugins/plotly-express/make_docs.py +++ b/plugins/plotly-express/make_docs.py @@ -23,6 +23,8 @@ with open(os.path.join(root, file), "w") as f: for line in lines: if "### deephaven.plot.express." in line: + # remove escaped \* with * as it's not needed when in a code block + line = line.replace("\\*", "*") # first add the lines here line = line.replace("### deephaven.plot.express.", "") before = "\n\n```python\n" From df065a87475a54702dcdc71872445141d7ecca76 Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Thu, 6 Jun 2024 17:37:03 -0500 Subject: [PATCH 07/11] remove hack --- plugins/plotly-express/conf.py | 6 +----- plugins/plotly-express/requirements.txt | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/plotly-express/conf.py b/plugins/plotly-express/conf.py index a6109b443..43c999a6b 100644 --- a/plugins/plotly-express/conf.py +++ b/plugins/plotly-express/conf.py @@ -16,16 +16,12 @@ # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration -# monkey patch to remove literal_emphasis rendering - it doesn't work well with type hints -from sphinx_markdown_builder.translator import PREDEFINED_ELEMENTS - -PREDEFINED_ELEMENTS["literal_emphasis"] = None - extensions = [ "myst_parser", "sphinx.ext.autodoc", "sphinx.ext.napoleon", "sphinx_markdown_builder", + "sphinx_autodoc_typehints", ] source_suffix = [".rst", ".md"] # Can use either rst or markdown files as input diff --git a/plugins/plotly-express/requirements.txt b/plugins/plotly-express/requirements.txt index f4dd7dc57..3fe548cb5 100644 --- a/plugins/plotly-express/requirements.txt +++ b/plugins/plotly-express/requirements.txt @@ -1,4 +1,5 @@ deephaven-server Sphinx myst_parser -sphinx_markdown_builder==0.6.6 \ No newline at end of file +sphinx_markdown_builder +sphinx-autodoc-typehints \ No newline at end of file From 97ee97fccc4fb7392aed83c5dd99be78a4281512 Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Thu, 6 Jun 2024 17:45:22 -0500 Subject: [PATCH 08/11] wip --- plugins/plotly-express/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/plotly-express/conf.py b/plugins/plotly-express/conf.py index 43c999a6b..60aa3a664 100644 --- a/plugins/plotly-express/conf.py +++ b/plugins/plotly-express/conf.py @@ -32,6 +32,9 @@ # exclude build directory exclude_patterns = ["build", "Thumbs.db", ".DS_Store"] +# options for sphinx_autodoc_typehints +always_use_bars_union = True + from deephaven_server import Server s = Server(port=10075) From 9b2655bce9f42255a402679343e7f90b0968ff9d Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Fri, 7 Jun 2024 13:27:35 -0500 Subject: [PATCH 09/11] comment --- plugins/plotly-express/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/plotly-express/README.md b/plugins/plotly-express/README.md index dfdf134ab..8bfca30d0 100644 --- a/plugins/plotly-express/README.md +++ b/plugins/plotly-express/README.md @@ -68,4 +68,5 @@ then run the docs make script: python make_docs.py ``` +The files will be built into `docs/build/markdown`. Note that these built files should not be committed to the repository. \ No newline at end of file From a04286a91eef9839930b19a5d61795f84b9a7989 Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Fri, 7 Jun 2024 14:12:25 -0500 Subject: [PATCH 10/11] wip --- plugins/plotly-express/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/plotly-express/conf.py b/plugins/plotly-express/conf.py index 60aa3a664..c9bbb23e9 100644 --- a/plugins/plotly-express/conf.py +++ b/plugins/plotly-express/conf.py @@ -34,6 +34,7 @@ # options for sphinx_autodoc_typehints always_use_bars_union = True +typehints_defaults = "comma" from deephaven_server import Server From dcdcde8760778558ff8d863507eee6aa4064a74e Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Wed, 12 Jun 2024 10:08:42 -0500 Subject: [PATCH 11/11] cleanup names --- plugins/plotly-express/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/plotly-express/requirements.txt b/plugins/plotly-express/requirements.txt index 3fe548cb5..38f6fd426 100644 --- a/plugins/plotly-express/requirements.txt +++ b/plugins/plotly-express/requirements.txt @@ -1,5 +1,5 @@ deephaven-server Sphinx -myst_parser -sphinx_markdown_builder +myst-parser +sphinx-markdown-builder sphinx-autodoc-typehints \ No newline at end of file