astrofrog / mpl-scatter-density

:zap: Fast scatter density plots for Matplotlib :zap:
BSD 2-Clause "Simplified" License
497 stars 25 forks source link

Color-coding + alpha for density #24

Open samverstocken opened 5 years ago

samverstocken commented 5 years ago

Hi all,

So far, this package has been really useful for me. If anyone is interested, I was able to do some hacks to simultaneously display auxilary information (a third axis) with a colormap while using the density of scatter points to render the transparency.

I made a series of test plots to show what I mean:

Just the density: 0

Just the third axis as colors: 1

Now with BOTH density as transparency and third axis as colors (the density is converted into alpha values on a linear scale) 2

Now the same, but with the alpha rendered on a logarithmic scale (i've implemented this as a flag for the scatter_density function): 3

I added another option to enhance the lower transparencies, still on log scale: 4

If someone is interested in this functionality (I couldn't find any other package that does this..), let me know!