Fontsize/Label error in pdp.pdp_interact_plot when contour = True
jsga opened this issue · 7 comments
jsga commented
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'
)
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'
Thank you in advance. Awesome library by the way!
jsga commented
Re-running the whole notebook seems to fix it :S Thanks anyways
jsga commented
It seems the error is gone when using a version of matplotlib 2.x.
The error pops up with version 3.0
mariolovric commented
Any updates on this issue?
Is the only solution downgrading matplotlib?
Thanks
r-ichi commented
Yeah...any updates on this issue? :/
Abhinavk910 commented
Any updates?
nemasobhani commented
Would love an update for this please!