|
32 | 32 |
|
33 | 33 | from matplotlib import pyplot as plt
|
34 | 34 | import matplotlib.gridspec as gridspec
|
35 |
| -from matplotlib.ticker import LogLocator |
| 35 | +from matplotlib.ticker import LogLocator, MultipleLocator |
36 | 36 |
|
37 | 37 | # =============================================================================
|
38 | 38 |
|
@@ -454,20 +454,29 @@ def plot_response(self, iteration=None, fig_num=1, **kwargs):
|
454 | 454 |
|
455 | 455 | # ax_model.legend()
|
456 | 456 | ax_model.set_xlabel("Resistivity ($\Omega$m)")
|
457 |
| - |
458 |
| - ax_model.set_ylim((self._plot_z.max(), 0.01)) |
| 457 | + y_limits = kwargs.get("y_limits", (0.01, self._plot_z.max())) |
| 458 | + ax_model.set_ylim(y_limits) |
459 | 459 | ax_model.set_ylabel("Depth (km)")
|
460 | 460 | ax_model.set_xscale("log")
|
461 |
| - yscale = kwargs.get("yscale", "symlog") |
| 461 | + yscale = kwargs.get("y_scale", "symlog") |
462 | 462 | ax_model.set_yscale(yscale)
|
463 |
| - ax_model.yaxis.set_major_locator(LogLocator(base=10.0, numticks=10)) |
464 |
| - ax_model.yaxis.set_minor_locator( |
465 |
| - LogLocator(base=10.0, numticks=10, subs="auto") |
466 |
| - ) |
467 |
| - ax_model.xaxis.set_major_locator(LogLocator(base=10.0, numticks=10)) |
468 |
| - ax_model.xaxis.set_minor_locator( |
469 |
| - LogLocator(base=10.0, numticks=10, subs="auto") |
470 |
| - ) |
| 463 | + if "log" in yscale: |
| 464 | + ax_model.yaxis.set_major_locator(LogLocator(base=10.0, numticks=10)) |
| 465 | + ax_model.yaxis.set_minor_locator( |
| 466 | + LogLocator(base=10.0, numticks=10, subs="auto") |
| 467 | + ) |
| 468 | + ax_model.xaxis.set_major_locator(LogLocator(base=10.0, numticks=10)) |
| 469 | + ax_model.xaxis.set_minor_locator( |
| 470 | + LogLocator(base=10.0, numticks=10, subs="auto") |
| 471 | + ) |
| 472 | + else: |
| 473 | + pass |
| 474 | + # ax_model.yaxis.set_major_locator( |
| 475 | + # plt.(integer=True, nbins=10) |
| 476 | + # ) |
| 477 | + # ax_model.xaxis.set_major_locator( |
| 478 | + # plt.MaxNLocator(integer=True, nbins=10) |
| 479 | + # ) |
471 | 480 |
|
472 | 481 | ax_model.grid(which="both", alpha=0.5)
|
473 | 482 |
|
|
0 commit comments