# ValueError: s must be a scalar or 1D array of the same length as x and y, got array of length 5 when x has length 10.

- **ID:** `python/matplotlib-3d-scatter-size-error`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

In 3D scatter plot, the size parameter 's' must match the number of points; providing a mismatched array causes this error.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |

## Workarounds

1. **Ensure s array has the same length as x** (95% success)
   ```
   ax.scatter(x, y, z, s=np.random.rand(len(x))*100)
   ```
2. **Use a scalar for uniform size** (90% success)
   ```
   ax.scatter(x, y, z, s=50)
   ```

## Dead Ends

- **Using a 2D array for s** — s must be 1D; 2D arrays are not accepted. (90% fail)
- **Repeating the same size for all points by using a scalar** — This works but does not achieve per-point sizing. (30% fail)
