Answers for "how to plot a dict in python"

0

python plot a dictionary

# credit to the Stack Overflow user in the source link

import matplotlib.pylab as plt

lists = sorted(d.items()) # sorted by key, return a list of tuples

x, y = zip(*lists) # unpack a list of pairs into two tuples

plt.plot(x, y)
plt.show()
Posted by: Guest on July-22-2021

Code answers related to "how to plot a dict in python"

Python Answers by Framework

Browse Popular Code Answers by Language