I built the following graph generator, to export a point plot to "scatter.html":
import sys
import csv
import webbrowser
import pandas as pd
import holoviews as hv
from holoviews import opts
hv.extension("bokeh", "matplotlib")
SOURCE_FILE = "..\..\..\Assets\\task_log.csv"
df = pd.read_csv(SOURCE_FILE, quoting=csv.QUOTE_ALL)
df["DATE"] = df["TIME"].str[:10]
key_dimensions = [("DATE", "Date"), ("HOST PROGRAM", "Host Program")]
value_dimensions = [("STATUS", "Status"), ("WORKING DIRECTORY")]
scatter_plot = hv.Points(df, key_dimensions, value_dimensions, label = "Script Overview")
scatter_plot.opts(size=8, cmap="prism_r", color="Status", width=900, xrotation=90,
legend_position="bottom_left")
hv.save(scatter_plot, "scatter.html", backend="bokeh")
I would like to create another hv.Points() object and save it to the same output file, "scatter.html". Is there a way to display multiple plots without Jupyter notebooks?
One way of combining two plots in HoloViews is creating a layout.
You then write that combined plot to your html-file.
Documentation on hv.Layout()
:
http://holoviews.org/reference/containers/bokeh/Layout.html#containers-bokeh-gallery-layout
You can simply use the +
sign to combine 2 plots. Your code would look something like this then:
plot1 = hv.Points(df, key_dimensions, value_dimensions, label = "Script Overview")
plot2 = hv.Points(df, key_dimensions, value_dimensions, label = "Other plot")
combined_plot = plot1 + plot2
hv.save(combined_plot, "scatter.html", backend="bokeh")