plt.hexbin underlying algorithm

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.

Em,

hexbin is a method of the Axe class:
https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_axes.py#L3958

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 <emilia.petrisor at gmail.com> 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
Matplotlib-users at python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160330/13605fb7/attachment.html>

Fine!!! Thank you very much!!!

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/plt-hexbin-underlying-algorithm-tp46927p46929.html
Sent from the matplotlib - users mailing list archive at Nabble.com.