Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncation #198

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Truncation #198

wants to merge 20 commits into from

Conversation

tgwoodcock
Copy link
Contributor

This PR includes functionality for truncating the simplex i.e. cutting off one or more corners of the triangle to save whitespace. This has been recently mentioned in #192 and as I've been working on this for some time locally, I thought I'd share this code. I have added an truncated_simplex_example.py to the examples folder which gives a basic tutorial. There are convenience functions for getting and setting the ticks and tick labels which remain after the truncation. Truncation works with or without having set custom axis data limits.

This works for scatter plots but has not been tested on any of the heatmap plots.

Ensured that TernaryAxesSubplot.line passes the self._permutation
through to ternary.lines.line
Some plots are mostly in one region of the simplex and using truncation,
we can cut off one or more corners of the simplex to save whitespace.
These functions now handle truncation too.
We now have axis_min_max as n attribute during init, therefore we don't
need to check for it in the functions for droawing the boundary and the
gridlines both in lines and in ternary_axes_subplot.

Also updated or added some docstrings to some functions.
The function get_truncation was previously in one of the minor modules
but I have now moved it to ternary_axes_subplot as it makes much more
sence. This function has been rewritten and is now called
set_truncation, with get_truncation now simply returning
self._truncation, in alignment with other functions.
Refactorted set_custom_ticks and added docstrings to several functions.
Updated the custom_axis_scaling and truncated_simplex_example scripts
and added 3 images from these scripts to the readme_images folder.
@marcharper
Copy link
Owner

Thanks! I've been quite busy but will try to take a look soon.

Replaced sm._A = [] with sm.set_array(None) as the former was causing an
error with plt.cm.ScalarMappable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants