[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Oct 26 11:38:13 PDT 2015
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/c9cf9ab3b5fb/
Changeset: c9cf9ab3b5fb
Branch: yt
User: ngoldbaum
Date: 2015-10-18 19:04:29+00:00
Summary: Making the xlim and ylim of the PhasePlot plot axes controllable
Affected #: 1 file
diff -r ca754f897f2f44a4c2a9415b3aed977a0d1a4df0 -r c9cf9ab3b5fb946160632fe26cdfe1b32e75bbba yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -709,6 +709,8 @@
plot_title = None
_plot_valid = False
_plot_type = 'Phase'
+ _xlim = (None, None)
+ _ylim = (None, None)
def __init__(self, data_source, x_field, y_field, z_fields,
weight_field="cell_mass", x_bins=128, y_bins=128,
@@ -813,6 +815,8 @@
draw_colorbar = True
draw_axes = True
zlim = (None, None)
+ xlim = self._xlim
+ ylim = self._ylim
if f in self.plots:
draw_colorbar = self.plots[f]._draw_colorbar
draw_axes = self.plots[f]._draw_axes
@@ -868,6 +872,9 @@
self.plots[f].axes.yaxis.set_label_text(y_title)
self.plots[f].cax.yaxis.set_label_text(z_title)
+ self.plots[f].axes.set_xlim(xlim)
+ self.plots[f].axes.set_ylim(ylim)
+
if f in self._plot_text:
self.plots[f].axes.text(self._text_xpos[f], self._text_ypos[f],
self._plot_text[f],
@@ -1173,6 +1180,7 @@
**additional_kwargs)
for field in zunits:
self.profile.set_field_unit(field, zunits[field])
+ self._xlim = (xmin, xmax)
return self
@invalidate_plot
@@ -1237,6 +1245,7 @@
**additional_kwargs)
for field in zunits:
self.profile.set_field_unit(field, zunits[field])
+ self._ylim = (ymin, ymax)
return self
https://bitbucket.org/yt_analysis/yt/commits/fd3b856aa9c7/
Changeset: fd3b856aa9c7
Branch: yt
User: ngoldbaum
Date: 2015-10-18 14:18:17+00:00
Summary: Add a test for this functionality
Affected #: 1 file
diff -r c9cf9ab3b5fb946160632fe26cdfe1b32e75bbba -r fd3b856aa9c73c89f569afe1b27b0a3b91202f1b yt/visualization/tests/test_profile_plots.py
--- a/yt/visualization/tests/test_profile_plots.py
+++ b/yt/visualization/tests/test_profile_plots.py
@@ -19,7 +19,9 @@
from yt.data_objects.profiles import create_profile
from yt.extern.parameterized import\
parameterized, param
-from yt.testing import fake_random_ds
+from yt.testing import \
+ fake_random_ds, \
+ assert_array_almost_equal
from yt.visualization.profile_plotter import \
ProfilePlot, PhasePlot
from yt.visualization.tests.test_plotwindow import \
@@ -60,6 +62,15 @@
p2d = create_profile(reg, [x_field, y_field], z_field,
n_bins=[16, 16])
phases.append(PhasePlot.from_profile(p2d))
+ pp = PhasePlot(test_ds.all_data(), 'density', 'temperature', 'cell_mass')
+ pp.set_xlim(0.3, 0.8)
+ pp.set_ylim(0.4, 0.6)
+ pp._setup_plots()
+ xlim = pp.plots['cell_mass'].axes.get_xlim()
+ ylim = pp.plots['cell_mass'].axes.get_ylim()
+ assert_array_almost_equal(xlim, (0.3, 0.8))
+ assert_array_almost_equal(ylim, (0.4, 0.6))
+ phases.append(pp)
cls.profiles = profiles
cls.phases = phases
cls.ds = test_ds
https://bitbucket.org/yt_analysis/yt/commits/2096df33b692/
Changeset: 2096df33b692
Branch: yt
User: ngoldbaum
Date: 2015-10-26 18:36:45+00:00
Summary: Merged in ngoldbaum/yt (pull request #1821)
Making the xlim and ylim of the PhasePlot plot axes controllable
Affected #: 2 files
diff -r 7a2cc5af89cf0911fbdb5460963ee3844ba3de7b -r 2096df33b692550e8090b58bf31da407b35cc2dd yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -709,6 +709,8 @@
plot_title = None
_plot_valid = False
_plot_type = 'Phase'
+ _xlim = (None, None)
+ _ylim = (None, None)
def __init__(self, data_source, x_field, y_field, z_fields,
weight_field="cell_mass", x_bins=128, y_bins=128,
@@ -813,6 +815,8 @@
draw_colorbar = True
draw_axes = True
zlim = (None, None)
+ xlim = self._xlim
+ ylim = self._ylim
if f in self.plots:
draw_colorbar = self.plots[f]._draw_colorbar
draw_axes = self.plots[f]._draw_axes
@@ -868,6 +872,9 @@
self.plots[f].axes.yaxis.set_label_text(y_title)
self.plots[f].cax.yaxis.set_label_text(z_title)
+ self.plots[f].axes.set_xlim(xlim)
+ self.plots[f].axes.set_ylim(ylim)
+
if f in self._plot_text:
self.plots[f].axes.text(self._text_xpos[f], self._text_ypos[f],
self._plot_text[f],
@@ -1173,6 +1180,7 @@
**additional_kwargs)
for field in zunits:
self.profile.set_field_unit(field, zunits[field])
+ self._xlim = (xmin, xmax)
return self
@invalidate_plot
@@ -1237,6 +1245,7 @@
**additional_kwargs)
for field in zunits:
self.profile.set_field_unit(field, zunits[field])
+ self._ylim = (ymin, ymax)
return self
diff -r 7a2cc5af89cf0911fbdb5460963ee3844ba3de7b -r 2096df33b692550e8090b58bf31da407b35cc2dd yt/visualization/tests/test_profile_plots.py
--- a/yt/visualization/tests/test_profile_plots.py
+++ b/yt/visualization/tests/test_profile_plots.py
@@ -19,7 +19,9 @@
from yt.data_objects.profiles import create_profile
from yt.extern.parameterized import\
parameterized, param
-from yt.testing import fake_random_ds
+from yt.testing import \
+ fake_random_ds, \
+ assert_array_almost_equal
from yt.visualization.profile_plotter import \
ProfilePlot, PhasePlot
from yt.visualization.tests.test_plotwindow import \
@@ -60,6 +62,15 @@
p2d = create_profile(reg, [x_field, y_field], z_field,
n_bins=[16, 16])
phases.append(PhasePlot.from_profile(p2d))
+ pp = PhasePlot(test_ds.all_data(), 'density', 'temperature', 'cell_mass')
+ pp.set_xlim(0.3, 0.8)
+ pp.set_ylim(0.4, 0.6)
+ pp._setup_plots()
+ xlim = pp.plots['cell_mass'].axes.get_xlim()
+ ylim = pp.plots['cell_mass'].axes.get_ylim()
+ assert_array_almost_equal(xlim, (0.3, 0.8))
+ assert_array_almost_equal(ylim, (0.4, 0.6))
+ phases.append(pp)
cls.profiles = profiles
cls.phases = phases
cls.ds = test_ds
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