# AttributeError: 'FigureCanvasAgg' object has no attribute 'tostring_rgb'

- **ID:** `python/matplotlib-tostring-rgba-deprecated`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Matplotlib 3.10 removed the deprecated tostring_rgb / tostring_argb methods from canvas objects.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.10 | active | — | — |

## Workarounds

1. **** (94% success)
   ```
   canvas.draw()
buf = canvas.buffer_rgba()
import numpy as np
arr = np.asarray(buf)  # (H, W, 4) uint8
   ```
2. **** (92% success)
   ```
   from io import BytesIO
import numpy as np
from PIL import Image
buf = BytesIO()
fig.savefig(buf, format='png')
buf.seek(0)
arr = np.array(Image.open(buf))
   ```

## Dead Ends

- **** — Pins the project to an unsupported version and breaks other dependencies that require 3.10+. (70% fail)
- **** — Returns None and then the downstream code raises a different error. (75% fail)
