[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Nov 6 07:25:50 PST 2014
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/55449303b5f6/
Changeset: 55449303b5f6
Branch: yt
User: ngoldbaum
Date: 2014-10-29 05:05:53+00:00
Summary: Refactor font property logic into one function in the plotting base class.
This also sets the font correctly for plot titles.
Affected #: 3 files
diff -r 320c9d8294991c2f88d8066d0b3ef348779969a5 -r 55449303b5f6d24d202696ac5573d995a5cdd50b yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -427,6 +427,19 @@
if key not in keys:
del self.frb[key]
+ def _set_font_properties(self):
+ for f in self.plots:
+ ax = self.plots[f].axes
+ cbax = self.plots[f].cb.ax
+ labels = ax.xaxis.get_ticklabels() + ax.yaxis.get_ticklabels()
+ labels += cbax.yaxis.get_ticklabels()
+ labels += [ax.title, ax.xaxis.label, ax.yaxis.label,
+ cbax.yaxis.label]
+ for label in labels:
+ label.set_fontproperties(self._font_properties)
+ if self._font_color is not None:
+ label.set_color(self._font_color)
+
@invalidate_plot
@invalidate_figure
def set_font(self, font_dict=None):
diff -r 320c9d8294991c2f88d8066d0b3ef348779969a5 -r 55449303b5f6d24d202696ac5573d995a5cdd50b yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -742,7 +742,7 @@
mylog.warning("Switching to linear colorbar scaling.")
self._field_transform[f] = linear_transform
- fp = self._font_properties
+ font_size = self._font_properties.get_size()
fig = None
axes = None
@@ -761,7 +761,7 @@
image, self._field_transform[f].name,
self._field_transform[f].func,
self._colormaps[f], extent, zlim,
- self.figure_size, fp.get_size(),
+ self.figure_size, font_size,
self.aspect, fig, axes, cax)
axes_unit_labels = ['', '']
@@ -838,14 +838,8 @@
if y_label is not None:
labels[1] = y_label
- self.plots[f].axes.set_xlabel(labels[0],fontproperties=fp)
- self.plots[f].axes.set_ylabel(labels[1],fontproperties=fp)
-
- for label in (self.plots[f].axes.get_xticklabels() +
- self.plots[f].axes.get_yticklabels() +
- [self.plots[f].axes.xaxis.get_offset_text(),
- self.plots[f].axes.yaxis.get_offset_text()]):
- label.set_fontproperties(fp)
+ self.plots[f].axes.set_xlabel(labels[0])
+ self.plots[f].axes.set_ylabel(labels[1])
# Determine the units of the data
units = Unit(self.frb[f].units, registry=self.ds.unit_registry)
@@ -866,13 +860,7 @@
except ParseFatalException, err:
raise YTCannotParseUnitDisplayName(f, colorbar_label, str(err))
- self.plots[f].cb.set_label(colorbar_label, fontproperties=fp)
-
- for label in (self.plots[f].cb.ax.get_xticklabels() +
- self.plots[f].cb.ax.get_yticklabels() +
- [self.plots[f].cb.ax.axes.xaxis.get_offset_text(),
- self.plots[f].cb.ax.axes.yaxis.get_offset_text()]):
- label.set_fontproperties(fp)
+ self.plots[f].cb.set_label(colorbar_label)
# x-y axes minorticks
if f not in self._minorticks:
@@ -908,14 +896,7 @@
if draw_colorbar is False:
self.plots[f]._toggle_colorbar(draw_colorbar)
- if self._font_color is not None:
- ax = self.plots[f].axes
- cbax = self.plots[f].cb.ax
- labels = ax.xaxis.get_ticklabels() + ax.yaxis.get_ticklabels()
- labels += cbax.yaxis.get_ticklabels()
- labels += [ax.xaxis.label, ax.yaxis.label, cbax.yaxis.label]
- for label in labels:
- label.set_color(self._font_color)
+ self._set_font_properties()
self._plot_valid = True
diff -r 320c9d8294991c2f88d8066d0b3ef348779969a5 -r 55449303b5f6d24d202696ac5573d995a5cdd50b yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -814,21 +814,21 @@
self._field_transform[f] = linear_transform
zlim = [zmin, np.nanmax(data)]
- fp = self._font_properties
+ font_size = self._font_properties.get_size()
f = self.profile.data_source._determine_fields(f)[0]
self.plots[f] = PhasePlotMPL(self.profile.x, self.profile.y, data,
x_scale, y_scale, z_scale,
self._colormaps[f], zlim,
- self.figure_size, fp.get_size(),
+ self.figure_size, font_size,
fig, axes, cax)
self.plots[f]._toggle_axes(draw_axes)
self.plots[f]._toggle_colorbar(draw_colorbar)
- self.plots[f].axes.xaxis.set_label_text(x_title, fontproperties=fp)
- self.plots[f].axes.yaxis.set_label_text(y_title, fontproperties=fp)
- self.plots[f].cax.yaxis.set_label_text(z_title, fontproperties=fp)
+ self.plots[f].axes.xaxis.set_label_text(x_title)
+ self.plots[f].axes.yaxis.set_label_text(y_title)
+ self.plots[f].cax.yaxis.set_label_text(z_title)
if f in self._plot_text:
self.plots[f].axes.text(self._text_xpos[f], self._text_ypos[f],
@@ -839,16 +839,6 @@
if f in self.plot_title:
self.plots[f].axes.set_title(self.plot_title[f])
- ax = self.plots[f].axes
- cbax = self.plots[f].cb.ax
- labels = ((ax.xaxis.get_ticklabels() + ax.yaxis.get_ticklabels() +
- cbax.yaxis.get_ticklabels()) +
- [ax.xaxis.label, ax.yaxis.label, cbax.yaxis.label])
- for label in labels:
- label.set_fontproperties(fp)
- if self._font_color is not None:
- label.set_color(self._font_color)
-
# x-y axes minorticks
if f not in self._minorticks:
self._minorticks[f] = True
@@ -871,6 +861,8 @@
else:
self.plots[f].cax.minorticks_off()
+ self._set_font_properties()
+
self._plot_valid = True
@classmethod
https://bitbucket.org/yt_analysis/yt/commits/12eec0f29f64/
Changeset: 12eec0f29f64
Branch: yt
User: ngoldbaum
Date: 2014-10-29 05:19:19+00:00
Summary: Fixing an issue with PhasePlot.set_title requiring field tuples.
Affected #: 1 file
diff -r 55449303b5f6d24d202696ac5573d995a5cdd50b -r 12eec0f29f64c9af1a3618359c1819d0772ae000 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -1004,8 +1004,8 @@
>>> plot.set_title("cell_mass", "This is a phase plot")
"""
-
- self.plot_title[field] = title
+ self.plot_title[self.data_source._determine_fields(field)[0]] = title
+ return self
@invalidate_plot
def reset_plot(self):
https://bitbucket.org/yt_analysis/yt/commits/ab0c5ed83cc0/
Changeset: ab0c5ed83cc0
Branch: yt
User: jzuhone
Date: 2014-11-06 15:25:42+00:00
Summary: Merged in ngoldbaum/yt (pull request #1288)
Refactor font property logic into one function in the plotting base class
Affected #: 3 files
diff -r 13e9e2fc55a831b17c34aeb7d3030d1ed2752e71 -r ab0c5ed83cc0eff0c8f72e3faca3cecfe9cc93e6 yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -427,6 +427,19 @@
if key not in keys:
del self.frb[key]
+ def _set_font_properties(self):
+ for f in self.plots:
+ ax = self.plots[f].axes
+ cbax = self.plots[f].cb.ax
+ labels = ax.xaxis.get_ticklabels() + ax.yaxis.get_ticklabels()
+ labels += cbax.yaxis.get_ticklabels()
+ labels += [ax.title, ax.xaxis.label, ax.yaxis.label,
+ cbax.yaxis.label]
+ for label in labels:
+ label.set_fontproperties(self._font_properties)
+ if self._font_color is not None:
+ label.set_color(self._font_color)
+
@invalidate_plot
@invalidate_figure
def set_font(self, font_dict=None):
diff -r 13e9e2fc55a831b17c34aeb7d3030d1ed2752e71 -r ab0c5ed83cc0eff0c8f72e3faca3cecfe9cc93e6 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -742,7 +742,7 @@
mylog.warning("Switching to linear colorbar scaling.")
self._field_transform[f] = linear_transform
- fp = self._font_properties
+ font_size = self._font_properties.get_size()
fig = None
axes = None
@@ -761,7 +761,7 @@
image, self._field_transform[f].name,
self._field_transform[f].func,
self._colormaps[f], extent, zlim,
- self.figure_size, fp.get_size(),
+ self.figure_size, font_size,
self.aspect, fig, axes, cax)
axes_unit_labels = ['', '']
@@ -838,14 +838,8 @@
if y_label is not None:
labels[1] = y_label
- self.plots[f].axes.set_xlabel(labels[0],fontproperties=fp)
- self.plots[f].axes.set_ylabel(labels[1],fontproperties=fp)
-
- for label in (self.plots[f].axes.get_xticklabels() +
- self.plots[f].axes.get_yticklabels() +
- [self.plots[f].axes.xaxis.get_offset_text(),
- self.plots[f].axes.yaxis.get_offset_text()]):
- label.set_fontproperties(fp)
+ self.plots[f].axes.set_xlabel(labels[0])
+ self.plots[f].axes.set_ylabel(labels[1])
# Determine the units of the data
units = Unit(self.frb[f].units, registry=self.ds.unit_registry)
@@ -866,13 +860,7 @@
except ParseFatalException, err:
raise YTCannotParseUnitDisplayName(f, colorbar_label, str(err))
- self.plots[f].cb.set_label(colorbar_label, fontproperties=fp)
-
- for label in (self.plots[f].cb.ax.get_xticklabels() +
- self.plots[f].cb.ax.get_yticklabels() +
- [self.plots[f].cb.ax.axes.xaxis.get_offset_text(),
- self.plots[f].cb.ax.axes.yaxis.get_offset_text()]):
- label.set_fontproperties(fp)
+ self.plots[f].cb.set_label(colorbar_label)
# x-y axes minorticks
if f not in self._minorticks:
@@ -908,14 +896,7 @@
if draw_colorbar is False:
self.plots[f]._toggle_colorbar(draw_colorbar)
- if self._font_color is not None:
- ax = self.plots[f].axes
- cbax = self.plots[f].cb.ax
- labels = ax.xaxis.get_ticklabels() + ax.yaxis.get_ticklabels()
- labels += cbax.yaxis.get_ticklabels()
- labels += [ax.xaxis.label, ax.yaxis.label, cbax.yaxis.label]
- for label in labels:
- label.set_color(self._font_color)
+ self._set_font_properties()
self._plot_valid = True
diff -r 13e9e2fc55a831b17c34aeb7d3030d1ed2752e71 -r ab0c5ed83cc0eff0c8f72e3faca3cecfe9cc93e6 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -833,21 +833,21 @@
self._field_transform[f] = linear_transform
zlim = [zmin, np.nanmax(data)]
- fp = self._font_properties
+ font_size = self._font_properties.get_size()
f = self.profile.data_source._determine_fields(f)[0]
self.plots[f] = PhasePlotMPL(self.profile.x, self.profile.y, data,
x_scale, y_scale, z_scale,
self._colormaps[f], zlim,
- self.figure_size, fp.get_size(),
+ self.figure_size, font_size,
fig, axes, cax)
self.plots[f]._toggle_axes(draw_axes)
self.plots[f]._toggle_colorbar(draw_colorbar)
- self.plots[f].axes.xaxis.set_label_text(x_title, fontproperties=fp)
- self.plots[f].axes.yaxis.set_label_text(y_title, fontproperties=fp)
- self.plots[f].cax.yaxis.set_label_text(z_title, fontproperties=fp)
+ self.plots[f].axes.xaxis.set_label_text(x_title)
+ self.plots[f].axes.yaxis.set_label_text(y_title)
+ self.plots[f].cax.yaxis.set_label_text(z_title)
if f in self._plot_text:
self.plots[f].axes.text(self._text_xpos[f], self._text_ypos[f],
@@ -858,16 +858,6 @@
if f in self.plot_title:
self.plots[f].axes.set_title(self.plot_title[f])
- ax = self.plots[f].axes
- cbax = self.plots[f].cb.ax
- labels = ((ax.xaxis.get_ticklabels() + ax.yaxis.get_ticklabels() +
- cbax.yaxis.get_ticklabels()) +
- [ax.xaxis.label, ax.yaxis.label, cbax.yaxis.label])
- for label in labels:
- label.set_fontproperties(fp)
- if self._font_color is not None:
- label.set_color(self._font_color)
-
# x-y axes minorticks
if f not in self._minorticks:
self._minorticks[f] = True
@@ -890,6 +880,8 @@
else:
self.plots[f].cax.minorticks_off()
+ self._set_font_properties()
+
self._plot_valid = True
@classmethod
@@ -1031,8 +1023,8 @@
>>> plot.set_title("cell_mass", "This is a phase plot")
"""
-
- self.plot_title[field] = title
+ self.plot_title[self.data_source._determine_fields(field)[0]] = title
+ return self
@invalidate_plot
def reset_plot(self):
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list