Skip to content

Commit

Permalink
Merge branch 'main' into 497-view
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanalvizo committed Jun 14, 2024
2 parents 7ac1eba + 3502f02 commit 36f8f9b
Show file tree
Hide file tree
Showing 169 changed files with 8,187 additions and 2,748 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.13.0
v20.13.1
2 changes: 1 addition & 1 deletion jest.config.base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
'^.+\\.(ts|tsx|js|jsx)$': ['babel-jest', { rootMode: 'upward' }],
},
transformIgnorePatterns: [
'/node_modules/(?!(@deephaven|monaco-editor|d3-interpolate|d3-color)/)',
'/node_modules/(?!(@deephaven|monaco-editor|d3-interpolate|d3-color|nanoid)/)',
],
moduleNameMapper: {
'theme-([^/]+?)\\.css(\\?(?:inline|raw))?$': path.join(
Expand Down
1,030 changes: 531 additions & 499 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"@deephaven/eslint-config": "^0.72.0",
"@deephaven/prettier-config": "^0.72.0",
"@deephaven/tsconfig": "^0.72.0",
"@playwright/test": "^1.41.2",
"@testing-library/jest-dom": "^5.16.4",
"@playwright/test": "^1.44.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^12.1.3",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^14.4.3",
Expand Down
3 changes: 2 additions & 1 deletion plugins/plotly-express/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ dist/
*.egg-info/
.idea
.DS_store
__pycache__/
__pycache__/
/docs/build/
20 changes: 20 additions & 0 deletions plugins/plotly-express/Makefile
Original file line number Diff line number Diff line change
@@ -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 ?= -c .
SPHINXBUILD ?= sphinx-build
SOURCEDIR = docs
BUILDDIR = docs/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)
16 changes: 16 additions & 0 deletions plugins/plotly-express/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,19 @@ source = new_table(

fig = dx.bar(table=source, x="Categories", y="Values")
```

## Docs
Docs can be built locally

Install the necessary dependencies:
```shell
pip install -r requirements.txt
pip install dist/deephaven_plugin_plotly_express-*.whl
```
then run the docs make script:
```shell
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.
42 changes: 42 additions & 0 deletions plugins/plotly-express/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_markdown_builder",
"sphinx_autodoc_typehints",
]

source_suffix = [".rst", ".md"] # Can use either rst or markdown files as input

# show hints in the description so that the function definition is not cluttered
autodoc_typehints = "description"

# exclude build directory
exclude_patterns = ["build", "Thumbs.db", ".DS_Store"]

# options for sphinx_autodoc_typehints
always_use_bars_union = True
typehints_defaults = "comma"

from deephaven_server import Server

s = Server(port=10075)
s.start()
32 changes: 32 additions & 0 deletions plugins/plotly-express/docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing to our plotting docs

## Goal

Each plot type should have a link to it's own page from the main README.md with:

- Exposition on what the plot type is and when to use it
- A basic and minimal example
- An exhaustive set of common use cases with examples covering all the parameters of each plot
- An autodoc reference section with all the parameters and their types

We should have a seperate section covering shared concepts such as:

- Plot by
- Layering plots
- Subplots
- Multiple axes
- Titles, labels, and legends

## Examples

Examples should be contextually relevant to their plot type and use a ticking data generator that would make sense to that plot type. Each example should be a complete and runnable code snippet that can be copy-pasted, and not require previous snippets to run. Global variables should be named appropriately, and be globally unique. Ex. `bubble_plot`, `scatter_plot`, `scatter_plot_by_color`

## Autodoc

Each plot type should have an autodoc reference section at the bottom of the page that lists all the parameters and their types. This will be generated from the source code and inserted when docs are built, and not manually maintained.

````md
```{eval-rst}
.. autodoc(deephaven.plot.express.scatter)
```
````
121 changes: 121 additions & 0 deletions plugins/plotly-express/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Deephaven Express

[Deephaven Express](https://github.com/deephaven/deephaven-plugin-plotly-express) is a powerful plotting library built on top of [Plotly Express](https://plotly.com/python/plotly-express/) that enhances its capabilities by adding support for real-time Deephaven tables, automatic downsampling, and server-side data grouping and aggregation using the Deephaven query engine. This library seamlessly integrates real-time data from Deephaven with the interactive and expressive visualizations of Plotly Express, allowing you to easily plot or aggregate millions of data points.

## Key Features

- **Live Dataframe Support**: Direct integration with real-time Deephaven tables, allowing you to visualize and analyze data as it updates in real time.
- **Automatic Downsampling**: Pixel accurate automatic downsampling that reduces the number of data points displayed, ensuring smooth and responsive visualizations even with large datasets.
- **Server-Side Data Grouping and Aggregation**: Uses server-side processing capabilities to perform data grouping and aggregation directly within Deephaven query engine, enabling efficient analysis of huge datasets without requiring data transfer.
- **Plotly Express Compatibility**: Built on top of Plotly Express, the library inherits its comprehensive set of features, enabling you to create stunning and interactive visualizations effortlessly. In most cases you can directly swap `px` for `dx` for instant compatibility.
- **Interactive Visualizations**: Supports interactive features such as zooming, panning, and hovering, allowing you to explore and interact with your data conveniently.
- **Easy-to-Use API**: Simple and intuitive API, making it easy for users to generate a wide range of visualizations and customize them according to their specific needs.
- **Single entry point**: `from deephaven.plot import express as dx` and get easy access to all plotting functions and built-in demo datasets.

## Plot Types

This page contains a collection of links to examples demonstrating different plot types and usage scenarios. You can explore these examples to gain a better understanding of how to leverage the library in your projects.

### Basic Plots

<CardList>

[![Scatter plot - Dots show relationships between two numerical measures](_assets/plot_icons/scatter.svg)](scatter.md)
[![Line plot- Line connects points, showing trends over time or sequence](_assets/plot_icons/line.svg)](line.md)
[![Bar plot - Rectangles depict comparisons between values](_assets/plot_icons/bar.svg)](bar.md)
[![Area plot - Colored areas highlight trends, emphasizing change over time](_assets/plot_icons/area.svg)](area.md)
[![Pie plot - Slices represent proportion of parts to a whole](_assets/plot_icons/pie.svg)](pie.md)

</CardList>

### 1D Distribution Plots

<CardList>

[![Histogram - Displays the distribution of a continuous variable using bars](_assets/plot_icons/histogram.svg)](histogram.md)
[![Box plot - Shows the distribution of a continuous variable across different categories](_assets/plot_icons/box.svg)](box.md)
[![Violin plot - Shows the distribution of numeric data for one or more groups using density curves](_assets/plot_icons/violin.svg)](violin.md)
[![Strip plot - Displays the distribution of a continuous variable as individual data points](_assets/plot_icons/strip.svg)](strip.md)

</CardList>

### Financial Plots

<CardList>

[![Candlestick plot - Uses candles to display open, high, low, and close prices of a financial instrument](_assets/plot_icons/candlestick.svg)](candlestick.md)
[![OHLC plot - Uses vertical lines to display the open, high, low, and close prices of a financial instrument](_assets/plot_icons/ohlc.svg)](ohlc.md)

</CardList>

### Hierarchical Plots

<CardList>

[![Treemap plot - Represents a hierarchy using nested rectangles](_assets/plot_icons/treemap.svg)](treemap.md)
[![Icicle plot - Similar to treemap, uses rectangles to represent hierarchical data](_assets/plot_icons/icicle.svg)](icicle.md)
[![Sunburst plot - Represents hierarchical data using concentric circles](_assets/plot_icons/sunburst.svg)](sunburst.md)
[![Funnel plot - Visualizes stages in a process with decreasing areas](_assets/plot_icons/funnel.svg)](funnel.md)
[![Funnel area plot - Similar to funnel plot, but uses filled area to emphasize the magnitude of changes](_assets/plot_icons/funnel_area.svg)](funnel-area.md)

</CardList>

### 3D, Polar, Ternary and Other Plots

<CardList>

[![3D scatter plot - Shows data points in three dimensions](_assets/plot_icons/scatter_3d.svg)](scatter-3d.md)
[![3D line plot - Connects data points in three dimensions to show trends](_assets/plot_icons/line_3d.svg)](line-3d.md)
[![Polar scatter plot - Represents data points on a circular coordinate system](_assets/plot_icons/scatter_polar.svg)](scatter-polar.md)
[![Polar line plot - Connects data points on a circular coordinate system to show trends](_assets/plot_icons/line_polar.svg)](line-polar.md)
[![Ternary scatter plot - Represents data points in a triangular coordinate system](_assets/plot_icons/scatter_ternary.svg)](scatter-ternary.md)
[![Ternary line plot - Connects data points in a triangular coordinate system to show trends](_assets/plot_icons/line_ternary.svg)](line-ternary.md)
[![Timeline plot - Visualizes events over time on a horizontal axis also known as a Gantt](_assets/plot_icons/timeline.svg)](timeline.md)

</CardList>

### Concepts

<CardList>

[![Plot by group - Creates multiple series to compare data across different groups](_assets/plot_icons/plot_by_partition.svg)](plot-by.md)
[![Subplot - Combines multiple plots into a single layout](_assets/plot_icons/sub_plot.svg)](sub-plots.md)
[![Layer plot - Overlays multiple plots on top of each other](_assets/plot_icons/layer_plots.svg)](layer-plots.md)
[![Multiple axes plot - Uses multiple axes to represent different data dimensions](_assets/plot_icons/multiple_axes.svg)](multiple-axes.md)
[![Titles and legends - Provides titles and labels for the plot elements](_assets/plot_icons/titles_legends.svg)](other.md)

</CardList>

## Quickstart

1. Install with Docker, use a Docker image with it already installed (`server-ui`), or pip install with:

```bash
pip install deephaven-plugin-plotly-express
```

2. To create a real-time plot using Deephaven Plotly Express, run the following example within Deephaven:

```python order=my_plot,my_table
import deephaven.plot.express as dx

# Deephaven express includes a number of generated data sets for examples
my_table = dx.data.stocks()

# Create a line plot, and assign colors by distinct values in the `sym` column
my_plot = dx.line(table=my_table, x="timestamp", y="price", color="sym")
```

In this example, we create a Deephaven table and create a line plot of `timestamp` against `price` with automatic downsampling. A trace is created for each value in the `sym` column, each of which has a unique color.

## Contributing

We welcome contributions to Deephaven Express! If you encounter any issues, have ideas for improvements, or would like to add new features, please open an issue or submit a pull request on the [GitHub repository](https://github.com/deephaven/deephaven-plugins).

## License

Deephaven's Plotly Express plugin is licensed under the [Apache License 2.0](https://github.com/deephaven/deephaven-plugins/blob/main/plugins/plotly-express/LICENSE). You are free to use, modify, and distribute this library in compliance with the terms of the license.

## 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 Express plugin.
74 changes: 74 additions & 0 deletions plugins/plotly-express/docs/_assets/plot_icons/area.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 36f8f9b

Please sign in to comment.