[go: up one dir, main page]

Skip to content

ahuang11/holoext

Repository files navigation

HoloExt - HoloViews Extension Mod v1.0.4

An extension to beautify your plots and process.

Note that this package is now deprecated with the advent of hvPlot https://hvplot.pyviz.org/

HoloExt features:

  1. 'intelligent' resizing and activation of tools in addition to grid lines
  2. a straightforward method of saving to file .apply(plot, 'name_of_file')
  3. immediate application of a minimalistic style to plots
  4. keywords like xlim, ylim, xlabel, ylabel, title can be used
  5. user forgiving parsing of toolbar and legend locs
  6. automatic discretization of color bars
  7. color maps (color tables) from NCAR Command Language (NCL)
  8. And more!

Here's some motivation to get started!

Do your plotting as usual in Holoviews.

curves = hv.Curve(df, 'day', 'min_temp_f', label='Max Temp', group='KCMI') * \
         hv.Curve(df, 'day', 'max_temp_f', label='Min Temp', group='KCMI')
curves  # curve without mod

Before Mod

Then simply apply the mod!

from holoext.xbokeh import Mod

Mod().apply(curves)

This automatically increases figure size, applies a minimalistic look, and adds the hover tool, albeit hidden in the toolbar.

However, these mods are not fixed in stone; you can easily adjust it:
Mod(width=300, height=300, tools='default')

If you would like to show the hover tool in the toolbar, it's easily done too:
Mod(show_hover=True)

After Mod

Apply more settings easily and save to .html by passing in any string argument to .apply()

mod_curves = Mod(
    xlabel='Date', ylabel='Temperature [F]',
    tools=['xpan', 'xwheel_zoom', 'save', 'reset', 'hover']
).apply(curves, save='html_output/kcmi_2016_2017_temps')
mod_curves

After Mod with Settings

Check out the gallery to see it work for all types of plots like these!

Station Temperature and Precipitation

ORD Wind Speed and Wind Direction

HOW TO GET IT:

Method 1

  1. pip install holoext
  2. Ensure your packages version (pip list) match with ones listed in requirements.txt

Method 2

  1. Type git clone https://github.com/ahuang11/holoext
  2. Go into holoext folder (where setup.py is)
  3. Type pip install -e .

Check out the docs here!

Random, but awesome, tips: https://github.com/ahuang11/ahhsumtips