Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Mike Bender <[email protected]>
  • Loading branch information
dsmmcken and mofojed authored Apr 24, 2024
1 parent c7bd44c commit 53949d3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions plugins/ui/docs/Plotting.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: Plotting and dh.ui
title: Plotting and deephaven.ui
---

Creating dynamic plots that respond to user input is a common task in data analysis. The `dh.ui` module provides a simple interface for creating interactive plots using the `deephaven-express` library. This guide will show you how to create plots that updates based on user input.
Creating dynamic plots that respond to user input is a common task in data analysis. The `deephaven.ui` module provides a simple interface for creating interactive plots using the `deephaven-plugin-express` library. This guide will show you how to create plots that updates based on user input.

## Plotting a filtered table

This example demonstrates how to create a simple line plot that updates based on user input. The plot will display the price of a stock filtered based on the stock symbol entered by the user. Here we have used a `ui.text_field` to get the value, but it could be driven by any dh.ui input, including double clicking on a value from a `ui.table`. We've previously referred to this sort of behaviour as a "one-click" component in enterprise, as the plot updates as soon as the user enters a filter.
This example demonstrates how to create a simple line plot that updates based on user input. The plot will display the price of a stock filtered based on the stock symbol entered by the user. Here we have used a `ui.text_field` to get the value, but it could be driven by any deephaven.ui input, including double clicking on a value from a `ui.table`. We've previously referred to this sort of behaviour as a "one-click" component in enterprise, as the plot updates as soon as the user enters a filter.

```python
import deephaven.plot.express as dx
Expand Down Expand Up @@ -54,17 +54,17 @@ def plot_paritioned_table(table, inital_value):
ui.text_field(value=text, on_change=set_text),
# only attempt to plot valid parition keys
dx.line(
constituent_table, x="timestamp", y="price", title=f"Parition key: {text}"
constituent_table, x="timestamp", y="price", title=f"Partition key: {text}"
)
if constituent_table != None
else ui.text("Please enter a valid parition."),
else ui.text("Please enter a valid partition."),
]


p = plot_paritioned_table(_stocks, "DOG")
```

## Combining a fitler and a parition by
## Combining a filter and a partition by

Deephaven express allows you to plot by a partition and assign unique colors to each key. Sometimes as a user you may also want to filter the data in addition to partitioning it. We've previously referred to this as a "one-click plot by" behaviour in enterprise. This can be done by either filtering the table first and then partitioning it, or partitioning it first and then filtering it. The choice of which to use depends on the size of the table and the number of unique values in the partition key. The first example is more like a traditional "one-click" component, and the second is more like a parameterized query. Both will give you the same result, but the first one may return results faster, whereas the second one may be more memory efficient.

Expand Down

0 comments on commit 53949d3

Please sign in to comment.