display images in databricks

Abhishek Gaikwad 191 Reputation points

I am trying to write a plot to datalake and then later display the plot. However the plot does not get displayed. Any suggestions.

import matplotlib.pyplot as plt
plt.scatter(x=[1,2,3], y = [2,4,3])

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,030 questions
0 comments No comments
{count} votes

Accepted answer
  1. Saurabh Sharma 23,776 Reputation points Microsoft Employee

    @Abhishek Gaikwad Thanks for using Microsoft Q&A !!

    You can use imshow() function of Matplotlib to render images out of the generated array using the function like below -

    import matplotlib.pyplot as plt  
    import matplotlib.image as mpimg  
    img = mpimg.imread('/dbfs/databricks/plot/Figure22.png')  
    imgplot = plt.imshow(img)  

    Here is the results screenshot for your reference.

    Also, refer to the matplotlib documentation for more details.


    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful