-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Ternary #3828
Ternary #3828
Conversation
…ternary Conflicts: lib/matplotlib/projections/__init__.py
Are the orientation of the tick labels right? Seems awkward to me. On Fri, Nov 21, 2014 at 12:00 PM, ligon notifications@github.com wrote:
|
I'd say the ticks are correctly oriented. There's no real "up" in these On Fri Nov 21 2014 at 5:07:00 PM Benjamin Root notifications@github.com
|
# 2. Support all of the applicable axes methods | ||
# (http://matplotlib.sourceforge.net/api/axes_api.html). | ||
|
||
class Ternary(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not a fan of this class, I think we should be moving away from plotting via methods -> plotting via functions.
In any case, this should derive from object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not the right person to make major changes to this code--I'm hoping
that Kevin Davies might be induced to do so. But can you point an example
of the sort of "plotting via functions" that you have in mind?
On Fri Nov 21 2014 at 5:31:40 PM Thomas A Caswell notifications@github.com
wrote:
In lib/matplotlib/ternary.py:
+"""Class to create a ternary plot using matplotlib projections
+"""
+author = "Kevin L. Davies"
+version = "2011/10/12"
+license = "BSD"
+
+import matplotlib.pyplot as plt # *_Is this acceptable?
+
+from matplotlib import rcParams
+
+# *_To do:
+# 1. Clean up the procedure for setting the colorbar's location.
+# 2. Support all of the applicable axes methods
+# (http://matplotlib.sourceforge.net/api/axes_api.html).
+
+class Ternary():I am not a fan of this class, I think we should be moving away from
plotting via methods -> plotting via functions.In any case, this should derive from object
—
Reply to this email directly or view it on GitHub
https://github.com/matplotlib/matplotlib/pull/3828/files#r20728672.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still something like the idea version of vaporware, I am still working on getting everything articulated right.
This is not the right place to get into this, but the very short version is that I think all plotting calls should look something like
arts = plotting_function(ax, data, style)
See http://matplotlib.1069221.n5.nabble.com/pyplot-OO-convergence-td44030.html for some of the discussion about this. There is not consensus on this by any means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been a while since I wrote the ternary class, but I'll try to help. If we're to change it to a plotting function, I'd like to have consensus though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't worry about the "as a function" issue at this point. In fact, I
thought that the plan was to have plotting objects (but that is a
discussion for another thread).
On Fri, Nov 21, 2014 at 3:59 PM, Kevin Davies notifications@github.com
wrote:
In lib/matplotlib/ternary.py:
+"""Class to create a ternary plot using matplotlib projections
+"""
+author = "Kevin L. Davies"
+version = "2011/10/12"
+license = "BSD"
+
+import matplotlib.pyplot as plt # *_Is this acceptable?
+
+from matplotlib import rcParams
+
+# *_To do:
+# 1. Clean up the procedure for setting the colorbar's location.
+# 2. Support all of the applicable axes methods
+# (http://matplotlib.sourceforge.net/api/axes_api.html).
+
+class Ternary():It's been a while since I wrote the ternary class, but I'll try to help.
If we're to change it to a plotting function, I'd like to have consensus
though.—
Reply to this email directly or view it on GitHub
https://github.com/matplotlib/matplotlib/pull/3828/files#r20741492.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WeatherGod It is actually both functional on the front end API and semantic objects is the middle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the orientation of the tick labels (above; not sure how to comment there), it's what I intended. However, one thing that I remembered I had to hack was the position of the axis labels. I think I hard coded some offsets; they may not reposition appropriately when the figure is resized.
@ligon Any interest in continuing to work on this? I have pushed this to 'proposed next point release' as it is not a blocker for the next release, but I would really like to get this merged in some form eventually. |
I'd certainly like to get this done. I'll take a look at it next month. On Thu, Jun 18, 2015, 5:22 AM Thomas A Caswell notifications@github.com
|
@joferkington I know you have a geo background and I understand that these are used in geo-related things, do you have any comments on this? |
@tacaswell - Sorry for my delay in replying! It would be nice to have some sort of ternplot projection included in matplotlib. I actually have a half-baked implementation of my own sitting around (though this looks to be more general-purpose and a much better fit for merging). From a geoscience perspective, people are going to immediately want very domain specific features that are well outside the scope of matplotlib. (E.g. displaying common classification schemes or phase diagrams). Ternplots are essentially always used for a classification of some sort in the geosciences. That's not really a consideration for the decision of whether or not to merge things, but either way, there's going to be a need for multiple third-party, domain-specific libraries. On a side note, having tick labels horizontal is much more common than the rotation shown, i.m.o. (though I've seen both). At least in my field, convention strongly dictates an "up" to these plots, so the ticks/ticklabels tend to represent that and are usually horizontal. (However, part of that is due to the limitations of an old plotting package.) At any rate, just my initial thoughts on the general concept. I'll try to take a closer look at this implementation soon. |
I'm sorry I've been out of touch on this. I've been trying to find time to work on it but it hasn't happened yet. Feel free to run with it without me. |
The failure is of a mostly venial nature (PEP8 conformance). I will try to fix that in the next few days. |
Assuming I wrestled correctly with git, the Pul Request #6737 should solve the above pep8 non-conformance issues. There should be no change whatsoever from ligon's code's functionality. Beyond that, I will be working on a few enhancements to _tri, and then share my approach to ternary plots, in case anything there is still of interest. |
Superceded by #6737 |
These are my minor updates to code implementing ternary projections developed by Kevin Davies in 2011 (https://github.com/kdavies4/matplotlib/tree/ternary2); my changes simply make his code work with recent versions of matplotlib.
Ternary plots are a convenient way to visualize the three-dimensional unit simplex; I'm attaching a simple example from my own research on three-player games.