Skip to content

Commit

Permalink
programmatic DEX updates (#235)
Browse files Browse the repository at this point in the history
* use Field aliases for summary_types

* move handle_view() out into utils.py; get rid of sample_chart() function

* add all other chart view/config models

* Update correlation_matrix.py

* Update radar_plot.py

* Update scatterplot_matrix.py

* rename

* fix parsing

* renames, reorders, set dex_charts discriminator pattern

* remove chart_view_ref

* rename from arc_diagram

* add connected scatter models

* fix force directed network config

* add parsing tests

* offload sample_* functions to their respective plotting modules

* add get_chart_view() for quick parsing

* add sample* functions and placeholder functions for not-yet-implemented charts

* what kind of madman did all of this

* WHO TESTS THE TESTS

* update docs

* fix import

* clean up all the imports

* move violin to summary.py; clean up ordering

* add radar_plot to __all__

* ordering

* swap these

* this sparks joy

* ordering

* not sure what happened here but it's better now

* ordering

* another fix

* update radar/dotplot configs and discriminators

* update tests to use the actual function calls and check for associated view models

* allow dx.<plot func> and add `dx.plotting.dex.chart_functions`

* py3.8

* rename to avoid conflict with function names (looking at you, funnel.)
  • Loading branch information
shouples authored May 3, 2023
1 parent 9c63e73 commit edb8e97
Show file tree
Hide file tree
Showing 91 changed files with 2,125 additions and 893 deletions.
4 changes: 2 additions & 2 deletions docs/_charts/bar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- --8<-- [start:usage] -->
## [Bar](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic.bar)
## [Bar](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic_charts.bar)
### Simple
=== "dx"

Expand Down Expand Up @@ -65,5 +65,5 @@

<!-- --8<-- [start:ref] -->
## [Bar](../../../plotting/basic_charts/#bar)
::: src.dx.plotting.dex.basic.bar
::: src.dx.plotting.dex.basic_charts.bar
<!-- --8<-- [end:ref] -->
51 changes: 51 additions & 0 deletions docs/_charts/dataprism.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!-- --8<-- [start:usage] -->
## Chart Name
Coming soon!
<!-- ### Simple
=== "dx"
```python
dx.dataprism(df, ...)
```
![](../screenshots/plotting_dataprism_simple1.png)
=== "pd.options.plotting.backend = 'dx'"
!!! info "Make sure you [enable `dx` as a pandas plotting backend](../plotting/overview.md#enabling-pandas-plotting-backend) first."
```python
df.plot(kind='dataprism', x='keyword_column', y='integer_column')
```
![](../screenshots/plotting_dataprism_simple1_pd.png)
### Customized
=== "dx"
```python
dx.dataprism(
df,
...
)
```
![](../screenshots/plotting_dataprism_custom1.png)
=== "pd.options.plotting.backend = 'dx'"
!!! info "Make sure you [enable `dx` as a pandas plotting backend](../plotting/overview.md#enabling-pandas-plotting-backend) first."
```python
df.plot(
kind='dataprism',
...
)
```
![](../screenshots/plotting_dataprism_custom1_pd.png) -->

<!-- --8<-- [end:usage] -->

<!-- --8<-- [start:ref] -->
## Chart Name
Coming soon!
<!-- ::: src.dx.plotting.dex.dataprism -->
<!-- --8<-- [end:ref] -->
4 changes: 2 additions & 2 deletions docs/_charts/line.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- --8<-- [start:usage] -->
## [Line](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic.line)
## [Line](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic_charts.line)

### Simple
=== "dx"
Expand Down Expand Up @@ -63,5 +63,5 @@ You may need to use a larger dataset to see the changes here. For these examples

<!-- --8<-- [start:ref] -->
## [Line](../../../plotting/basic_charts/#line)
::: src.dx.plotting.dex.basic.line
::: src.dx.plotting.dex.basic_charts.line
<!-- --8<-- [end:ref] -->
4 changes: 2 additions & 2 deletions docs/_charts/pie.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- --8<-- [start:usage] -->
## [Pie](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic.pie)
## [Pie](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic_charts.pie)

### Simple
=== "dx"
Expand Down Expand Up @@ -51,5 +51,5 @@

<!-- --8<-- [start:ref] -->
## [Pie](../../../plotting/basic_charts/#pie)
::: src.dx.plotting.dex.basic.pie
::: src.dx.plotting.dex.basic_charts.pie
<!-- --8<-- [end:ref] -->
4 changes: 2 additions & 2 deletions docs/_charts/scatter.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- --8<-- [start:usage] -->
## [Scatter](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic.scatterplot)
## [Scatter](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic_charts.scatterplot)

### Simple
=== "dx"
Expand Down Expand Up @@ -60,5 +60,5 @@

<!-- --8<-- [start:ref] -->
## [Scatter](../../../plotting/basic_charts/#scatter)
::: src.dx.plotting.dex.basic.scatter
::: src.dx.plotting.dex.basic_charts.scatter
<!-- --8<-- [end:ref] -->
6 changes: 3 additions & 3 deletions docs/_charts/tilemap.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- --8<-- [start:usage] -->
## [Tilemap](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic.tilemap)
## [Tilemap](../../reference/charts/maps/#src.dx.plotting.dex.map_charts.tilemap)
Since `dx.random_dataframe()` returns `integer_column` values (`-100` to `100`) and `float_column` values (`0.0` to `1.0`) as the only numeric columns by default, we can suggest enabling the `lat_float_column` and `lon_float_column` arguments for some quick testing:
```python
df = dx.random_dataframe(100, lat_float_column=True, lon_float_column=True)
Expand Down Expand Up @@ -72,6 +72,6 @@ df = dx.random_dataframe(100, lat_float_column=True, lon_float_column=True)
<!-- --8<-- [end:usage] -->

<!-- --8<-- [start:ref] -->
## [Tilemap](../../../plotting/basic_charts/#tilemap)
::: src.dx.plotting.dex.basic.tilemap
## [Tilemap](../../../plotting/maps/#tilemap)
::: src.dx.plotting.dex.map_charts.tilemap
<!-- --8<-- [end:ref] -->
6 changes: 3 additions & 3 deletions docs/_charts/violin.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- --8<-- [start:usage] -->
## [Violin](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic.violin)
## [Violin](../../reference/charts/basic_charts/#src.dx.plotting.dex.summary_charts.violin)

### Simple
=== "dx"
Expand Down Expand Up @@ -55,6 +55,6 @@
<!-- --8<-- [end:usage] -->

<!-- --8<-- [start:ref] -->
## [Violin](../../../plotting/basic_charts/#violin)
::: src.dx.plotting.dex.basic.violin
## [Violin](../../../plotting/summary_charts/#violin)
::: src.dx.plotting.dex.summary_charts.violin
<!-- --8<-- [end:ref] -->
4 changes: 2 additions & 2 deletions docs/_charts/wordcloud.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- --8<-- [start:usage] -->
## [Wordcloud](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic.wordcloud)
## [Wordcloud](../../reference/charts/basic_charts/#src.dx.plotting.dex.basic_charts.wordcloud)
### Simple
=== "dx"

Expand Down Expand Up @@ -56,5 +56,5 @@

<!-- --8<-- [start:ref] -->
## [Wordcloud](../../../plotting/basic_charts/#wordcloud)
::: src.dx.plotting.dex.basic.wordcloud
::: src.dx.plotting.dex.basic_charts.wordcloud
<!-- --8<-- [end:ref] -->
1 change: 1 addition & 0 deletions docs/plotting/basic_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ df = dx.random_dataframe(100)
<!-- --8<-- [end:setup] -->

--8<-- "./docs/_charts/bar.md:usage"
--8<-- "./docs/_charts/dataprism.md:usage"
--8<-- "./docs/_charts/line.md:usage"
--8<-- "./docs/_charts/pie.md:usage"
--8<-- "./docs/_charts/scatter.md:usage"
Expand Down
11 changes: 6 additions & 5 deletions docs/plotting/comparison_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ Here we'll talk about how to plot some comparison chart types in DEX using `dx`.

--8<-- "./docs/plotting/basic_charts.md:setup"

--8<-- "./docs/_charts/parallel_coordinates.md:usage"
--8<-- "./docs/_charts/scatter.md:usage"
--8<-- "./docs/_charts/bar.md:usage"
--8<-- "./docs/_charts/connected_scatterplot.md:usage"
--8<-- "./docs/_charts/scatterplot_matrix.md:usage"
--8<-- "./docs/_charts/correlation_matrix.md:usage"
--8<-- "./docs/_charts/bar.md:usage"
--8<-- "./docs/_charts/diverging_bar.md:usage"
--8<-- "./docs/_charts/dotplot.md:usage"
--8<-- "./docs/_charts/radar_plot.md:usage"
--8<-- "./docs/_charts/diverging_bar.md:usage"
--8<-- "./docs/_charts/parallel_coordinates.md:usage"
--8<-- "./docs/_charts/scatter.md:usage"
--8<-- "./docs/_charts/scatterplot_matrix.md:usage"


15 changes: 5 additions & 10 deletions docs/plotting/funnel_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ Here we'll talk about how to plot some funnel chart types in DEX using `dx`.

--8<-- "./docs/plotting/basic_charts.md:setup"

--8<-- "./docs/_charts/big_number.md:usage"
--8<-- "./docs/_charts/wordcloud.md:usage"
--8<-- "./docs/_charts/dimension_matrix.md:usage"
--8<-- "./docs/_charts/violin.md:usage"
--8<-- "./docs/_charts/boxplot.md:usage"
--8<-- "./docs/_charts/heatmap.md:usage"
--8<-- "./docs/_charts/histogram.md:usage"
--8<-- "./docs/_charts/ridgeline.md:usage"
--8<-- "./docs/_charts/horizon.md:usage"
--8<-- "./docs/_charts/hexbin.md:usage"
--8<-- "./docs/_charts/flow_diagram.md:usage"
--8<-- "./docs/_charts/funnel.md:usage"
--8<-- "./docs/_charts/funnel_chart.md:usage"
--8<-- "./docs/_charts/funnel_sunburst.md:usage"
--8<-- "./docs/_charts/funnel_tree.md:usage"
4 changes: 2 additions & 2 deletions docs/plotting/maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Here we'll talk about how to plot some maps in DEX using `dx`.

--8<-- "./docs/plotting/basic_charts.md:setup"

--8<-- "./docs/_charts/tilemap.md:usage"
--8<-- "./docs/_charts/choropleth.md:usage"
--8<-- "./docs/_charts/choropleth.md:usage"
--8<-- "./docs/_charts/tilemap.md:usage"
19 changes: 10 additions & 9 deletions docs/plotting/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ For official DEX chart documentation, visit https://docs.noteable.io/product-doc
* [x] [Scatterplot](../plotting/basic_charts.md#scatterplot)
* [x] [Violin](../plotting/basic_charts.md#violin)
* [x] [Wordcloud](../plotting/basic_charts.md#wordcloud)
* [x] [DataPrism](../plotting/basic_charts.md#dataprism)

- #### [Comparison Charts](../plotting/comparison_charts.md)
* [ ] [Parallel Coordinates](../plotting/comparison_charts.md#parallel_coordinates)
* [x] [Parallel Coordinates](../plotting/comparison_charts.md#parallel_coordinates)
* [x] [Scatterplot](../plotting/comparison_charts.md#scatterplot)
* [ ] [Connected Scatterplot](../plotting/comparison_charts.md#connected_scatterplot)
* [ ] [Scatterplot Matrix](../plotting/comparison_charts.md#scatterplot_matrix)
Expand Down Expand Up @@ -73,16 +74,16 @@ For official DEX chart documentation, visit https://docs.noteable.io/product-doc
* [ ] [Arc Flow](../plotting/funnel_charts.md#arc_flow)

- #### [Summary Charts](../plotting/summary_charts.md)
* [ ] [Big Number](../plotting/summary_charts.md#big_number)
* [x] [Big Number](../plotting/summary_charts.md#big_number)
* [x] [Wordcloud](../plotting/summary_charts.md#wordcloud)
* [ ] [Dimension Matrix](../plotting/summary_charts.md#dimension_matrix)
* [x] [Dimension Matrix](../plotting/summary_charts.md#dimension_matrix)
* [x] [Violin](../plotting/summary_charts.md#violin)
* [ ] [Box Plot](../plotting/summary_charts.md#boxplot)
* [ ] [Heat Map](../plotting/summary_charts.md#heatmap)
* [ ] [Histogram](../plotting/summary_charts.md#histogram)
* [ ] [Ridgeline](../plotting/summary_charts.md#ridgeline)
* [ ] [Horizon](../plotting/summary_charts.md#horizon)
* [ ] [Hexbin](../plotting/summary_charts.md#hexbin)
* [x] [Box Plot](../plotting/summary_charts.md#boxplot)
* [x] [Heat Map](../plotting/summary_charts.md#heatmap)
* [x] [Histogram](../plotting/summary_charts.md#histogram)
* [x] [Ridgeline](../plotting/summary_charts.md#ridgeline)
* [x] [Horizon](../plotting/summary_charts.md#horizon)
* [x] [Hexbin](../plotting/summary_charts.md#hexbin)

- #### [Maps](../plotting/maps.md)
* [ ] [Choropleth](../plotting/maps.md#choropleth)
Expand Down
6 changes: 3 additions & 3 deletions docs/plotting/part_to_whole_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Here we'll talk about how to plot some part-to-whole chart types in DEX using `d

--8<-- "./docs/plotting/basic_charts.md:setup"

--8<-- "./docs/_charts/pie.md:usage"
--8<-- "./docs/_charts/donut.md:usage"
--8<-- "./docs/_charts/partition.md:usage"
--8<-- "./docs/_charts/pie.md:usage"
--8<-- "./docs/_charts/sunburst.md:usage"
--8<-- "./docs/_charts/treemap.md:usage"
--8<-- "./docs/_charts/partition.md:usage"
--8<-- "./docs/_charts/treemap.md:usage"
6 changes: 3 additions & 3 deletions docs/plotting/relationship_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Here we'll talk about how to plot some relationship chart types in DEX using `dx

--8<-- "./docs/plotting/basic_charts.md:setup"

--8<-- "./docs/_charts/force_directed_network.md:usage"
--8<-- "./docs/_charts/sankey.md:usage"
--8<-- "./docs/_charts/arc_diagram.md:usage"
--8<-- "./docs/_charts/adjacency_matrix.md:usage"
--8<-- "./docs/_charts/dendrogram.md:usage"
--8<-- "./docs/_charts/dendrogram.md:usage"
--8<-- "./docs/_charts/force_directed_network.md:usage"
--8<-- "./docs/_charts/sankey.md:usage"
9 changes: 4 additions & 5 deletions docs/plotting/summary_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ Here we'll talk about how to plot some summary chart types in DEX using `dx`.
--8<-- "./docs/plotting/basic_charts.md:setup"

--8<-- "./docs/_charts/big_number.md:usage"
--8<-- "./docs/_charts/wordcloud.md:usage"
--8<-- "./docs/_charts/dimension_matrix.md:usage"
--8<-- "./docs/_charts/violin.md:usage"
--8<-- "./docs/_charts/boxplot.md:usage"
--8<-- "./docs/_charts/dimension_matrix.md:usage"
--8<-- "./docs/_charts/heatmap.md:usage"
--8<-- "./docs/_charts/hexbin.md:usage"
--8<-- "./docs/_charts/histogram.md:usage"
--8<-- "./docs/_charts/ridgeline.md:usage"
--8<-- "./docs/_charts/horizon.md:usage"
--8<-- "./docs/_charts/hexbin.md:usage"
--8<-- "./docs/_charts/ridgeline.md:usage"
--8<-- "./docs/_charts/violin.md:usage"
6 changes: 3 additions & 3 deletions docs/plotting/time_series_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Here we'll talk about how to plot some time series chart types in DEX using `dx`

--8<-- "./docs/plotting/basic_charts.md:setup"

--8<-- "./docs/_charts/line.md:usage"
--8<-- "./docs/_charts/candlestick.md:usage"
--8<-- "./docs/_charts/cumulative.md:usage"
--8<-- "./docs/_charts/stacked_area.md:usage"
--8<-- "./docs/_charts/line.md:usage"
--8<-- "./docs/_charts/line_percent.md:usage"
--8<-- "./docs/_charts/stacked_area.md:usage"
--8<-- "./docs/_charts/stacked_percent.md:usage"
--8<-- "./docs/_charts/candlestick.md:usage"
4 changes: 3 additions & 1 deletion docs/reference/charts/basic_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@

--8<-- "./docs/_charts/violin.md:ref"

--8<-- "./docs/_charts/wordcloud.md:ref"
--8<-- "./docs/_charts/wordcloud.md:ref"

--8<-- "./docs/_charts/dataprism.md:ref"
10 changes: 5 additions & 5 deletions docs/reference/datatypes/compatibility.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
::: src.dx.test_compatibility
::: src.dx.test_build_table_schema
::: src.dx.test_json_clean
::: src.dx.test_db_write
::: src.dx.test_dx_handling
::: src.dx.datatypes.compatibility.test_compatibility
::: src.dx.datatypes.compatibility.test_build_table_schema
::: src.dx.datatypes.compatibility.test_json_clean
::: src.dx.datatypes.compatibility.test_db_write
::: src.dx.datatypes.compatibility.test_dx_handling
4 changes: 2 additions & 2 deletions docs/reference/datatypes/dataframes.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
::: src.dx.quick_random_dataframe
::: src.dx.random_dataframe
::: src.dx.datatypes.main.quick_random_dataframe
::: src.dx.datatypes.main.random_dataframe
12 changes: 6 additions & 6 deletions docs/reference/datatypes/datetime.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
::: src.dx.generate_datetime_series
::: src.dx.generate_date_series
::: src.dx.generate_time_series
::: src.dx.generate_time_period_series
::: src.dx.generate_time_interval_series
::: src.dx.generate_time_delta_series
::: src.dx.datatypes.date_time.generate_datetime_series
::: src.dx.datatypes.date_time.generate_date_series
::: src.dx.datatypes.date_time.generate_time_series
::: src.dx.datatypes.date_time.generate_time_period_series
::: src.dx.datatypes.date_time.generate_time_interval_series
::: src.dx.datatypes.date_time.generate_time_delta_series
10 changes: 5 additions & 5 deletions docs/reference/datatypes/geometry.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
::: src.dx.generate_lat_float_series
::: src.dx.generate_lon_float_series
::: src.dx.generate_latlon_series
::: src.dx.generate_filled_geojson_series
::: src.dx.generate_exterior_bounds_geojson_series
::: src.dx.datatypes.geometry.generate_lat_float_series
::: src.dx.datatypes.geometry.generate_lon_float_series
::: src.dx.datatypes.geometry.generate_latlon_series
::: src.dx.datatypes.geometry.generate_filled_geojson_series
::: src.dx.datatypes.geometry.generate_exterior_bounds_geojson_series
16 changes: 8 additions & 8 deletions docs/reference/datatypes/misc.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
::: src.dx.generate_boolean_series
::: src.dx.generate_bytes_series
::: src.dx.generate_dict_series
::: src.dx.generate_dtype_series
::: src.dx.generate_list_series
::: src.dx.generate_ipv4_series
::: src.dx.generate_ipv6_series
::: src.dx.generate_uuid4_series
::: src.dx.datatypes.misc.generate_boolean_series
::: src.dx.datatypes.misc.generate_bytes_series
::: src.dx.datatypes.misc.generate_dict_series
::: src.dx.datatypes.misc.generate_dtype_series
::: src.dx.datatypes.misc.generate_list_series
::: src.dx.datatypes.misc.generate_ipv4_series
::: src.dx.datatypes.misc.generate_ipv6_series
::: src.dx.datatypes.misc.generate_uuid4_series
Loading

0 comments on commit edb8e97

Please sign in to comment.