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

Supported object types and libraries #2

Closed
36 tasks done
jbednar opened this issue Aug 28, 2018 · 3 comments
Closed
36 tasks done

Supported object types and libraries #2

jbednar opened this issue Aug 28, 2018 · 3 comments

Comments

@jbednar
Copy link
Member

@jbednar 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
    • VTK 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)
  • Code
    • Editable code, in the ACE editor
  • 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 more difficult. We are currently (7/2019) working on ipywidgets integration, and expect that it will be available in late summer 2019, allowing Panel to support the interactive features from:

  • bqplot
  • ipyvolume
  • plotly 3.0-specific features
  • streamz objects
@jlstevens
Copy link
Contributor

@jlstevens 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!).

Loading

@jbednar jbednar changed the title Supported libraries Supported object types and libraries Sep 5, 2018
@jbednar
Copy link
Member Author

@jbednar 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.

Loading

@jbednar
Copy link
Member Author

@jbednar jbednar commented Oct 28, 2020

And, as of Panel 0.10.0, even the ipywidgets-based functionality we hadn't initially expected to be able to support should work now!

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants