plt.hexbin underlying algorithm

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

plt.hexbin underlying algorithm

empet
Hi all,

Recently I experimented how plt.hexbin works.
I read a little bit about the  history of this method of binning, and I'm curious how it was implemented in matplotlib.
Could someone, please, point out where in /site-packages/matplotlib  is implemented  the construction of the prototypical hexagon returned by:

    plt.hexbin(x, y, gridsize=25, cmap=my_cmap, mincnt=1).get_paths()

as well as  the computation of the PolyCollection offsets?

I ran my code in a Jupyter notebook and noticed that if I don't set %matplotlib inline, then the
PolyCollection instance

    HB=plt.hexbin(x, y, gridsize=25, cmap=my_cmap, mincnt=1)

has  only one facecolor initialized, i.e. len(Hb.get_facecolors())=1, while len(HB.get_offsets())=300.
Is there a posibility to generate the facecolors without effective plotting of the hexbin object?

Thanks,

Em
Reply | Threaded
Open this post in threaded view
|

Re: plt.hexbin underlying algorithm

Paul Hobson-2
Em,

hexbin is a method of the Axe class:

There is surely some infrastructure below that, but the link above is the entrance to the rabbit hole.

Is that what you needed?
-p

On Wed, Mar 30, 2016 at 7:41 AM, empet <[hidden email]> wrote:
Hi all,

Recently I experimented how plt.hexbin works.
I read a little bit about the  history of this method of binning, and I'm
curious how it was implemented in matplotlib.
Could someone, please, point out where in /site-packages/matplotlib  is
implemented  the construction of the prototypical hexagon returned by:

    plt.hexbin(x, y, gridsize=25, cmap=my_cmap, mincnt=1).get_paths()

as well as  the computation of the PolyCollection offsets?

I ran my code in a Jupyter notebook and noticed that if I don't set
%matplotlib inline, then the
PolyCollection instance

    HB=plt.hexbin(x, y, gridsize=25, cmap=my_cmap, mincnt=1)

has  only one facecolor initialized, i.e. len(Hb.get_facecolors())=1, while
len(HB.get_offsets())=300.
Is there a posibility to generate the facecolors without effective plotting
of the hexbin object?

Thanks,

Em



--
View this message in context: http://matplotlib.1069221.n5.nabble.com/plt-hexbin-underlying-algorithm-tp46927.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: plt.hexbin underlying algorithm

empet
Fine!!!  Thank you very much!!!