## [Matplotlib-users] Vary point color with scatter

 [Matplotlib-users] Vary point color with scatter From: Michaël Douchin - 2008-02-26 08:23:08 ```Hi list, I have a set of data with 3 "columns" : x = x coordinate of the point y = y coordinate z = temperature I can't see how to set a different color for each point function of temperature value. I have tried, which draw a colorfull beautiful "map", the color varying with the row rank of x (not what I want) ********** sqla="SELECT x, y, temperature FROM import_parcelle a WHERE dat_loc='" + date_traite + "' AND code_uc='" + code_uc + "' ORDER BY a.dateheure;" resa=db.query(sqla) data=resa.dictresult() x= [float(a["x"]) for a in data] # --> extraction de la colonne x y= [float(a["y"]) for a in data] # --> extraction de la colonne y z= [float(a["temperature"]) for a in data] # --> extraction de la colonne temperature scatter(x, y, c=arange(len(x)), cmap=cm.spring) title("Carte des temperatures(L/min)") xlim(min(x)-10,max(x)+10) ylim(min(y)-10,max(y)+10) ********** What is the good way to do what I reach for ? I have much trouble to know how to define the c parameter of scatter. I saw the "arrange" thing somewhere in internet, but don't understand what it is for. Thanks in advance for your help. Michael ```

 [Matplotlib-users] Vary point color with scatter From: Michaël Douchin - 2008-02-26 08:23:08 ```Hi list, I have a set of data with 3 "columns" : x = x coordinate of the point y = y coordinate z = temperature I can't see how to set a different color for each point function of temperature value. I have tried, which draw a colorfull beautiful "map", the color varying with the row rank of x (not what I want) ********** sqla="SELECT x, y, temperature FROM import_parcelle a WHERE dat_loc='" + date_traite + "' AND code_uc='" + code_uc + "' ORDER BY a.dateheure;" resa=db.query(sqla) data=resa.dictresult() x= [float(a["x"]) for a in data] # --> extraction de la colonne x y= [float(a["y"]) for a in data] # --> extraction de la colonne y z= [float(a["temperature"]) for a in data] # --> extraction de la colonne temperature scatter(x, y, c=arange(len(x)), cmap=cm.spring) title("Carte des temperatures(L/min)") xlim(min(x)-10,max(x)+10) ylim(min(y)-10,max(y)+10) ********** What is the good way to do what I reach for ? I have much trouble to know how to define the c parameter of scatter. I saw the "arrange" thing somewhere in internet, but don't understand what it is for. Thanks in advance for your help. Michael ```
 Re: [Matplotlib-users] Vary point color with scatter From: John Hunter - 2008-03-21 19:56:18 ```On Tue, Feb 26, 2008 at 3:23 AM, Michaël Douchin wrote: > What is the good way to do what I reach for ? > I have much trouble to know how to define the c parameter of scatter. I > saw the "arrange" thing somewhere in internet, but don't understand what > it is for. Have you tried the scatter demos? See for example http://matplotlib.sf.net/examples/scatter_demo2.py JDH ```