Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Python API #3

Closed
flekschas opened this issue Feb 4, 2021 · 1 comment
Closed

Improve Python API #3

flekschas opened this issue Feb 4, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@flekschas
Copy link
Owner

This is work in progress but I want to document it somewhere:

After discussions with @nvictus I am thinking to change the Python API of plot() to be more intuitive and support dataframes out of the box. The API is inspired by https://seaborn.pydata.org/generated/seaborn.scatterplot.html

jscatter.plot(
  x = str or ndarray,
  y = str or ndarray,
  # Optional:
  data = dataframe, # a dataframe
  color = str or ndarray, # a single color
  color_by = str or ndarray, # color encoding
  color_norm = tuple or matplotlib.colors.Normalize, # normalization strategy for color_by
  color_order = list, # in case of categorical color encoding this specifies the color order
  color_map = list or ndarray, # a list of colors to map color_by to
  size = int or float, # a single point size
  size_by = str or ndarray, # size encoding
  size_norm = tuple or matplotlib.colors.Normalize, # normalization strategy for size_by
  size_order = list, # in case of categorical size encoding this specifies the size order
  size_map = list or ndarray, # a list of size to map size_by to
  connect_by = str or ndarray, # a categorical 
  connect_order = str or ndarray, # order in which the points are to be connected
  opacity = float or str, # a static opacity value that overrides the color's alpha value or 'auto'
)
@flekschas flekschas added the enhancement New feature or request label Feb 4, 2021
@flekschas flekschas changed the title Improved Python API Improve Python API Feb 5, 2021
@flekschas flekschas mentioned this issue Mar 3, 2021
flekschas added a commit that referenced this issue Jun 29, 2021
* Whatever

* Properly destroy regl-scatterplot on destroy of a widget instance

* Complete rewrite of the Python API to match #3

* Fix two-way selection

* Fix typo

* Rename

- `example.ipynb` -> `get-started.ipynb`
- `Untitled.ipynb` -> `examples.ipynb`

* Bump regl-scatterplot

* Add convenience function

* Update

* Fix typo: recticle >> reticle

* Add support for downloading pixels

* Implement functional API

* Allow programmatic hovering. Transition data

* Improve interactivity of the API

* Allow setting width and background image from URL

* Reflect new readme

* Provide examples of the new API

* Add compose()

* Fix width assignment

* Simplify linspace mapping and fix an issues with size()

* Outsource API docs

* Update regl-scatterplot

* Bump

* Fixify selections

* Allow choosing reticle color automatically

* Add tests and fix bugs

* Remove unnecessary sort order

* Validate encoding channel dtypes

* Improve handling of reverse map orders

* Update docs with connection_* functions

* Functionalize

* Make sure functions act as getter when no argument is specified

* Simplify

* Remove unnecessary code

* Improve map order handling

* Update

* Add title

* Avoid depending on sklearn

* Use internal minmax_scale

* Fix minmax_scaler

* Bump regl-scatterplot and add missing regl dependency

* Improve getting started section and add links to docs

* Improve connect() docs
@flekschas
Copy link
Owner Author

Oops, I forgot to close when #4 got merged. The new API is implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant