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

Adding labels to vertices removes axis labels #97

Open
MarkWieczorek opened this issue Apr 2, 2019 · 5 comments
Open

Adding labels to vertices removes axis labels #97

MarkWieczorek opened this issue Apr 2, 2019 · 5 comments

Comments

@MarkWieczorek
Copy link

In many fields, one usually labels to the vertices of a ternary diagram. Would it be possible to add this as an option, in order to make a plot similar to this (which is in the Readme, but the axes are labeled incorrectly: X should be the right corner, Y should be the top, and Z should be the left corner):

https://github.com/marcharper/python-ternary/blob/master/readme_images/various_lines.png

@MarkWieczorek MarkWieczorek changed the title Add labels to vertices Adding labels to vertices removes axis labels Apr 2, 2019
@MarkWieczorek
Copy link
Author

Looking through the package, I found the options to add labels to the vertices. However, when adding both vertice and axis labels, some of these will not be shown

For instance

ax.left_axis_label("vol % Fe", fontsize=8, offset=0.12)
ax.left_corner_label('Fe', offset=-0.03)

ax.bottom_axis_label("vol % Inclusions", fontsize=8)
ax.right_corner_label('Inclusions', offset=-0.03)

ax.right_axis_label("vol % void space", fontsize=8, offset=0.12)
ax.top_corner_label('Porosity')

will not plot the bottom axis label or right vertice label.

If I rearrange the order somewhat

ax.left_axis_label("vol % Fe", fontsize=8, offset=0.12)
ax.bottom_axis_label("vol % Inclusions", fontsize=8)
ax.right_axis_label("vol % void space", fontsize=8, offset=0.12)

ax.left_corner_label('Fe', offset=-0.03)
ax.right_corner_label('Inclusions', offset=-0.03)
ax.top_corner_label('Porosity')

Then this time the bottom and right axis labels are not plotted.

I have saved the files a a pdf and opened this in an editor to make sure that the text is not being overwritten by white characters.

I am using macOS, python3 and matplotlib 3.0.2.

@marcharper
Copy link
Owner

marcharper commented Apr 3, 2019

I think that I've fixed this. Can you try the latest master branch and report back if you still have issues? If your issue is fixed I'll push a new version.

@MarkWieczorek
Copy link
Author

Thanks, it seems to work.

I guess my only comment at this point is that it is necessary to use ax.show() to get the labels to show when plotting in interactive mode.

@marcharper
Copy link
Owner

Did the redraw issue occur in interactive mode with jupyter or in a matplotlib window (or both)?

@MarkWieczorek
Copy link
Author

It was in a matplotlib window. In a jupyter notebook the labels draw normally and I don't need to specify ax.show()

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

No branches or pull requests

2 participants