Is there any way to add a Matplotlib visualizaton to a notebook Dashboard?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 05:31 AM
So I love that databricks lets you display a dataframe, create a visualization of it, then add that visualization to notebook dashboard to present. However, the visualizations lack some customization that I would like. For example the heat map visualization from the notebook dashboard doesn't let you modify the min max values for the color bar.
I have a matplotlib heatmap that is much more customized. Is there anyway to add this matplotlib visualization to a notebook dashboard?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 06:08 AM
What you can do is run the visualization in the notebook, save it as image and display it in the dashboard, for example:
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
# Sample data
data = np.random.rand(10, 12)
heatmap = sns.heatmap(data, cmap='viridis')
plt.show()
heatmap.figure.savefig('/dbfs/tmp/heatmap.png')
displayHTML('<img src="/files/tmp/heatmap.png" alt="heatmap">')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 07:16 AM
I see what you're saying but what if I want a set up where a user can enter parameters into widgets and the corresponding heat map updates? With the method you suggested, it will just be a static heat map until I rerun the notebook,correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 08:06 AM
This is correct, it seems the way you want to implement is not currently supported
![](/skins/images/97567C72181EBE789E1F0FD869E4C89B/responsive_peak/images/icon_anonymous_message.png)
![](/skins/images/97567C72181EBE789E1F0FD869E4C89B/responsive_peak/images/icon_anonymous_message.png)