# UserWarning: Data has no positive values, and therefore cannot be log-scaled.

- **ID:** `python/matplotlib-log-scale-nonpositive`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Setting a log scale on an axis whose data contains only zero or negative values.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   ax.set_yscale('symlog', linthresh=1)
   ```
2. **** (88% success)
   ```
   import numpy as np
mask = data > 0
ax.plot(x[mask], data[mask])
ax.set_yscale('log')
   ```

## Dead Ends

- **** — Clipping silently replaces values with the smallest positive number, producing misleading plots. (55% fail)
- **** — Shifts the entire distribution and can hide genuinely zero categories. (50% fail)
