Skip to content

Instantly share code, notes, and snippets.

@munk
Created June 1, 2014 22:25
Show Gist options
  • Save munk/70dc375332c62e421111 to your computer and use it in GitHub Desktop.
Save munk/70dc375332c62e421111 to your computer and use it in GitHub Desktop.
Plotting dict of lists
import matplotlib.pyplot as plt
data = {'a': [1, 2, 3],
'b': [9, 4, 2],
'c': [10, 12, 13]}
fig, ax = plt.subplots()
for name, value in data.items():
ax.plot(value, label=name)
plt.ylabel('some numbers')
legend = ax.legend()
plt.show()
import pandas as pd
data = {'a': [1, 2, 3],
'b': [9, 4, 2],
'c': [10, 12, 13]}
df = pd.DataFrame(data)
df.plot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment