I try to use ggplot for python I have the following data:
power_data = [[ 4.13877565e+04, 2.34652000e-01],
[ 4.13877565e+04, 2.36125000e-01],
[ 4.13877565e+04, 2.34772000e-01],
...
[ 4.13882896e+04, 2.29006000e-01],
[ 4.13882896e+04, 2.29019000e-01],
[ 4.13882896e+04, 2.28404000e-01]]
And I want to represent it in ggplot with this:
print ggplot(aes(x='TIME', y='Watts'), data=power_data) + \
geom_point(color='lightblue') + \
geom_line(alpha=0.25) + \
stat_smooth(span=.05, color='black') + \
ggtitle("Power comnsuption over 13 hours") + \
xlab("Time") + \
ylab("Watts")
but get the error:
File "C:\PYTHON27\lib\site-packages\ggplot\ggplot.py", line 59, in __init__
for ae, name in self.aesthetics.iteritems():
AttributeError: 'list' object has no attribute 'iteritems'
>>>
I don't know what the line aes(x='TIME', y='Watts')
should be doing.
How can I format the power_data
list so I can use it with ggplot, I want first column reprezentedon a time x
axis and second column on a power y
axis?
If I am trying with the meat
example it doesn't show nothing it only shows
>>> print (ggplot(aes(x='date', y='beef'), data=meat) + \
... geom_line())
<ggplot: (20096197)>
>>>
What should I do to further show the graphic?