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

Added left,right,top_corner_label methods #42

Closed
wants to merge 1 commit into from

Conversation

ZGainsforth
Copy link
Contributor

Added left,right,top_corner_label methods to allow labeling of ternary plot at each corner instead of along each axis. Folks in geology tend to draw plots this way. Future work might make the positioning of the labels within the canvas.

…y plot at each corner instead of along each axis.
@marcharper
Copy link
Owner

marcharper commented Mar 16, 2016

Thanks for the contribution! I'll run through a few examples and tests, looks good so far.

@marcharper
Copy link
Owner

The relative positions look good, but in some of my examples the corner labels are outside the standard plotting boundary, e.g. the top label is above the plot title. I suspect this related to the scale parameter, so I think we might need to resize the plotting area appropriately to make sure that the corner labels stay in frame. Do you have an example plot? If not I'll see if I can compute resizing parameters for some of the example plots.

I'm also going to add a convenience function to set all the labels simultaneously, something like

def corner_labels(self, left_label, right_label, top_label):
    ...

I should probably have done this for the axes labels as well. So I'm going to open a new PR on a branch "corner_labels" for your commit and make the additional changes I just described there before merging into master. If you make any more changes please open a new PR on that branch.

@ZGainsforth
Copy link
Contributor Author

Hi Marc,

Glad to help! I love how there is a library for everything. :-)

Yes, the labels went outside the active area. I agree it would be better to enlarge the area so they fit inside, but I wasn’t familiar enough with your class structure to do that cleanly. The plot looks like this:

I’ll send the source code as a zip in a second e-mail in case you have filters.

The convenience functions are a good idea.

Zack

On Mar 16, 2016, at 7:39 PM, Marc Harper [email protected] wrote:

The relative positions look good, but in some of my examples the corner labels are outside the standard plotting boundary, e.g. the top label is above the plot title. I suspect this related to the scale parameter, so I think we might need to resize the plotting area appropriately to make sure that the corner labels stay in frame. Do you have an example plot? If not I'll see if I can compute resizing parameters for some of the example plots.

I'm also going to add a convenience function to set all the labels simultaneously, something like

def corner_labels(self, left_label, right_label, top_label):
...
I should probably have done this for the axes labels as well. So I'm going to open a new PR on a branch "corner_labels" for your commit and make the additional changes I just described there before merging into master.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #42 (comment)

@ZGainsforth
Copy link
Contributor Author

Second e-mail with zip.

On Mar 16, 2016, at 7:39 PM, Marc Harper [email protected] wrote:

The relative positions look good, but in some of my examples the corner labels are outside the standard plotting boundary, e.g. the top label is above the plot title. I suspect this related to the scale parameter, so I think we might need to resize the plotting area appropriately to make sure that the corner labels stay in frame. Do you have an example plot? If not I'll see if I can compute resizing parameters for some of the example plots.

I'm also going to add a convenience function to set all the labels simultaneously, something like

def corner_labels(self, left_label, right_label, top_label):
...
I should probably have done this for the axes labels as well. So I'm going to open a new PR on a branch "corner_labels" for your commit and make the additional changes I just described there before merging into master.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #42 (comment)

@marcharper
Copy link
Owner

marcharper commented Mar 17, 2016

Great I'll work on this as soon as I get a chance.

@ZGainsforth
Copy link
Contributor Author

Terrific! Glad to be able to help.

Zack

On Mar 17, 2016, at 7:20 AM, Marc Harper [email protected] wrote:

Great I'll work on this as soon as I get a chance, will probably be a few days.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #42 (comment)

@KyomaHooin
Copy link

Break _redraw_labels():

def right_corner_label(..):
......
self._labels["left"] = (label, position, rotation, kwargs)

"left" overwrite regular label dictionary key.

@marcharper
Copy link
Owner

Yes this PR would break the axis labels. We would need to add a new dictionary for the corner labels. There are also some spacing issues if the corner labels are large (described above). I'm happy to merge a PR that fixes these issues.

@Gotzias
Copy link

Gotzias commented Mar 28, 2018

Hi Mark,
i used the python ternary library in a recent publication,
i want to include this work in the specified section Citations and Recent Usage in Publications in the readme.md,
Enhanced CO2 selectivity within the cavity of gmelinite frameworks, by Anastasios Gotzias, Michael Kainourgiakis and Athanassios Stubos (2018).
https://doi.org/10.1007/s10450-018-9945-2

@marcharper
Copy link
Owner

Thanks for letting me know about the paper, I'll add it to the others. The preferred citation string is:

Marc Harper et al.. (2015). python-ternary: Ternary Plots in Python. Zenodo. 10.5281/zenodo.34938

@marcharper
Copy link
Owner

Hey, I merged this commit in #83. Thanks for the contribution!

@marcharper marcharper closed this Apr 19, 2018
@ZGainsforth
Copy link
Contributor Author

ZGainsforth commented Apr 19, 2018 via email

@marcharper
Copy link
Owner

It should be there already, and in conda-forge.

@carlosgmartin
Copy link

Future work might make the positioning of the labels within the canvas.

The relative positions look good, but in some of my examples the corner labels are outside the standard plotting boundary, e.g. the top label is above the plot title.

Yes, the labels went outside the active area. I agree it would be better to enlarge the area so they fit inside, but I wasn’t familiar enough with your class structure to do that cleanly.

Looks like this relates to #203.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants