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

Feature request: Add support for streamplot #7

Open
saumil-sh opened this issue Aug 19, 2021 · 4 comments
Open

Feature request: Add support for streamplot #7

saumil-sh opened this issue Aug 19, 2021 · 4 comments

Comments

@saumil-sh
Copy link

saumil-sh commented Aug 19, 2021

Hi,
Thank you for writing this package I find it very easy-to-use and handy. I sometimes prefer streamplot over quiver. I was wondering if you could also add this feature. I'd understand if you don't have the time for it. In that case, could you give me some instructions on how to add this feature, I am willing to do it and make a merge request. I suppose it shouldn't be too difficult since quiver and streamplot are not very different.

Thank you again!

Edit: I (naively) tried copying the quiver block and changing it to streamplot at line 757 here https://github.com/yuzie007/mpltern/blob/977d26d624a87d9c74a81aa7e84198bf70ea34a9/mpltern/ternary/_axes.py, which lead to the following error ValueError: 'x' must be strictly increasing.

@saumil-sh saumil-sh changed the title Feature request: Add streamplot Feature request: Add support for streamplot Aug 19, 2021
@yuzie007
Copy link
Owner

Thank you so much @SamD97 for your request! I agree with you that streamplot may be reasonable to be implemented. Maybe the reason I did not inherit it from Matplotlib was simply that I am not familiar with the algorithm of streamplot and how it would be in ternary plots. I would like to take a look more seriously to find how to do / what to do. If you're already familiar with the algorithm of streamplot and how it would be in ternary plots, may I also later ask you your thoughts?

@saumil-sh
Copy link
Author

saumil-sh commented Aug 23, 2021

Hello @yuzie007, thank you for your reply. I am glad to know that you agree on the addition of streamplot. I'd be happy to discuss whatever I know. So far, I have had limited success with my try using Affine2D().skew() (attached image, also the result I am aiming for using mpltern). I tried being smart and importing the LineCollection to a different subplot with projection='ternary', but matplotlib denied my efforts saying ValueError: Can not reset the axes. You are probably trying to re-use an artist in more than one Axes which is not supported 😅 .
image

@yuzie007
Copy link
Owner

yuzie007 commented Sep 7, 2021

Thank you @SamD97 for your reply, and sorry for my long silence. The figure looks very cool. We can indeed implement this streamplot style.

It seems presently Matplotlib streamplot is specifically for rectangular grid (although we can probably transform this into the triangular view as you did), while I hope to have the interpolation on the triangular lattice, due to the philosophical reason that in ternary plots all three coordinates should be dealt on an equal footing. Let me kindly give a little time to survey if this is indeed possible. Once I get updates, I would like to let you know again!

@Gritbadger
Copy link

I also find this package does not support streamplot, who can help me? and also I try to use ggtern package in R, and plotly package in python, they all do not support streamplot.

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

3 participants