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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors