python 2.7 - Pandas simple X Y plot -
looks simple not able draw x-y chart "dots" in pandas dataframe. want show subid "mark" on x y chart x age , y fdg .
code far
mydata = [{'subid': 'b14-111', 'age': 75, 'fdg': 3}, {'subid': 'b14-112', 'age': 22, 'fdg': 2}, {'subid': 'b14-112', 'age': 40, 'fdg': 5}] df = pandas.dataframe(mydata) dataframe.plot(df,x="age",y="fdg") show()
df.plot()
accept matplotlib kwargs
. see docs
mydata = [{'subid': 'b14-111', 'age': 75, 'fdg': 3}, {'subid': 'b14-112', 'age': 22, 'fdg': 2}, {'subid': 'b14-112', 'age': 40, 'fdg': 5}] df = pandas.dataframe(mydata) df = df.sort(['age']) # dict doesn't preserve order df.plot(x='age', y='fdg', marker='.')
reading question again, i'm thinking might asking scatterplot.
import matplotlib.pyplot plt plt.scatter(df['age'], df['fdg'])
have @ matplotlib docs.
Comments
Post a Comment