[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,
|
||||
colorbar=True,
|
||||
embeded=False,
|
||||
text_embeded=None,
|
||||
colorbar_embeded=None,
|
||||
axes_indicator=None,
|
||||
overtext_color="w",
|
||||
**kwargs,
|
||||
@@ -670,6 +672,11 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
scalebar = True
|
||||
if axes_indicator is None:
|
||||
axes_indicator = True
|
||||
if colorbar_embeded is None:
|
||||
colorbar_embeded = True
|
||||
if text_embeded is None:
|
||||
text_embeded = True
|
||||
|
||||
|
||||
|
||||
if center_space:
|
||||
@@ -744,7 +751,7 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
plt.yticks([])
|
||||
|
||||
if colorbar:
|
||||
if embeded:
|
||||
if colorbar_embeded:
|
||||
cbaxes = inset_axes(
|
||||
ax, width="10%", height="100%", loc="right", borderpad=0
|
||||
)
|
||||
@@ -762,14 +769,14 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
except AttributeError:
|
||||
cbar = plt.colorbar()
|
||||
if label is not None:
|
||||
if embeded:
|
||||
if text_embeded:
|
||||
cbar.set_label(" " + label, color=overtext_color, loc="bottom")
|
||||
else:
|
||||
cbar.set_label(label)
|
||||
|
||||
if put_title:
|
||||
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)
|
||||
else:
|
||||
plt.title(title)
|
||||
@@ -795,8 +802,6 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
# Restore previous limits in case overlays changed it
|
||||
plt.xlim(xlim)
|
||||
plt.ylim(ylim)
|
||||
if embeded:
|
||||
plt.subplots_adjust(left=0, right=1, top=1, bottom=0)
|
||||
|
||||
return PlotInfo(
|
||||
plot_type=PlotType.IMAGE,
|
||||
|
||||
Reference in New Issue
Block a user