Skip to content

pandas plotting - matplotlib 3.2.0 deprecation warning for rowNum/colNum attributes #32634

Closed
@pythonic2020

Description

@pythonic2020

With pandas 1.0.1 and matplotlib 3.2.0 in a conda Python 3.7.6 environment, I'm getting warnings about deprecation of rowNum and colNum attributes when using some pandas plotting routines.

Environment:

c> conda list "python|pandas|matplotlib|numpy|conda"
# packages in environment at C:\Users\me\Miniconda3\envs\forge:
#
# Name                    Version                   Build  Channel
conda                     4.8.2                    py37_0
conda-package-handling    1.6.0            py37h62dcd97_0
ipython                   7.13.0           py37h5ca1d4c_0    conda-forge
ipython_genutils          0.2.0                    py37_0
matplotlib                3.2.0                         1    conda-forge
matplotlib-base           3.2.0            py37h2981e6d_1    conda-forge
msys2-conda-epoch         20160418                      1
numpy                     1.18.1           py37h93ca92e_0
numpy-base                1.18.1           py37hc3f5095_1
numpydoc                  0.9.2                      py_0
pandas                    1.0.1            py37h47e9c7a_0
python                    3.7.6                h60c2a47_2
python-dateutil           2.8.1                      py_0
python-jsonrpc-server     0.3.4                      py_0
python-language-server    0.31.7                   py37_0
python_abi                3.7                     1_cp37m    conda-forge

Warnings:

C:\Users\me\Miniconda3\envs\forge\lib\site-packages\pandas\plotting\_matplotlib\tools.py:298: MatplotlibDeprecationWarning: 
The rowNum attribute was deprecated in Matplotlib 3.2 and will be removed two minor releases later. Use ax.get_subplotspec().rowspan.start instead.
  layout[ax.rowNum, ax.colNum] = ax.get_visible()
C:\Users\me\Miniconda3\envs\forge\lib\site-packages\pandas\plotting\_matplotlib\tools.py:298: MatplotlibDeprecationWarning: 
The colNum attribute was deprecated in Matplotlib 3.2 and will be removed two minor releases later. Use ax.get_subplotspec().colspan.start instead.
  layout[ax.rowNum, ax.colNum] = ax.get_visible()

The above warnings were generated when running this code:

iris.plot(subplots=True)
plt.suptitle('Iris data by index', x=0.5, y=0.925)

# Display the plot
plt.show()

and this code:

df = pd.DataFrame(np.random.randn(250, 5), columns=['A','B','C','D', 'class'])
df['class'] = pd.Series(np.random.randint(0,2, 250))
cmap_tab10 = plt.get_cmap("tab10")
pd.plotting.scatter_matrix(df.iloc[:,0:4], color=cmap_tab10(df['class']), alpha=0.2)
for ax in plt.gcf().axes:
    plt.sca(ax)
    plt.ylabel(ax.get_ylabel(), rotation=0, labelpad=8, ha="right")
    plt.grid(False)
plt.show()

In both of the above cases, the plots did draw as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions