[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Aug 6 09:37:55 PDT 2015
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/2ead8e1c9e9a/
Changeset: 2ead8e1c9e9a
Branch: yt
User: aajarven
Date: 2015-08-05 09:40:11+00:00
Summary: Fixed multiplot crashing when supplied with profiles and user having to save individual plots before using them in multiplot.
Affected #: 1 file
diff -r fffa77d2fdc205b54fb87befaa50ade850f826d6 -r 2ead8e1c9e9aca1ae5d30e69e4ea8dce212cacf4 yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py
+++ b/yt/visualization/eps_writer.py
@@ -290,7 +290,7 @@
self.axes_drawn = True
#=============================================================================
-
+
def axis_box_yt(self, plot, units=None, bare_axes=False,
tickcolor=None, xlabel=None, ylabel=None, **kwargs):
r"""Wrapper around DualEPS.axis_box to automatically fill in the
@@ -355,7 +355,32 @@
_ylabel = 'y (%s)' % (units)
if tickcolor == None:
_tickcolor = pyx.color.cmyk.white
- elif isinstance(plot, (ProfilePlot, PhasePlot)):
+ elif isinstance(plot, ProfilePlot):
+ subplot = plot.axes.values()[0]
+ # limits for axes
+ xlimits = subplot.get_xlim()
+ _xrange = (YTQuantity(xlimits[0], 'm'), YTQuantity(xlimits[1], 'm')) # unit hardcoded but afaik it is not used anywhere so it doesn't matter
+ if list(plot.axes.ylim.viewvalues())[0][0] is None:
+ ylimits = subplot.get_ylim()
+ else:
+ ylimits = list(plot.axes.ylim.viewvalues())[0]
+ _yrange = (YTQuantity(ylimits[0], 'm'), YTQuantity(ylimits[1], 'm')) # unit hardcoded but afaik it is not used anywhere so it doesn't matter
+ # axis labels
+ xaxis = subplot.xaxis
+ _xlabel = pyxize_label(xaxis.label.get_text())
+ yaxis = subplot.yaxis
+ _ylabel = pyxize_label(yaxis.label.get_text())
+ # set log if necessary
+ if subplot.get_xscale() == "log":
+ _xlog = True
+ else:
+ _xlog = False
+ if subplot.get_yscale() == "log":
+ _ylog = True
+ else:
+ _ylog = False
+ _tickcolor = None
+ elif isinstance(plot, PhasePlot):
k = plot.plots.keys()[0]
_xrange = plot[k].axes.get_xlim()
_yrange = plot[k].axes.get_ylim()
@@ -502,10 +527,7 @@
_p1 = plot.plots[self.field].figure
force_square = True
elif isinstance(plot, ProfilePlot):
- plot._redraw_image()
- # Remove colorbar
- _p1 = plot._figure
- _p1.delaxes(_p1.axes[1])
+ _p1 = plot.figures.items()[0][1]
elif isinstance(plot, np.ndarray):
fig = plt.figure()
iplot = plt.figimage(plot)
@@ -689,6 +711,9 @@
>>> d.colorbar_yt(p)
>>> d.save_fig()
"""
+
+ if isinstance(plot, ProfilePlot):
+ raise RuntimeError("When using ProfilePlots you must either set yt_nocbar=True or provide colorbar flags so that the profiles don't have colorbars")
_cmap = None
if field != None:
self.field = plot.data_source._determine_fields(field)[0]
@@ -1108,6 +1133,7 @@
if yaxis_flags[index] != None:
yaxis = yaxis_flags[index]
if _yt:
+ this_plot._setup_plots()
if xlabels != None:
xlabel = xlabels[i]
else:
https://bitbucket.org/yt_analysis/yt/commits/6d186e7997e1/
Changeset: 6d186e7997e1
Branch: yt
User: xarthisius
Date: 2015-08-06 16:37:47+00:00
Summary: Merged in aajarven/yt (pull request #1676)
eps_writer update
Affected #: 1 file
diff -r 8af567aaf3051efe31a8a0a5ff5d48cb337b4a0f -r 6d186e7997e1c46619cfa74531cb3a493c4b9d21 yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py
+++ b/yt/visualization/eps_writer.py
@@ -290,7 +290,7 @@
self.axes_drawn = True
#=============================================================================
-
+
def axis_box_yt(self, plot, units=None, bare_axes=False,
tickcolor=None, xlabel=None, ylabel=None, **kwargs):
r"""Wrapper around DualEPS.axis_box to automatically fill in the
@@ -355,7 +355,32 @@
_ylabel = 'y (%s)' % (units)
if tickcolor == None:
_tickcolor = pyx.color.cmyk.white
- elif isinstance(plot, (ProfilePlot, PhasePlot)):
+ elif isinstance(plot, ProfilePlot):
+ subplot = plot.axes.values()[0]
+ # limits for axes
+ xlimits = subplot.get_xlim()
+ _xrange = (YTQuantity(xlimits[0], 'm'), YTQuantity(xlimits[1], 'm')) # unit hardcoded but afaik it is not used anywhere so it doesn't matter
+ if list(plot.axes.ylim.viewvalues())[0][0] is None:
+ ylimits = subplot.get_ylim()
+ else:
+ ylimits = list(plot.axes.ylim.viewvalues())[0]
+ _yrange = (YTQuantity(ylimits[0], 'm'), YTQuantity(ylimits[1], 'm')) # unit hardcoded but afaik it is not used anywhere so it doesn't matter
+ # axis labels
+ xaxis = subplot.xaxis
+ _xlabel = pyxize_label(xaxis.label.get_text())
+ yaxis = subplot.yaxis
+ _ylabel = pyxize_label(yaxis.label.get_text())
+ # set log if necessary
+ if subplot.get_xscale() == "log":
+ _xlog = True
+ else:
+ _xlog = False
+ if subplot.get_yscale() == "log":
+ _ylog = True
+ else:
+ _ylog = False
+ _tickcolor = None
+ elif isinstance(plot, PhasePlot):
k = plot.plots.keys()[0]
_xrange = plot[k].axes.get_xlim()
_yrange = plot[k].axes.get_ylim()
@@ -502,10 +527,7 @@
_p1 = plot.plots[self.field].figure
force_square = True
elif isinstance(plot, ProfilePlot):
- plot._redraw_image()
- # Remove colorbar
- _p1 = plot._figure
- _p1.delaxes(_p1.axes[1])
+ _p1 = plot.figures.items()[0][1]
elif isinstance(plot, np.ndarray):
fig = plt.figure()
iplot = plt.figimage(plot)
@@ -689,6 +711,9 @@
>>> d.colorbar_yt(p)
>>> d.save_fig()
"""
+
+ if isinstance(plot, ProfilePlot):
+ raise RuntimeError("When using ProfilePlots you must either set yt_nocbar=True or provide colorbar flags so that the profiles don't have colorbars")
_cmap = None
if field != None:
self.field = plot.data_source._determine_fields(field)[0]
@@ -1108,6 +1133,7 @@
if yaxis_flags[index] != None:
yaxis = yaxis_flags[index]
if _yt:
+ this_plot._setup_plots()
if xlabels != None:
xlabel = xlabels[i]
else:
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