morganjwilliams/pyrolite

Feature: Data contours from histogram data

morganjwilliams opened this issue · 0 comments

Currently contours are only generated by pyroplot.density where mode="density", which uses kernel density estimates to then generate the contours; an error will now result if contours are requested for other modes (largely the topic of #65). These could also be generated from histogram data, although would be much more susceptible to noise in the data.

A few rearrangements would allow the generation of histogram-based contours (with e.g. mode="hist2d", contours=[0.5]) and passing the histogram data to the contouring function (and maybe even mode="hexbin", although the positional accuracy would need to be validated for this). One of these would be to separate the histogram generation from the plotting (both the histogram and hexbin methods are directly using the matplotlib functions ax.hexbin and ax.hist2d), and making sure that the right coordinates are used for contouring (either edge or center points).