[plotter] more control on embeded text and cb
This commit is contained in:
+10
-5
@@ -649,6 +649,8 @@ class Plotter(Aggregator, BaseProcessor):
|
|||||||
axes=True,
|
axes=True,
|
||||||
colorbar=True,
|
colorbar=True,
|
||||||
embeded=False,
|
embeded=False,
|
||||||
|
text_embeded=None,
|
||||||
|
colorbar_embeded=None,
|
||||||
axes_indicator=None,
|
axes_indicator=None,
|
||||||
overtext_color="w",
|
overtext_color="w",
|
||||||
**kwargs,
|
**kwargs,
|
||||||
@@ -670,6 +672,11 @@ class Plotter(Aggregator, BaseProcessor):
|
|||||||
scalebar = True
|
scalebar = True
|
||||||
if axes_indicator is None:
|
if axes_indicator is None:
|
||||||
axes_indicator = True
|
axes_indicator = True
|
||||||
|
if colorbar_embeded is None:
|
||||||
|
colorbar_embeded = True
|
||||||
|
if text_embeded is None:
|
||||||
|
text_embeded = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if center_space:
|
if center_space:
|
||||||
@@ -744,7 +751,7 @@ class Plotter(Aggregator, BaseProcessor):
|
|||||||
plt.yticks([])
|
plt.yticks([])
|
||||||
|
|
||||||
if colorbar:
|
if colorbar:
|
||||||
if embeded:
|
if colorbar_embeded:
|
||||||
cbaxes = inset_axes(
|
cbaxes = inset_axes(
|
||||||
ax, width="10%", height="100%", loc="right", borderpad=0
|
ax, width="10%", height="100%", loc="right", borderpad=0
|
||||||
)
|
)
|
||||||
@@ -762,14 +769,14 @@ class Plotter(Aggregator, BaseProcessor):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
cbar = plt.colorbar()
|
cbar = plt.colorbar()
|
||||||
if label is not None:
|
if label is not None:
|
||||||
if embeded:
|
if text_embeded:
|
||||||
cbar.set_label(" " + label, color=overtext_color, loc="bottom")
|
cbar.set_label(" " + label, color=overtext_color, loc="bottom")
|
||||||
else:
|
else:
|
||||||
cbar.set_label(label)
|
cbar.set_label(label)
|
||||||
|
|
||||||
if put_title:
|
if put_title:
|
||||||
title = self.snapshot_title(run, title, nml_key, put_time, unit_time)
|
title = self.snapshot_title(run, title, nml_key, put_time, unit_time)
|
||||||
if embeded:
|
if text_embeded:
|
||||||
ax.text(x=0.05, y=0.95, s=title, color=overtext_color, transform=ax.transAxes)
|
ax.text(x=0.05, y=0.95, s=title, color=overtext_color, transform=ax.transAxes)
|
||||||
else:
|
else:
|
||||||
plt.title(title)
|
plt.title(title)
|
||||||
@@ -795,8 +802,6 @@ class Plotter(Aggregator, BaseProcessor):
|
|||||||
# Restore previous limits in case overlays changed it
|
# Restore previous limits in case overlays changed it
|
||||||
plt.xlim(xlim)
|
plt.xlim(xlim)
|
||||||
plt.ylim(ylim)
|
plt.ylim(ylim)
|
||||||
if embeded:
|
|
||||||
plt.subplots_adjust(left=0, right=1, top=1, bottom=0)
|
|
||||||
|
|
||||||
return PlotInfo(
|
return PlotInfo(
|
||||||
plot_type=PlotType.IMAGE,
|
plot_type=PlotType.IMAGE,
|
||||||
|
|||||||
Reference in New Issue
Block a user