Skip to content

Commit 6ce4410

Browse files
committed
changing how the plotting is modified
1 parent b6bd35f commit 6ce4410

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

mtpy/core/mt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,6 @@ def to_simpeg_1d(self, mode="det", **kwargs):
11861186
simpeg_1d = Simpeg1D(self.to_dataframe(), mode=mode, **kwargs)
11871187
simpeg_1d.run_fixed_layer_inversion(**kwargs)
11881188
simpeg_1d.plot_model_fitting(fig_num=1)
1189-
simpeg_1d.plot_response(fig_num=2)
1189+
simpeg_1d.plot_response(fig_num=2, **kwargs)
11901190

11911191
return simpeg_1d

mtpy/modeling/simpeg/recipes/inversion_1d.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
from matplotlib import pyplot as plt
3434
import matplotlib.gridspec as gridspec
35-
from matplotlib.ticker import LogLocator
35+
from matplotlib.ticker import LogLocator, MultipleLocator
3636

3737
# =============================================================================
3838

@@ -454,20 +454,29 @@ def plot_response(self, iteration=None, fig_num=1, **kwargs):
454454

455455
# ax_model.legend()
456456
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)
459459
ax_model.set_ylabel("Depth (km)")
460460
ax_model.set_xscale("log")
461-
yscale = kwargs.get("yscale", "symlog")
461+
yscale = kwargs.get("y_scale", "symlog")
462462
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+
# )
471480

472481
ax_model.grid(which="both", alpha=0.5)
473482

0 commit comments

Comments
 (0)