Bug summary
Saving an SVG via cairocffi this way worked in 3.5.2, but fails in 3.6.x - 3.7.2 .
I see though that it's just a cairocffi issue; switching to pycairo seems to work so for now I will give that a try.
Code for reproduction
import sys
import matplotlib
from matplotlib import pyplot as plt
def main(argv):
matplotlib.use("cairo")
fig, axs = plt.subplots(1, 8, figsize=(8.0, 4.0), facecolor="w", edgecolor="k")
dump_to = "whatever.svg"
plt.savefig(dump_to)
if __name__ == '__main__':
main(sys.argv)
Actual outcome
File ".../.venv/lib/python3.11/site-packages/matplotlib/backends/backend_cairo.py", line 484, in _save
self._renderer.set_context(cairo.Context(surface))
File ".../.venv/lib/python3.11/site-packages/matplotlib/backends/backend_cairo.py", line 99, in set_context
size = rect.width, rect.height
^^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'width'
Expected outcome
savefig should save the fig
Additional information
this is with:
matplotlib==3.7.2
cairocffi==1.6.1
and the brew install of cairo 1.16.0_5
Operating system
macOS
Matplotlib Version
3.7.2
Matplotlib Backend
cairo
Python version
3.11.4
Jupyter version
No response
Installation
pip
Bug summary
Saving an SVG via cairocffi this way worked in 3.5.2, but fails in 3.6.x - 3.7.2 .
I see though that it's just a cairocffi issue; switching to pycairo seems to work so for now I will give that a try.
Code for reproduction
Actual outcome
Expected outcome
savefig should save the fig
Additional information
this is with:
matplotlib==3.7.2
cairocffi==1.6.1
and the brew install of cairo 1.16.0_5
Operating system
macOS
Matplotlib Version
3.7.2
Matplotlib Backend
cairo
Python version
3.11.4
Jupyter version
No response
Installation
pip