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() 

enter image description here

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='.') 

enter image description here

reading question again, i'm thinking might asking scatterplot.

import matplotlib.pyplot plt plt.scatter(df['age'], df['fdg']) 

have @ matplotlib docs.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -