|
2 | 2 | from autoarray import exc |
3 | 3 | import matplotlib |
4 | 4 |
|
5 | | -backend = conf.instance.visualize.get("figures", "backend", str) |
| 5 | +backend = conf.get_matplotlib_backend() |
| 6 | + |
6 | 7 | matplotlib.use(backend) |
7 | 8 | import matplotlib.pyplot as plt |
8 | 9 | import matplotlib.colors as colors |
@@ -203,30 +204,13 @@ def plot_array( |
203 | 204 | cb_tick_values=cb_tick_values, |
204 | 205 | cb_tick_labels=cb_tick_labels, |
205 | 206 | ) |
206 | | - plot_origin( |
207 | | - array=array, |
208 | | - include_origin=include_origin, |
209 | | - ) |
210 | | - plot_mask( |
211 | | - mask=mask, pointsize=mask_pointsize |
212 | | - ) |
| 207 | + plot_origin(array=array, include_origin=include_origin) |
| 208 | + plot_mask(mask=mask, pointsize=mask_pointsize) |
213 | 209 | plotter_util.plot_lines(line_lists=lines) |
214 | | - plot_border( |
215 | | - mask=mask, |
216 | | - include_border=include_border, |
217 | | - pointsize=border_pointsize, |
218 | | - ) |
219 | | - plot_points( |
220 | | - points=points, |
221 | | - pointsize=point_pointsize, |
222 | | - ) |
223 | | - plot_grid( |
224 | | - grid=grid, |
225 | | - pointsize=grid_pointsize, |
226 | | - ) |
227 | | - plot_centres( |
228 | | - centres=centres, |
229 | | - ) |
| 210 | + plot_border(mask=mask, include_border=include_border, pointsize=border_pointsize) |
| 211 | + plot_points(points=points, pointsize=point_pointsize) |
| 212 | + plot_grid(grid=grid, pointsize=grid_pointsize) |
| 213 | + plot_centres(centres=centres) |
230 | 214 | plotter_util.output_figure( |
231 | 215 | array, |
232 | 216 | as_subplot=as_subplot, |
@@ -306,8 +290,14 @@ def plot_figure( |
306 | 290 | ) |
307 | 291 |
|
308 | 292 | plt.imshow(array.in_2d, aspect=aspect, cmap=cmap, norm=norm_scale, extent=extent) |
309 | | - plotter_util.set_yxticks(array=array, extent=extent, use_scaled_units=use_scaled_units, |
310 | | - unit_conversion_factor=unit_conversion_factor, xticks_manual=xticks_manual, yticks_manual=yticks_manual) |
| 293 | + plotter_util.set_yxticks( |
| 294 | + array=array, |
| 295 | + extent=extent, |
| 296 | + use_scaled_units=use_scaled_units, |
| 297 | + unit_conversion_factor=unit_conversion_factor, |
| 298 | + xticks_manual=xticks_manual, |
| 299 | + yticks_manual=yticks_manual, |
| 300 | + ) |
311 | 301 |
|
312 | 302 | return fig |
313 | 303 |
|
@@ -416,9 +406,8 @@ def plot_centres(centres): |
416 | 406 | color = next(colors) |
417 | 407 | for centre in centres_of_galaxy: |
418 | 408 |
|
419 | | - plt.scatter( |
420 | | - y=centre[0], x=centre[1], s=300, c=color, marker="x" |
421 | | - ) |
| 409 | + plt.scatter(y=centre[0], x=centre[1], s=300, c=color, marker="x") |
| 410 | + |
422 | 411 |
|
423 | 412 | def plot_mask(mask, pointsize): |
424 | 413 | """Plot the mask of the array on the figure. |
@@ -503,9 +492,7 @@ def plot_points(points, pointsize): |
503 | 492 |
|
504 | 493 | if points is not None: |
505 | 494 |
|
506 | | - points = list( |
507 | | - map(lambda position_set: np.asarray(position_set), points) |
508 | | - ) |
| 495 | + points = list(map(lambda position_set: np.asarray(position_set), points)) |
509 | 496 | point_colors = itertools.cycle(["m", "y", "r", "w", "c", "b", "g", "k"]) |
510 | 497 | for point_set in points: |
511 | 498 |
|
@@ -536,8 +523,5 @@ def plot_grid(grid, pointsize): |
536 | 523 | if grid is not None: |
537 | 524 |
|
538 | 525 | plt.scatter( |
539 | | - y=np.asarray(grid[:, 0]), |
540 | | - x=np.asarray(grid[:, 1]), |
541 | | - s=pointsize, |
542 | | - c="k", |
| 526 | + y=np.asarray(grid[:, 0]), x=np.asarray(grid[:, 1]), s=pointsize, c="k" |
543 | 527 | ) |
0 commit comments