Closed morganjwilliams closed 1 year ago
Thank you very much @morganjwilliams for reporting the issue in very detail! That helped me quite a lot. Indeed the problem was that, since in the original implementation the original xaxis and yaxis were removed, they cannot be removed again in other places. The solution was indeed what you suggested; instead of removing them, simply to make them invisible somewhere:)
This actually even enables us to use tight_layout
and constrained_layout
together with mpltern. I have now updated mpltern to 0.4.0 (now available in PyPI and within a few days also in conda-forge). Hopefully this works together with pyrolite
. Please kindly let me know if there are still some issues.
Hey @yuzie007! Great, I'll check it out and let you know if I spot any lingering issues. Thanks for checking this out quickly, you'll have certainly kept a few pyrolite
users happy/less confused.
At least the minimal example above runs as expected now, so I'd suggest this one is OK to be closed.
With the most recent version of
mpltern
andmatplotlib
, there looks to be an issue related to axes handling, and specifically thempltern._axes.TernaryAxesBase.get_children()
method - mostly occurring when saving figures.Minimal Example
Using
mpltern v0.3.5
andmatplotlib v3.6.2
, an error is raised when the children are accessed when determining e.g. 'tight'bbox
limits on export (this is something which is used by default in thepyrolite
helper functionpyrolite.util.plot.export.save_figure
):In this case,
xaxis
andyaxis
are not included in thechildren
attribute (they're explicitly removed), giving an error:I'm not sure if it's backend specific, but I've seen it on Windows and Ubuntu.
Possible Patch
In cases where I've been using more recent
matplotlib
versions, I've used the following patch which negated the issue (the visibility could be toggled elsewhere, but you might have an idea for a more holistic fix?):Other References
This is also mentioned in a
pyrolite
issue at https://github.com/morganjwilliams/pyrolite/issues/78Happy to help out on this one if it is indeed a bug, otherwise I can add some handling around figure export within
pyrolite
to avoid the scenario if needed.