upgrade from 2.2.2 to 3.0

Hi,

I am using anaconda distribution for windows 10, 64bit. I am trying to
upgrade my current version 2.2.2 to 3.0.0. I have created a new environment
for 3.0.0 within the same desktop. When I compare two versions, for some
code I am getting unexpected output using axes_grid1 functions
make_axes_locatable, ImageGrid and mplot3d toolkit as explained below

1. When I ran the code from Matplotlib Tutorial for axes_grid1, at
https://matplotlib.org/gallery/axes_grid1/scatter_hist_locatable_axes.html
<https://matplotlib.org/gallery/axes_grid1/scatter_hist_locatable_axes.html>
using 2.2.2 version I am getting expected output as given below
<http://matplotlib.1069221.n5.nabble.com/file/t5188/scatter_hist_222.png>
same code run with 3.0.0 gives this figure
<http://matplotlib.1069221.n5.nabble.com/file/t5188/scatter_hist_300.png>

2. Similarly when I run the code available at
https://matplotlib.org/gallery/axes_grid1/simple_colorbar.html
2.2.2 version gives expected output as
<http://matplotlib.1069221.n5.nabble.com/file/t5188/colorbar222.png>
but same code run with 3.0.0 gives this output
<http://matplotlib.1069221.n5.nabble.com/file/t5188/colorbar300.png>

3. Finally, the code at
https://matplotlib.org/gallery/axes_grid1/simple_axesgrid.html
when run with 2.2.2 gives expected output
<http://matplotlib.1069221.n5.nabble.com/file/t5188/imagegrid222.png>
with 3.0.0 it gives this output
<http://matplotlib.1069221.n5.nabble.com/file/t5188/imagegrid300.png>

4. with 3D plotting using mplot3d toolkit, output figure size is very small
compared to expected size we get with version 2.2.2. Even when I increase
figsize argument, 3.0.0 does not give output anywhere closer to expected
size. This is true with single plot figure as well as multiple subplots in a
figure. However, except the size rest of the plot is as expected.

Appreciate any help in resolving these issues.

···

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

Srinivasa,

Can you try with v3.0.1?

I am a bit confused as the linked webpages are generated with 3.0.0, why
are the pages rendering correctly?

Tom

···

On Tue, Oct 23, 2018 at 11:59 AM Srinivasa Rao <srinivasrao.poladi at gmail.com> wrote:

Hi,

I am using anaconda distribution for windows 10, 64bit. I am trying to
upgrade my current version 2.2.2 to 3.0.0. I have created a new environment
for 3.0.0 within the same desktop. When I compare two versions, for some
code I am getting unexpected output using axes_grid1 functions
make_axes_locatable, ImageGrid and mplot3d toolkit as explained below

1. When I ran the code from Matplotlib Tutorial for axes_grid1, at
https://matplotlib.org/gallery/axes_grid1/scatter_hist_locatable_axes.html
<
https://matplotlib.org/gallery/axes_grid1/scatter_hist_locatable_axes.html&gt;

using 2.2.2 version I am getting expected output as given below
<http://matplotlib.1069221.n5.nabble.com/file/t5188/scatter_hist_222.png&gt;
same code run with 3.0.0 gives this figure
<http://matplotlib.1069221.n5.nabble.com/file/t5188/scatter_hist_300.png&gt;

2. Similarly when I run the code available at
https://matplotlib.org/gallery/axes_grid1/simple_colorbar.html
2.2.2 version gives expected output as
<http://matplotlib.1069221.n5.nabble.com/file/t5188/colorbar222.png&gt;
but same code run with 3.0.0 gives this output
<http://matplotlib.1069221.n5.nabble.com/file/t5188/colorbar300.png&gt;

3. Finally, the code at
https://matplotlib.org/gallery/axes_grid1/simple_axesgrid.html
when run with 2.2.2 gives expected output
<http://matplotlib.1069221.n5.nabble.com/file/t5188/imagegrid222.png&gt;
with 3.0.0 it gives this output
<http://matplotlib.1069221.n5.nabble.com/file/t5188/imagegrid300.png&gt;

4. with 3D plotting using mplot3d toolkit, output figure size is very small
compared to expected size we get with version 2.2.2. Even when I increase
figsize argument, 3.0.0 does not give output anywhere closer to expected
size. This is true with single plot figure as well as multiple subplots in
a
figure. However, except the size rest of the plot is as expected.

Appreciate any help in resolving these issues.

--
Sent from:
http://matplotlib.1069221.n5.nabble.com/matplotlib-devel-f28077.html
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel at python.org
Matplotlib-devel Info Page

--
Thomas Caswell
tcaswell at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20181028/c4633011/attachment.html&gt;

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

Can you please report that as an issue on github?

Tom

···

On Mon, Oct 29, 2018 at 2:20 AM Srinivasa Rao <srinivasrao.poladi at gmail.com> wrote:

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&gt; :

----------------------------------------------------------
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
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel at python.org
Matplotlib-devel Info Page

--
Thomas Caswell
tcaswell at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20181029/ada9fa21/attachment-0001.html&gt;

This has been reported already and fixed and should be available on 3.0.2. As a work around until then don?t call tight_layout or use master or v2.2.3.

As a general issue, axes_grid1 toolbox is poorly tested and may suffer from these instabilities at release. This despite the fact it?s heavily promoted as the solution to many layout issues online. I would use it with caution. There are some things it can do that the base library cannot, but....

Thanks. Jody

···

Sent from my iPhone

On Oct 29, 2018, at 6:45 AM, Thomas Caswell <tcaswell at gmail.com> wrote:

Can you please report that as an issue on github?

Tom

On Mon, Oct 29, 2018 at 2:20 AM Srinivasa Rao <srinivasrao.poladi at gmail.com> wrote:
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&gt; :

----------------------------------------------------------
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
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel at python.org
Matplotlib-devel Info Page

--
Thomas Caswell
tcaswell at gmail.com
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel at python.org
Matplotlib-devel Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20181029/f0a4f40b/attachment.html&gt;