Interactive Scatter Plot
This notebook shows usage examples of interactive Scatter Plot. Detailed API description can be found here.
Import functions
[1]:
from bokeh.plotting import output_file, save, output_notebook
from ESMBenchmarkViz import scatter_plot
[2]:
# Enable Bokeh output in the notebook
output_notebook()
1: Basic usage
Example 1 show basic usage of the function.
[3]:
x = [1, 2, 3]
y = [6, 7, 2]
names = ["Point A", "Point B", "Point C"]
# Create the plot layout
p = scatter_plot(x, y, names)
2: Basic usage with images
Example 2 exapands to include images.
[4]:
x = [1, 2, 3]
y = [6, 7, 2]
names = ["Point A", "Point B", "Point C"]
images = [
"images/image1.jpg", # Example of a valid image URL
None, # Example of no image (None value)
"images/image3.jpg", # Example of another valid image URL
]
# Create the plot layout
p = scatter_plot(x, y, names, images=images)
3: Practical usage example
[5]:
x = [1.26, 0.93, 0.83] # RMSE
y = [0.87, 0.91, 0.93] # Correlation
names = ["ACCESS-CM2", "E3SM-1-0", "GFDL-CM4"]
images = [
"images/model_sample1.png",
"images/model_sample2.png",
"images/model_sample3.png",
]
# Create the plot layout
p = scatter_plot(x, y, names, images=images, width=460, height=600)
Save the plot
[6]:
# set output to static HTML file
output_file(filename="interactive_scatter_plot.html", title="Interactive Scatter Plot")
# save the results to a file
save(p)
# Result: [`interactive_scatter_plot.html`](interactive_scatter_plot.html)
[6]:
'/pscratch/sd/l/lee1043/git/ESMBenchmarkViz/docs/examples/interactive_scatter_plot.html'