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

Fontsize/Label error in pdp.pdp_interact_plot when contour = True #37

Closed
jsga opened this issue Sep 25, 2018 · 7 comments
Closed

Fontsize/Label error in pdp.pdp_interact_plot when contour = True #37

jsga opened this issue Sep 25, 2018 · 7 comments

Comments

@jsga
Copy link

jsga commented Sep 25, 2018

This command works fine and produces the expected results:

fig, axes = pdp.pdp_interact_plot(
    pdp_interact_out = inter1,
    feature_names=['NOx', 'NO_2'],
    plot_type='grid'
)

screen shot 2018-09-25 at 11 59 15

However, changing only plot_type to contour gives an error related to the labels and the font size. The figure appears label-less at the bottom after this error. Any guess or help is appreciated.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-363-7b31c15b4793> in <module>()
      2     pdp_interact_out = inter1,
      3     feature_names=['NOx', 'NO_2'],
----> 4     plot_type='contour'
      5 )

/Users/jsg/Documents/DrivenData_Cold_Forecast/venv/lib/python3.6/site-packages/pdpbox/pdp.py in pdp_interact_plot(pdp_interact_out, feature_names, plot_type, x_quantile, plot_pdp, which_classes, figsize, ncols, plot_params)
    773             fig.add_subplot(inter_ax)
    774             _pdp_inter_one(pdp_interact_out=pdp_interact_plot_data[0], inter_ax=inter_ax, norm=None,
--> 775                            feature_names=feature_names_adj, **inter_params)
    776     else:
    777         wspace = 0.3

/Users/jsg/Documents/DrivenData_Cold_Forecast/venv/lib/python3.6/site-packages/pdpbox/pdp_plot_utils.py in _pdp_inter_one(pdp_interact_out, feature_names, plot_type, inter_ax, x_quantile, plot_params, norm, ticks)
    330             # for numeric not quantile
    331             X, Y = np.meshgrid(pdp_interact_out.feature_grids[0], pdp_interact_out.feature_grids[1])
--> 332         im = _pdp_contour_plot(X=X, Y=Y, **inter_params)
    333     elif plot_type == 'grid':
    334         im = _pdp_inter_grid(**inter_params)

/Users/jsg/Documents/DrivenData_Cold_Forecast/venv/lib/python3.6/site-packages/pdpbox/pdp_plot_utils.py in _pdp_contour_plot(X, Y, pdp_mx, inter_ax, cmap, norm, inter_fill_alpha, fontsize, plot_params)
    249     c1 = inter_ax.contourf(X, Y, pdp_mx, N=level, origin='lower', cmap=cmap, norm=norm, alpha=inter_fill_alpha)
    250     c2 = inter_ax.contour(c1, levels=c1.levels, colors=contour_color, origin='lower')
--> 251     inter_ax.clabel(c2, contour_label_fontsize=fontsize, inline=1)
    252     inter_ax.set_aspect('auto')
    253 

/Users/jsg/Documents/DrivenData_Cold_Forecast/venv/lib/python3.6/site-packages/matplotlib/axes/_axes.py in clabel(self, CS, *args, **kwargs)
   6221 
   6222     def clabel(self, CS, *args, **kwargs):
-> 6223         return CS.clabel(*args, **kwargs)
   6224     clabel.__doc__ = mcontour.ContourSet.clabel.__doc__
   6225 

TypeError: clabel() got an unexpected keyword argument 'contour_label_fontsize'

screen shot 2018-09-25 at 12 00 51

Thank you in advance. Awesome library by the way!

@jsga jsga closed this as completed Sep 25, 2018
@jsga
Copy link
Author

jsga commented Sep 25, 2018

Re-running the whole notebook seems to fix it :S Thanks anyways

@jsga jsga reopened this Sep 27, 2018
@jsga
Copy link
Author

jsga commented Sep 27, 2018

It seems the error is gone when using a version of matplotlib 2.x.
The error pops up with version 3.0

@mariolovric
Copy link

Any updates on this issue?
Is the only solution downgrading matplotlib?

Thanks

@r-ichi
Copy link

r-ichi commented Apr 24, 2019

Yeah...any updates on this issue? :/

@Abhinavk910
Copy link

Any updates?

@nemasobhani
Copy link

Would love an update for this please!

@SauceCat
Copy link
Owner

SauceCat commented Jul 5, 2019

Hi all, this issue has been fixed by #41. Please sync your package with current master branch.

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

6 participants