[Matplotlib-devel] upgrade from 2.2.2 to 3.0

Srinivasa Rao srinivasrao.poladi at gmail.com
Mon Oct 29 02:20:34 EDT 2018


Hi Tom,

Yes, I have tried 3.0.1. While it has solved my old problems, it has
introduced a new problem, which was not there with 3.0.0!

Giving below the code followed by error log:

Inserting the image of expected output that comes when we run the same code
with 3.0.0 or earlier version
<http://matplotlib.1069221.n5.nabble.com/file/t5188/output300.png> :

----------------------------------------------------------
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import matplotlib.pyplot as plt

plt.figure()
ax1 = host_subplot(111, axes_class=AA.Axes)

ax1.axis["top"].toggle(all=False)           # switch off ticks and tick
labels for the top axis

ax2 = ax1.twinx()
ax3 = ax1.twinx()

new_fixed_axis = ax3.get_grid_helper().new_fixed_axis
ax3.axis["right"] = new_fixed_axis(loc="right",
                                    axes=ax3,
                                    offset=(60, 0))

ax2.axis["right"].toggle(all=True)
ax3.axis["right"].toggle(all=True)

ax1.set_xlabel('Defect Reason Codes')
ax1.set_ylabel('Number of Defects')
ax2.set_ylabel('Cumulative Defects as %')
ax3.set_ylabel('Cumulative Defects Count')

x = [0, 1, 2, 3, 4, 5]
y = [19, 12, 6, 4, 3, 2]
y1 = [41, 67, 80, 89, 96, 100]
y2 = [19, 31, 37, 41, 44, 46]

b = ax1.bar(x, y, label='Number of Defects')
l, = ax2.plot(x, y1, lw=5, label='Cumulative Defects as %', color='b')
l1, = ax3.plot(x, y2, lw=5, label='Cumulative Defects Count', color='g')

ax3.set_ylim(15, 50)

ax1.legend(loc=5)
ax1.set_title('Product Defects - August 2018')

ax1.axis["left"].label.set_color(b.patches[0].get_facecolor())
ax2.axis["right"].label.set_color(l.get_color())
ax3.axis["right"].label.set_color(l1.get_color())

ax1.axis["left"].major_ticks.set_color(b.patches[0].get_facecolor())
ax2.axis["right"].major_ticks.set_color(l.get_color())
ax3.axis["right"].major_ticks.set_color(l1.get_color())

ax1.axis["left"].major_ticklabels.set_color(b.patches[0].get_facecolor())
ax2.axis["right"].major_ticklabels.set_color(l.get_color())
ax3.axis["right"].major_ticklabels.set_color(l1.get_color())

# setting the color for axis itself is not working in AA
ax2.spines["right"].set_color(l.get_color())   
ax3.spines["right"].set_color(l1.get_color())

ax1.axis[:].major_ticks.set_tick_out(True)
ax2.axis[:].major_ticks.set_tick_out(True)
ax3.axis[:].major_ticks.set_tick_out(True)

plt.show()
--------------
Error Log
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
C:\Anaconda3\envs\dloct2018\lib\site-packages\IPython\core\formatters.py in
__call__(self, obj)
    339                 pass
    340             else:
--> 341                 return printer(obj)
    342             # Finally look for special method names
    343             method = get_real_method(obj, self.print_method)

C:\Anaconda3\envs\dloct2018\lib\site-packages\IPython\core\pylabtools.py in
<lambda>(fig)
    242 
    243     if 'png' in formats:
--> 244         png_formatter.for_type(Figure, lambda fig: print_figure(fig,
'png', **kwargs))
    245     if 'retina' in formats or 'png2x' in formats:
    246         png_formatter.for_type(Figure, lambda fig:
retina_figure(fig, **kwargs))

C:\Anaconda3\envs\dloct2018\lib\site-packages\IPython\core\pylabtools.py in
print_figure(fig, fmt, bbox_inches, **kwargs)
    126 
    127     bytes_io = BytesIO()
--> 128     fig.canvas.print_figure(bytes_io, **kw)
    129     data = bytes_io.getvalue()
    130     if fmt == 'svg':

C:\Anaconda3\envs\dloct2018\lib\site-packages\matplotlib\backend_bases.py in
print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format,
bbox_inches, **kwargs)
   2051                     bbox_artists = kwargs.pop("bbox_extra_artists",
None)
   2052                     bbox_inches =
self.figure.get_tightbbox(renderer,
-> 2053                             bbox_extra_artists=bbox_artists)
   2054                     pad = kwargs.pop("pad_inches", None)
   2055                     if pad is None:

C:\Anaconda3\envs\dloct2018\lib\site-packages\matplotlib\figure.py in
get_tightbbox(self, renderer, bbox_extra_artists)
   2274         bb.extend(
   2275             ax.get_tightbbox(renderer,
bbox_extra_artists=bbox_extra_artists)
-> 2276             for ax in self.axes if ax.get_visible())
   2277 
   2278         if len(bb) == 0:

C:\Anaconda3\envs\dloct2018\lib\site-packages\matplotlib\figure.py in
<genexpr>(.0)
   2274         bb.extend(
   2275             ax.get_tightbbox(renderer,
bbox_extra_artists=bbox_extra_artists)
-> 2276             for ax in self.axes if ax.get_visible())
   2277 
   2278         if len(bb) == 0:

TypeError: get_tightbbox() got an unexpected keyword argument
'bbox_extra_artists'

<Figure size 432x288 with 1 Axes>




--
Sent from: http://matplotlib.1069221.n5.nabble.com/matplotlib-devel-f28077.html


More information about the Matplotlib-devel mailing list