Commit 603755a
In
Running pytest in Python 3.11 on a Debian Linux system produces these
warnings
```python
cirq-core/cirq/experiments/single_qubit_readout_calibration_test.py::test_estimate_parallel_readout_errors_no_noise
/usr/local/google/home/mhucka/projects/github/cirq-pr-warnings/cirq-core/cirq/vis/histogram.py:123: UserWarning: Data has no positive values, and therefore cannot be log-scaled.
set_semilog()
cirq-core/cirq/experiments/single_qubit_readout_calibration_test.py::test_estimate_parallel_readout_errors_no_noise
/usr/local/google/home/mhucka/projects/github/cirq-pr-warnings/cirq-core/cirq/vis/histogram.py:124: UserWarning: Data has no positive values, and therefore cannot be log-scaled.
set_lim(0, 1)
```
This PR modifies `integrated_histogram()` to only apply log scaling if
the data contains positive values, avoiding the warning from Matplotlib.
---------
Co-authored-by: Pavol Juhas <juhas@google.com>histogram.py, only apply log scale if data has positive values (#8032)1 parent a46677e commit 603755a
1 file changed
Lines changed: 4 additions & 4 deletions
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | 103 | | |
106 | 104 | | |
107 | 105 | | |
| |||
176 | 174 | | |
177 | 175 | | |
178 | 176 | | |
179 | | - | |
| 177 | + | |
180 | 178 | | |
181 | 179 | | |
182 | 180 | | |
| |||
188 | 186 | | |
189 | 187 | | |
190 | 188 | | |
| 189 | + | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
0 commit comments