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
Toggle holoplot when using within Jupyter notebook #14
Comments
@drorata Thanks for following up on this. I definitely think it is important to ensure that you can restore the original plot interface after you've installed the holoplot one. Some options we could consider:
Personally I think we should definitely do 1., and I'm starting to think that until pandas allows swapping out the plot API, we should also do 3, or at least provide an easy way to enable it. |
All three of those sound useful to me, though I'd definitely bury option 2 deep in any documentation so that we don't confuse people. I'd vote for holoplot to make |
As another option, how about a global function to toggle the approach used? |
@jlstevens A global option can help to tackle the problem in the notebook's context, but it is not clean otherwise. I think that overriding an existing (and in general stable and good) interface is a bad practice. At first, users would like to experiment with the new API and not replace the older and known one right at the beginning. I'm not sure whether it is the case with holoplot, but this approach is particularly bad when the override doesn't replace all functionalities available in the original. Therefore, I think the best approach is (3) --- introducing |
If we decide to go for a different method name, I would recommend |
That makes the API a whole lot less convenient as it requires you to pass in the dataframe. You can already achieve the same thing by using
Note that auto-patching is only enabled when you
Personally I strongly prefer |
Personally I would rather find a way to avoid approach 3 which would make the naming issue moot. |
I'm not sure what you mean by avoiding approach 3. Are you suggesting not patching the dataframe at all or are you suggesting clobbering df.plot is fine? |
Maybe some way of wrapping the original |
@philippjfr Sorry. I meant How can I use holoplot on a data frame without |
@jlstevens isn't this |
I agree that would be a good eventual goal, but I also think there needs to be some more discussion with the pandas folks surrounding the API for extending the plot interface. In future I can imagine a global toggle in pandas to set the plotting
Currently the only two ways of using it is by patching plot = holoplot.HoloPlot(df)
plot.line('x', 'y') As soon as we come to a conclusion on this issue I'll release a new version of holoplot, which does not patch over |
How about Edit: Or |
If I can help in any way, please let me know! |
I think we should make I don't think we should make a global variable to control this, unless that's something worked out with pandas and other library maintainers; better to wait for some consensus on that one, as it's tricky to have things depend on global state, particularly in the context of out-of-order execution in a notebook. In general, I'm wary of offering too many options, because the whole point of HoloPlot is to be simple and convenient, so anything arcane and confusing that we have to document is a serious problem. Overall, I think we should: a. Continue to offer the convenient but heavy-handed Then we have to be very careful about how we do the documentation so that it's clear that these options are available, without confusing new users. That will be tricky! |
I am missing something. When you guys write Shouldn't there be two parallel tracks:
|
Just to be very explicit, So there are two different issues here, i.e. whether to patch or not (at all!), and if patching, whether to overwrite Not patching at all is already supported; see https://pyviz.github.io/holoplot/user_guide/Introduction.html#HoloPlot-native-API If patching, there's currently only one behavior for patching, which is to override I guess even in the overriding case, we could still make the original method available as something like |
Based on this discussion I've come to the conclusion that at least in the case of pandas and probably xarray too, we should not override the plot method by default and instead use Out of all the options, namely: After talking to several people about this, it's also the only suggestion that was repeated to me. Lastly, I don't think holoplot itself needs an abbreviation as it's namespace is tiny and you rarely need more than one or two things from it, e.g. |
Ok by me. You didn't list I'd argue that for a package with no existing |
I can definitely see the appeal in |
Right; |
I still vote for |
I vote for |
I think Furthermore, I vote against @jbednar Thanks for the clarification with regards to patching. |
Given that I'm the only one in favor of |
I have no objection to |
We are the developers of HoloViews, so we can't hijack it from ourselves right? :-)
|
Holoplot is a separate library. It uses holoviews, it is not holoviews. |
I didn't realize it. But still, maybe at some point, someone would like to implement a different approach using HoloViews. As @jlstevens mentioned --- |
Okay, after discussing this with the xarray maintainers there's two takeaways:
I have to say I kind of like the |
And then |
That's right although the documentation would use |
I'd then also consider adding |
One last suggestion for you to consider before you decide (I agree something like
I quite like this but now I've made the suggestion it is up to you to decide. |
Makes sense, and then it would assume PlateCarree? |
After a bit of thought I've concluded that |
Okay final decision, I'm going with |
This issue is a follow up on this SO answer as per @philippjfr request. Please keep in mind it's the first time I'm using
holoplot
(which seems to be awesome!)I tried to use
holoplot
from within a Jupyter notebook. Once importing the package usingall
.plot
are going throughholoplot
. This is not always a convenient behavior. Sometimes, it is easy to think of a use case where some cells should be usingholoplot
while others will be rendered using the standardmatplotlib
. I hope this issue is good enough as a starting point for an interesting discussion.The text was updated successfully, but these errors were encountered: