Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
I have a simple dataset that looks like this:
year votes 1999 100 2000 150 2001 200
Trying to plot a simple line chart like this:
import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot(dataset.year, dataset.votes) ax.set_xlim(1998, 2002) ax.set_ylim(90, 210) plt.show()
Gives me this result (i.e. nothing is plotted but Python/Power BI give me no errors).
Specifying the same data in lists and then plot them like this works:
import matplotlib.pyplot as plt fig, ax = plt.subplots() year_array= [1999,2000,2001] votes_array = [100,150,200] ax.plot(year_array, votes_array) ax.set_xlim(1998, 2002) ax.set_ylim(90, 210) plt.show()
Result:
Am I doing something wrong? The data is formatted as Numbers so the problem is not that. I am using Python 3.6.5 Anaconda distribution and Power BI 2.61.5192.601 64-bit (August 2018) on a Windows 10 machine.
Solved! Go to Solution.
My colleague found what the problem was. The values were summed when dragged in to the value field, i chose "Don't Summarize" and now it works like a charm.
My colleague found what the problem was. The values were summed when dragged in to the value field, i chose "Don't Summarize" and now it works like a charm.
Hi @Anonymous,
Based on my test, When I used the code as below. It worked well as well. Did you add the both columns to the Python visual and enter the code?
import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot(dataset.year, dataset.votes) ax.set_xlim(1998, 2002) ax.set_ylim(90, 210) plt.show()
Regards,
Frank
Yes I did, i reckon I would have gotten `KeyError` otherwise and I got no error now. I will try on a collegaues computer and also try uninstalling and installing Power BI otherwise. Python seems to working fine outside of Power BI Python visuals so I assume there is something wrong with Power BI.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 63 | |
| 51 | |
| 41 | |
| 23 | |
| 18 |
| User | Count |
|---|---|
| 134 | |
| 111 | |
| 50 | |
| 31 | |
| 29 |