## Re: [Matplotlib-users] add colors to scatter plots

 Re: [Matplotlib-users] add colors to scatter plots From: John Hunter - 2004-03-26 03:28:02 ```>>>>> "paulo" == paulo writes: paulo> I am using the scatter plot of Matplotlib to plot the paulo> position of each particle. That works great, but when I try paulo> to assign different colors to each dot according to their paulo> concentration I find some problems. Although there is a big paulo> range of concentrations (colors) I can only see two in the paulo> plot. Is it possible to define more intervals to assign the paulo> colors? I think I did not understand the right way to paulo> define the c array intensities when I use the command: paulo> scatter(self, x, y, s=None, c) How should I generate that paulo> array? I looked at the example but I couldn't figure it paulo> out. Hi Paulo, It would help to see some code to let you know why your current approach isn't working. For now, all I can say is that c should be a len(x) Numeric array of concentrations. It might help for you to do hist(c, 100) to look at the distribution of concentrations. If the distribution is bimodal and strongly peaked, this may explain why you only see two colors. As for your question about defining more colors, the default is to use a colormap of 1000 colors, which should be an ample number to see a range unless something funny is going on with your c array. When you post some code, also post the first few entries of c, eg c[:10]. JDH ```

 [Matplotlib-users] add colors to scatter plots From: paulo - 2004-03-25 19:09:46 ```Hi, I am simulating the movement of some particles that carry some concentration of different species. Those concentrations change in time and space and I would like to be able to see their distribution in space. I am using the scatter plot of Matplotlib to plot the position of each particle. That works great, but when I try to assign different colors to each dot according to their concentration I find some problems. Although there is a big range of concentrations (colors) I can only see two in the plot. Is it possible to define more intervals to assign the colors? I think I did not understand the right way to define the c array intensities when I use the command: scatter(self, x, y, s=None, c) How should I generate that array? I looked at the example but I couldn't figure it out. Thanks for your help, I look forward to see the future versions of Matplotlib. So far, it looks very good. Paulo. ```
 Re: [Matplotlib-users] add colors to scatter plots From: John Hunter - 2004-03-26 03:28:02 ```>>>>> "paulo" == paulo writes: paulo> I am using the scatter plot of Matplotlib to plot the paulo> position of each particle. That works great, but when I try paulo> to assign different colors to each dot according to their paulo> concentration I find some problems. Although there is a big paulo> range of concentrations (colors) I can only see two in the paulo> plot. Is it possible to define more intervals to assign the paulo> colors? I think I did not understand the right way to paulo> define the c array intensities when I use the command: paulo> scatter(self, x, y, s=None, c) How should I generate that paulo> array? I looked at the example but I couldn't figure it paulo> out. Hi Paulo, It would help to see some code to let you know why your current approach isn't working. For now, all I can say is that c should be a len(x) Numeric array of concentrations. It might help for you to do hist(c, 100) to look at the distribution of concentrations. If the distribution is bimodal and strongly peaked, this may explain why you only see two colors. As for your question about defining more colors, the default is to use a colormap of 1000 colors, which should be an ample number to see a range unless something funny is going on with your c array. When you post some code, also post the first few entries of c, eg c[:10]. JDH ```