(
sim: Simulation,
ax: Axes,
volume: Volume,
output_plane: Optional[Volume] = None,
plotting_parameters: Optional[dict] = None,
label: Optional[str] = None,
)
| 312 | # ------------------------------------------------------- # |
| 313 | # actual plotting routines |
| 314 | def plot_volume( |
| 315 | sim: Simulation, |
| 316 | ax: Axes, |
| 317 | volume: Volume, |
| 318 | output_plane: Optional[Volume] = None, |
| 319 | plotting_parameters: Optional[dict] = None, |
| 320 | label: Optional[str] = None, |
| 321 | ) -> Axes: |
| 322 | import matplotlib.patches as patches |
| 323 | from matplotlib import pyplot as plt |
| 324 | |
| 325 | # Set up the plotting parameters |
| 326 | if plotting_parameters is None: |
| 327 | plotting_parameters = default_volume_parameters |
| 328 | else: |
| 329 | plotting_parameters = dict(default_volume_parameters, **plotting_parameters) |
| 330 | |
| 331 | # Get domain measurements |
| 332 | sim_center, sim_size = get_2D_dimensions(sim, output_plane) |
| 333 | |
| 334 | plane = Volume(center=sim_center, size=sim_size) |
| 335 | |
| 336 | size = volume.size |
| 337 | center = volume.center |
| 338 | |
| 339 | xmin, xmax, ymin, ymax, zmin, zmax = box_vertices(center, size, sim.is_cylindrical) |
| 340 | |
| 341 | # Add labels if requested |
| 342 | if label is not None and mp.am_master(): |
| 343 | if sim_size.x == 0: |
| 344 | ax = place_label( |
| 345 | ax, |
| 346 | label, |
| 347 | center.y, |
| 348 | center.z, |
| 349 | sim_center.y, |
| 350 | sim_center.z, |
| 351 | label_parameters=plotting_parameters, |
| 352 | ) |
| 353 | elif sim_size.y == 0: |
| 354 | ax = place_label( |
| 355 | ax, |
| 356 | label, |
| 357 | center.x, |
| 358 | center.z, |
| 359 | sim_center.x, |
| 360 | sim_center.z, |
| 361 | label_parameters=plotting_parameters, |
| 362 | ) |
| 363 | elif sim_size.z == 0: |
| 364 | ax = place_label( |
| 365 | ax, |
| 366 | label, |
| 367 | center.x, |
| 368 | center.y, |
| 369 | sim_center.x, |
| 370 | sim_center.y, |
| 371 | label_parameters=plotting_parameters, |
no test coverage detected