cancel
Showing results for 
Search instead for 
Did you mean: 
Knowledge Sharing Hub
Dive into a collaborative space where members like YOU can exchange knowledge, tips, and best practices. Join the conversation today and unlock a wealth of collective wisdom to enhance your experience and drive success.
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to add a Matplotlib visualizaton to a notebook Dashboard?

jirukulapati
New Contributor III

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? 

3 REPLIES 3

Walter_C
Databricks Employee
Databricks Employee

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">')




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?

Walter_C
Databricks Employee
Databricks Employee

This is correct, it seems the way you want to implement is not currently supported

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group