On Tue, May 5, 2009 at 1:04 PM, Ryan May <rm...@gm...> wrote:
> On Tue, May 5, 2009 at 11:47 AM, Jose Gomez-Dans <jgo...@gm...>
> wrote:
>>
>> Hi,
>> I would like to plot a density slice scatter plot (when you have lots of
>> points superimposed, it's very useful). An example from IDL/envi is here:
>> <http://www2.geog.ucl.ac.uk/%7Eplewis/geog2021/practical1/scatter3.gif>
>>
>> My rustic approach to solving this problem has been to bin all my data
>> points into a 2D array (each point that falls in a given cell adds one to
>> that cell), and then use the c argument in scatterplot to map the color to
>> the number of samples in the corresponding bin. Is there a better way of
>> achieving this, as I need a fair bit of tweaking to get the color scales
>> right?
>
> You might try looking at pyplot.hexbin:
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo.html
>
> Ryan
I've also had some luck with scipy.histogramdd and pylab.imshow (you
have to work with the extent and aspect parameters to get the plot you
want). I don't have a standalone demo of this, but if you try it and
have trouble let me know and I'll try to make one.
|