has2k1 / plotnine

A Grammar of Graphics for Python
https://plotnine.org
MIT License
4.02k stars 217 forks source link

geom_contour #110

Closed matmel closed 6 years ago

matmel commented 6 years ago

Hi,

First of all, thank you 1000 times for plotnine, it works extremely well and is very nice to work with.

Do you plan to implement geom_contour?

Thanks.

has2k1 commented 6 years ago

There will not be a geom_contour, it assumes too much about the format of the input data. The master branch has geom_density_2d & stat_density_2d, and they will be in the next release.

matmel commented 6 years ago

Ok, well, my use case is not really related to computing statistical kernel densities though. I was really after some visualization of 3D surfaces projected on a 2D plane. The geom_contour input data format looked fine to me.

As a workaround, is there a possibility that I call matplotlib contour function myself on the resulting figure generated by plotnine without to much hassle?

has2k1 commented 6 years ago

Yes you can do that. The draw method returns the figure, from which you can get the axes.

p = ggplot() + ...
fig = p.draw()
axs = fig.get_axes()
for ax in axes:
    # Plot more stuff
    ax.contour(...)