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
Unable to add color bar to heat map or interact plot without using pyplot API #528
Comments
Sorry I don't actually understand what the issue is? |
I tested out adding the optional figure argument and things seemed to work in my small test case. I could take a stab at changing this if it seems like something that stays in line with the project's stance on the pyplot interface. Also, I haven't used seaborn enough yet to know if added this argument to one or two functions violates some consistent APIs across the project. |
Sorry, maybe I'm not clear. The issue is that I have to use the pyplot interface to use a colobar with the |
Here's the line of code I'm referring to, maybe that will help. I want to pass in a specific figure to put the color bar on to since I'd prefer to not use the pyplot api. The function allows for me to pass in my own axes object but not my own figure object. |
I think I see now. I don't think those functions need a |
Good point on using Just for anyone else who runs into something similar, switching to |
I'm using the
corrplot
function and everything works great if I use the pyplot interface for matplotlib. This requires the code surrounding the call tocorrplot
to do some calls toplt.sca
, etc. to manipulate the state in pyplot so everything works. However, there's anax
argument that almost eliminates the need for the caller to use the pyplot interface at all. Yet the color bar is added with the pyplot interface explicitly.I really like that if I do not pass in an
ax
argument the pyplot interface is the fallback, i.ecorrplot
callsplt.gca
to get an axes. Could this same strategy be applied to the figure? For example,corrplot
could take an optional figure argument and fallback toplt.gcf
if one isn't passed in. This would allow callers to use the OOP interface with matplotlib or the pyplot interface.Does the seaborn project have a guiding principle on when/when not to use the pyplot interface? I tend to avoid that if possible because I usually build stand-alone applications with matplotlib stuff embedded in Qt widgets. So, maybe my use-case is more rare.
Finally, I looked around in the linearmodels.py file for other uses of the pyplot interface and found very few. Maybe some of those uses are strictly necessary; I didn't look too closely. I did notice that the
interactplot
function has the same color bar issue ascorrplot
because it usesplt.colorbar
as well.The text was updated successfully, but these errors were encountered: