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

Supported object types and libraries #2

Closed
jbednar opened this Issue Aug 28, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@jbednar
Copy link
Contributor

jbednar commented Aug 28, 2018

Panel is designed to be very inclusive, providing basic support for a large number of different types of viewable objects. In categories ordered by decreasing richness of the representation, the supported types are:

  • Interactive plots -- implemented specifically for each library:
    • Bokeh plots
    • Plotly plots
    • Altair or Vega plots
    • HoloViews plots
      • hvPlot plots for Pandas, XArray, Dask, Streamz, Intake, and GeoPandas data (via Bokeh+HoloViews)
  • Image-based plots -- implemented specifically for each library, but trivial to add more:
    • Matplotlib figures (as PNG)
      • Seaborn plots (generates Matplotlib figures)
      • plotnine plots (generates Matplotlib figures; superseding Python ggpy/ggplot2)
    • R ggplot2 plots (via rpy2, as PNG)
    • yt plots (as Matplotlib PNG)
  • Images -- PNG, JPG, SVG, or animated GIF:
    • anything with a _repr_svg_ rich display method
      • Shapely images
      • Dot/Graphviz Graph/DiGraph objects
    • anything with a _repr_png_ rich display method, including:
      • IPython.display.Image
      • PIL/Pillow images
      • Datashader images
      • NetworkX graph, plotted using dot/graphviz using nxpd
    • anything with a _repr_jpg_ rich display method
    • files on the local filesystem ending in .png, .jpg, .svg, or .gif
    • image URLs ending in .png, .jpg, .svg, or .gif.
  • HTML -- anything with a _repr_html_ rich display method, including:
    • HTML code as Python strings
    • Pandas dataframes (as a table; requires height specification)
  • Markdown -- anything with a _repr_markdown_ rich display method, including:
    • Markdown text as Python strings
  • Equations -- via PNGs rendered using matplotlib and Pillow:
    • Anything with a _repr_latex_ rich display method, including IPython.display.Latex objects
    • LaTeX equations as Python strings
    • Sympy Expr objects
  • Widgets -- based on Bokeh widgets:
    • Bokeh widgets (wrapped as panel.widgets)
    • Parameterized objects (parameters from Param automatically mapped to panel.widgets)
  • Str -- preformatted text representing anything displayable using Python's str() function:
    • any Python object

The library selects the richest representation available (generally those higher in this list) unless explicitly requested. If you want a rich (non-plaintext) representation for a given object not already supported, you could consider adding one of the various _repr_X_ methods that allow rich display in IPython/Jupyter. That way, the object will have a rich representation in a Jupyter notebook or Jupyter Lab session, as well as being usable in Panel. If you only want Panel support, you could consider adding a suitable Pane class to Panel, accepting an object of that type and returning something displayable in a Panel.

Implementing Pane classes should be straightforward for most object types, with the specific exception that Jupyter-based interactivity provided by ipywidgets is likely to be very difficult to add to Panel without changes to the underlying objects. Thus though it would be great to be able to support such objects, we do not currently expect a Panel to be able to display the interactive features from:

  • bqplot
  • ipyvolume
  • plotly 3.0-specific features
  • streamz objects

without changes to the underlying libraries.

@jlstevens

This comment has been minimized.

Copy link
Contributor

jlstevens commented Aug 31, 2018

  • You could choose to display any Python object that supports __str__ or __repr__ so that Panel can genuinely display everything (even if the textual representation isn't actually appropriate!).

@jbednar jbednar changed the title Supported libraries Supported object types and libraries Sep 5, 2018

@jbednar

This comment has been minimized.

Copy link
Contributor Author

jbednar commented Oct 10, 2018

All types we listed as hoping to support are now included, so this issue can be closed. Additional types can of course be added as needed over time.

@jbednar jbednar closed this Oct 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment