gnestor / jupyterlab_table

A Jupyter Lab extension for rendering tabular data
35 stars 5 forks source link

Adding basic visualization support #3

Open alex-the-man opened 7 years ago

alex-the-man commented 7 years ago

Hi @gnestor, what do you think about adding basic plot support to this library? If you are open to the idea, I can contribute.

image

gnestor commented 7 years ago

Hi @tc0312! I'm not sure I follow you. This extension is intended to render data of application/tableschema+json mime type (based on this spec), so essentially tabular data. If you are interested in plotting the same data, there are many options: matplotlib, Plotly, Altair (Vega), etc. I also created a JupyterLab/Notebook extension for the rendering data of application/vnd.plotly.v1+json mime type, which might be what you're looking for.

alex-the-man commented 7 years ago

Hi @gnestor. Sorry for not explaining myself clearly. What do you think about extending this plugin to include basic chart plotting function? In Zeppelin, they have a display system for tables which user can visualize a table in table form or in different chart types. I think it's a very nice feature to have in JupyterLab. Asking users to call matplotlib or other libraries is less convenient than Zeppelin's display system.

Zeppelin display system

gnestor commented 7 years ago

Ah, I see! I like this idea and it's worth pursuing, although I'm not sure this repo is the right place for it. Nonetheless, I welcome your contributions and we can always move it into it's own repo if necessary.

Some thoughts:

  1. Check out ibm-cds-labs/pixiedust which offers a similar feature (currently only supports classic notebook, not lab).
  2. Vega and Plotly both provide a nice interface for visualizing data a variety of different ways. One possible implementation: simply provide UI for modifying Vega (see the difference between this bar JSON and area JSON. This could be easily implemented on top of jupyterlab_vega.
  3. Lastly, I am planning on adding a feature to lab (and possibly notebook) that will allow users to toggle between available mime types for an output, so that a user could view an output's data as a table, or a JSON tree, plain text, etc.

If jupyterlab_vega provided UI to toggle between different visualization types (2) and its display function accepted a pandas DataFrame, then a user could do something like:

from jupyterlab_vega import Vega
import pandas
import numpy

df = pandas.DataFrame(numpy.random.randn(2, 2))
Vega(df)

and then toggle between all the different visualization types that Vega supports, in addition to toggling between other mime types included in the mime bundle (3) returned by Vega(df), such as the table schema mime type.

In conclusion: I think that implementing (2) at jupyterlab_vega would be the best next step 👍

dhirschfeld commented 7 years ago
  1. :+1: