Reputation: 9053
I know how to use ggplot for data frames, but is there a good way to make plots from numpy arrays directly? Or do I have to convert?
Upvotes: 4
Views: 1488
Reputation: 74242
If you just want to plot things in a "ggplot
-like style", you can use the matplotlib.style
package:
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import style
# use ggplot style sheet
style.use('ggplot')
plt.plot(np.random.randn(10))
Of course (as cel pointed out), with matplotlib it's still up to you to make sure your plots actually follow the conventions set out in Grammar of Graphics.
Upvotes: 3