Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Plotting realtime data in python visual using matplotlib

Spoiler
I am trying to plot data in a loop using matplotlib in python visuals using the following code :

# The following code to create a dataframe and remove duplicated rows is always executed and acts as a preamble for your script:

# dataset = pandas.DataFrame(length)
# dataset = dataset.drop_duplicates()

# Paste or type your script code here:

import numpy as np
import matplotlib.pyplot as plt
import time

plt.axis([0, 20, 0, 1])

for i in range(10):
       y = np.random.random()
       plt.scatter(i, y, s = 500)
       time.sleep(0.05)

plt.show()


The code plots the data but not one at a time, it is plotting once the loop ends. Any help regarding things will be highly apppreciated.
1 REPLY 1
lbendlin
Super User
Super User

That is the current functionality., unfortunately - your time.sleep() line is ineffective, and placing the plot command inside the loop won't help either.  If this is important to you please consider raising an idea at https://ideas.powerbi.com

 

Note that R visuals can be made slightly interactive.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.