Commit b94f5c0
committed
FIX: be more careful about not importing pyplot early
In matplotlib.use we import pyplot to use `switch_backend`, however
if the user calls `mpl.use(...)` before importing pyplot then
during the initial import of pyplot, before we set the selected
backend we try to set the backend set via rcParams.
This change only imports pyplot if it is already imported, otherwise
it is safe to just set the rcParams and not go through the full
`plt.switch_backend` path.
closes #177631 parent 4a143b9 commit b94f5c0
2 files changed
Lines changed: 28 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1136 | 1136 | | |
1137 | 1137 | | |
1138 | 1138 | | |
| 1139 | + | |
| 1140 | + | |
1139 | 1141 | | |
1140 | 1142 | | |
1141 | 1143 | | |
1142 | 1144 | | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
1147 | | - | |
1148 | | - | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
1149 | 1167 | | |
1150 | 1168 | | |
1151 | 1169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
476 | | - | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
477 | 480 | | |
478 | 481 | | |
479 | 482 | | |
| |||
0 commit comments