If you want to customize the plot, you can set raw_figure
to True to get the raw figure object, which is holoviews
figure.
import pfeed as pe
import pfund_plot as plt
import holoviews as hv
import panel as pn
from docs.utils import display_html
feed = pe.YahooFinanceFeed()
df = feed.get_historical_data(product='AAPL_USD_STK', resolution='1d', rollback_period='1y')
holoviews_fig = plt.candlestick(df, display_mode='notebook', raw_figure=True)
Loading...
# this is only needed in documentation
display_html(pn.pane.HoloViews(holoviews_fig))
Loading...
Customized holoviews figure:¶
customized_holoviews_fig = holoviews_fig.opts(bgcolor='gray')
# this is only needed in documentation
display_html(pn.pane.HoloViews(customized_holoviews_fig))
Loading...
The plot above is actually using bokeh
as the backend, so we can also obtain the bokeh figure and customize it if preferred.
Obtain bokeh figure:¶
bokeh_fig = hv.render(holoviews_fig, backend='bokeh')
type(bokeh_fig)
bokeh.plotting._figure.figure
Customized bokeh figure:¶
from bokeh.io import show
bokeh_fig.title.text = "Customized " + bokeh_fig.title.text
bokeh_fig.title.text_font_size = '20pt'
bokeh_fig.title.text_color = 'blue'
show(bokeh_fig)
Loading...