pymatgen
pymatgen copied to clipboard
matplotlib 3.5 BSPlotterProjectedTest test error in electronic_structure test_plotter.py: ValueError: Number of rows must be a positive integer, not 5.5
Describe the bug
The BSPlotterProjectedTest test triggered by electronic_structure/tests/test_plotter.py has started failing with matplotlib 3.5. It was previously working with matplot 3.3 (I haven't tested matplotlib 3.4)
To Reproduce Steps to reproduce the behavior:
- Go to source dir
- Run
PMG_TEST_FILES_DIR=./test_files/ python3 pymatgen/electronic_structure/tests/test_plotter.py - See error
$ PMG_TEST_FILES_DIR=./test_files/ python3 pymatgen/electronic_structure/tests/test_plotter.py
.You do not want to sum projection over orbitals.
You do not want to sum projection over atoms.
Number of subfigures: 9
{'start_index': 0, 'end_index': 15, 'name': '\\Gamma-X'}
{'start_index': 16, 'end_index': 31, 'name': 'X-M'}
{'start_index': 32, 'end_index': 47, 'name': 'M-\\Gamma'}
{'start_index': 48, 'end_index': 63, 'name': '\\Gamma-R'}
{'start_index': 64, 'end_index': 79, 'name': 'R-X'}
{'start_index': 80, 'end_index': 95, 'name': 'M-R'}
dictio_d: {'Cu': ['dxy', 's', 'px'], 'O': ['px', 'py', 'pz']}
dictpa_d: {'Cu': ['3', '5'], 'O': ['1']}
E...The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.
The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.
....sssssssssssssssssss....The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.
...The PostScript backend does not support transparency; partially transparent artists will be rendered opaque.
...
======================================================================
ERROR: test_methods (__main__.BSPlotterProjectedTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/projects/build/pymatgen/pymatgen/electronic_structure/tests/test_plotter.py", line 220, in test_methods
self.plotter.get_projected_plots_dots_patom_pmorb(
File "/usr/lib/python3/dist-packages/pymatgen/electronic_structure/plotter.py", line 1651, in get_projected_plots_dots_patom_pmorb
plt.subplot(row + 1, 2, count)
File "/usr/lib/python3/dist-packages/matplotlib/pyplot.py", line 1268, in subplot
key = SubplotSpec._from_subplot_args(fig, args)
File "/usr/lib/python3/dist-packages/matplotlib/gridspec.py", line 595, in _from_subplot_args
gs = GridSpec._check_gridspec_exists(figure, rows, cols)
File "/usr/lib/python3/dist-packages/matplotlib/gridspec.py", line 223, in _check_gridspec_exists
return GridSpec(nrows, ncols, figure=figure)
File "/usr/lib/python3/dist-packages/matplotlib/gridspec.py", line 383, in __init__
super().__init__(nrows, ncols,
File "/usr/lib/python3/dist-packages/matplotlib/gridspec.py", line 47, in __init__
raise ValueError(
ValueError: Number of rows must be a positive integer, not 5.5
----------------------------------------------------------------------
Ran 38 tests in 43.123s
FAILED (errors=1, skipped=19)
Desktop:
- OS: Linux (Debian)
- Version 5.14.16
- Python 3.9.9
- matplotlib 3.5.0
- pymatgen 2022.0.16
Was fixed in a1e223a.