[yt-svn] commit/yt: 4 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Oct 21 04:41:25 PDT 2014
4 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/f8c7a1dca86a/
Changeset: f8c7a1dca86a
Branch: yt
User: aaron_smith
Date: 2014-10-20 14:59:30+00:00
Summary: Added support for minor ticks.
Affected #: 3 files
diff -r 06c5cb9b11174a8d24c6e9f30181c0f03a0da3d9 -r f8c7a1dca86a5e60a2e5adc32d34f38f3b4e56dc doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -531,6 +531,29 @@
slc.set_buff_size(1600)
slc.save()
+Turning off minorticks
+~~~~~~~~~~~~~~~~~~~~~~
+
+By default minorticks for the x and y axes are turned on.
+The minorticks may be removed using the
+:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.minorticks_off` function,
+which either accepts a specific field name or will apply to all associated plots
+if no argument is given. There is also a
+:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.minorticks_on` function
+so minorticks may be turned on again. Finally, there are analogous
+:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.cbar_minorticks_off` and
+:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.cbar_minorticks_on` functions
+for the colorbar axis.
+
+.. python-script::
+
+ import yt
+ ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = yt.SlicePlot(ds, 'z', 'density', width=(10,'kpc'))
+ slc.minorticks_off()
+ slc.cbar_minorticks_off()
+ slc.save()
+
.. _matplotlib-customization:
Further customization via matplotlib
@@ -743,7 +766,7 @@
Adjusting the plot units does not require recreating the histogram, so adjusting
units will always be inexpensive, requiring only an in-place unit conversion.
-In the following example we create a a plot of the average density in solar
+In the following example we create a plot of the average density in solar
masses per cubic parsec as a function of radius in kiloparsecs.
.. python-script::
@@ -892,7 +915,7 @@
``fractional`` keyword to ``True``. When set to ``True``, the value in each bin
is divided by the sum total from all bins. These can be turned into cumulative
distribution functions (CDFs) by setting the ``accumulation`` keyword to
-``True``. This will make is so that the value in any bin N is the cumulative
+``True``. This will make it so that the value in any bin N is the cumulative
sum of all bins from 0 to N. The direction of the summation can be reversed by
setting ``accumulation`` to ``-True``. For ``PhasePlot``, the accumulation can
be set independently for each axis by setting ``accumulation`` to a list of
diff -r 06c5cb9b11174a8d24c6e9f30181c0f03a0da3d9 -r f8c7a1dca86a5e60a2e5adc32d34f38f3b4e56dc yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -80,6 +80,53 @@
return args[0]
return newfunc
+def get_log_minorticks(vmin, vmax):
+ """calculate positions of linear minorticks on a log colorbar
+
+ Parameters
+ ----------
+ vmin : float
+ the minimum value in the colorbar
+ vmax : float
+ the maximum value in the colorbar
+
+ """
+ expA = np.floor(np.log10(vmin))
+ expB = np.floor(np.log10(vmax))
+ cofA = np.ceil(vmin/10**expA)
+ cofB = np.floor(vmax/10**expB)
+ lmticks = []
+ while cofA*10**expA <= cofB*10**expB:
+ if expA < expB:
+ lmticks = np.hstack( (lmticks, np.linspace(cofA, 9, 10-cofA)*10**expA) )
+ cofA = 1
+ expA += 1
+ else:
+ lmticks = np.hstack( (lmticks, np.linspace(cofA, cofB, cofB-cofA+1)*10**expA) )
+ expA += 1
+ return np.array(lmticks)
+
+def get_symlog_minorticks(linthresh, vmin, vmax):
+ """calculate positions of linear minorticks on a log colorbar
+
+ Parameters
+ ----------
+ linthresh: float
+ the threshold for the linear region
+ vmin : float
+ the minimum value in the colorbar
+ vmax : float
+ the maximum value in the colorbar
+
+ """
+ if vmin >= 0 or vmax <= 0:
+ raise RuntimeError(
+ '''attempting to set minorticks for
+ a symlog plot with one-sided data:
+ got vmin = %s, vmax = %s''' % (vmin, vmax))
+ return np.hstack( (-get_log_minorticks(linthresh,-vmin)[::-1], 0,
+ get_log_minorticks(linthresh, vmax)) )
+
field_transforms = {}
@@ -144,6 +191,8 @@
self._font_color = None
self._xlabel = None
self._ylabel = None
+ self._minorticks = {}
+ self._cbar_minorticks = {}
self._colorbar_label = PlotDictionary(
self.data_source, lambda: None)
@@ -280,6 +329,90 @@
self.plots[field].zmax = myzmax
return self
+ @invalidate_plot
+ def minorticks_off(self, field='all'):
+ """remove minor ticks from the current plot
+
+ Displaying minor ticks reduces performance; turn them off
+ using minorticks_off() if drawing speed is a problem.
+
+ Parameters
+ ----------
+ field : string
+ the field to remove minorticks
+
+ """
+ if field == 'all':
+ fields = self.plots.keys()
+ else:
+ fields = [field]
+ for field in self.data_source._determine_fields(fields):
+ self._minorticks[field] = False
+ return self
+
+ @invalidate_plot
+ def minorticks_on(self, field='all'):
+ """display minor ticks on the current plot
+
+ Displaying minor ticks reduces performance; turn them off
+ using minorticks_off() if drawing speed is a problem.
+
+ Parameters
+ ----------
+ field : string
+ the field to display minorticks
+
+ """
+ if field == 'all':
+ fields = self.plots.keys()
+ else:
+ fields = [field]
+ for field in self.data_source._determine_fields(fields):
+ self._minorticks[field] = True
+ return self
+
+ @invalidate_plot
+ def cbar_minorticks_off(self, field='all'):
+ """remove colorbar minor ticks from the current plot
+
+ Displaying minor ticks reduces performance; turn them off
+ using cbar_minorticks_off() if drawing speed is a problem.
+
+ Parameters
+ ----------
+ field : string
+ the field to remove colorbar minorticks
+
+ """
+ if field == 'all':
+ fields = self.plots.keys()
+ else:
+ fields = [field]
+ for field in self.data_source._determine_fields(fields):
+ self._cbar_minorticks[field] = False
+ return self
+
+ @invalidate_plot
+ def cbar_minorticks_on(self, field='all'):
+ """display colorbar minor ticks on the current plot
+
+ Displaying minor ticks reduces performance; turn them off
+ using cbar_minorticks_off() if drawing speed is a problem.
+
+ Parameters
+ ----------
+ field : string
+ the field to display colorbar minorticks
+
+ """
+ if field == 'all':
+ fields = self.plots.keys()
+ else:
+ fields = [field]
+ for field in self.data_source._determine_fields(fields):
+ self._cbar_minorticks[field] = True
+ return self
+
def setup_callbacks(self):
# Left blank to be overriden in subclasses
pass
diff -r 06c5cb9b11174a8d24c6e9f30181c0f03a0da3d9 -r f8c7a1dca86a5e60a2e5adc32d34f38f3b4e56dc yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -35,6 +35,7 @@
from .plot_container import \
ImagePlotContainer, \
log_transform, linear_transform, symlog_transform, \
+ get_log_minorticks, get_symlog_minorticks, \
invalidate_data, invalidate_plot, apply_callback
from yt.data_objects.time_series import \
@@ -873,6 +874,34 @@
self.plots[f].cb.ax.axes.yaxis.get_offset_text()]):
label.set_fontproperties(fp)
+ # x-y axes minorticks
+ if f not in self._minorticks:
+ self._minorticks[f] = True
+ if self._minorticks[f] is True:
+ self.plots[f].axes.minorticks_on()
+ else:
+ self.plots[f].axes.minorticks_off()
+
+ # colorbar minorticks
+ if f not in self._cbar_minorticks:
+ self._cbar_minorticks[f] = True
+ if self._cbar_minorticks[f] is True:
+ if self._field_transform[f] == linear_transform:
+ self.plots[f].cax.minorticks_on()
+ else:
+ vmin = self.plots[f].cb.norm.vmin
+ vmax = self.plots[f].cb.norm.vmax
+ if self._field_transform[f] == log_transform:
+ mticks = self.plots[f].image.norm( get_log_minorticks(vmin, vmax) )
+ else: # symlog_transform
+ if isinstance(vmin, YTArray): vmin = vmin.d
+ if isinstance(vmax, YTArray): vmax = vmax.d
+ flinthresh = 10**np.floor( np.log10( self.plots[f].cb.norm.linthresh ) )
+ mticks = self.plots[f].image.norm( get_symlog_minorticks(flinthresh, vmin, vmax) )
+ self.plots[f].cax.yaxis.set_ticks(mticks, minor=True)
+ else:
+ self.plots[f].cax.minorticks_off()
+
self.run_callbacks(f)
if draw_axes is False:
https://bitbucket.org/yt_analysis/yt/commits/3dcf093dfeca/
Changeset: 3dcf093dfeca
Branch: yt
User: aaron_smith
Date: 2014-10-20 17:05:00+00:00
Summary: Modified the get_symlog_minorticks docstring
Affected #: 1 file
diff -r f8c7a1dca86a5e60a2e5adc32d34f38f3b4e56dc -r 3dcf093dfeca2844d5e922ad5b0bfa69bcbc9a51 yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -107,7 +107,7 @@
return np.array(lmticks)
def get_symlog_minorticks(linthresh, vmin, vmax):
- """calculate positions of linear minorticks on a log colorbar
+ """calculate positions of linear minorticks on a symmetric log colorbar
Parameters
----------
https://bitbucket.org/yt_analysis/yt/commits/b9cffb8f8824/
Changeset: b9cffb8f8824
Branch: yt
User: aaron_smith
Date: 2014-10-21 00:17:21+00:00
Summary: PhasePlots also have minor tick support
Affected #: 4 files
diff -r 3dcf093dfeca2844d5e922ad5b0bfa69bcbc9a51 -r b9cffb8f88241913b56fde84638a89c26f3dff24 doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -536,22 +536,19 @@
By default minorticks for the x and y axes are turned on.
The minorticks may be removed using the
-:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.minorticks_off` function,
-which either accepts a specific field name or will apply to all associated plots
-if no argument is given. There is also a
-:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.minorticks_on` function
-so minorticks may be turned on again. Finally, there are analogous
-:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.cbar_minorticks_off` and
-:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.cbar_minorticks_on` functions
-for the colorbar axis.
+:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.set_minorticks`
+function, which either accepts a specific field name including the 'all' alias
+and the desired state for the plot as 'on' or 'off'. There is also an analogous
+:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.set_cbar_minorticks`
+function for the colorbar axis.
.. python-script::
import yt
ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
slc = yt.SlicePlot(ds, 'z', 'density', width=(10,'kpc'))
- slc.minorticks_off()
- slc.cbar_minorticks_off()
+ slc.set_minorticks('all', 'off')
+ slc.set_cbar_minorticks('all', 'off')
slc.save()
.. _matplotlib-customization:
diff -r 3dcf093dfeca2844d5e922ad5b0bfa69bcbc9a51 -r b9cffb8f88241913b56fde84638a89c26f3dff24 yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -330,16 +330,18 @@
return self
@invalidate_plot
- def minorticks_off(self, field='all'):
- """remove minor ticks from the current plot
+ def set_minorticks(self, field, state):
+ """turn minor ticks on or off in the current plot
- Displaying minor ticks reduces performance; turn them off
- using minorticks_off() if drawing speed is a problem.
+ Displaying minor ticks reduces performance; turn them off
+ using set_minorticks('all', 'off') if drawing speed is a problem.
Parameters
----------
field : string
the field to remove minorticks
+ state : string
+ the state indicating 'on' or 'off'
"""
if field == 'all':
@@ -347,20 +349,25 @@
else:
fields = [field]
for field in self.data_source._determine_fields(fields):
- self._minorticks[field] = False
+ if state == 'on':
+ self._minorticks[field] = True
+ else:
+ self._minorticks[field] = False
return self
@invalidate_plot
- def minorticks_on(self, field='all'):
- """display minor ticks on the current plot
+ def set_cbar_minorticks(self, field, state):
+ """turn colorbar minor ticks on or off in the current plot
Displaying minor ticks reduces performance; turn them off
- using minorticks_off() if drawing speed is a problem.
+ using set_cbar_minorticks('all', 'off') if drawing speed is a problem.
Parameters
----------
field : string
- the field to display minorticks
+ the field to remove colorbar minorticks
+ state : string
+ the state indicating 'on' or 'off'
"""
if field == 'all':
@@ -368,49 +375,10 @@
else:
fields = [field]
for field in self.data_source._determine_fields(fields):
- self._minorticks[field] = True
- return self
-
- @invalidate_plot
- def cbar_minorticks_off(self, field='all'):
- """remove colorbar minor ticks from the current plot
-
- Displaying minor ticks reduces performance; turn them off
- using cbar_minorticks_off() if drawing speed is a problem.
-
- Parameters
- ----------
- field : string
- the field to remove colorbar minorticks
-
- """
- if field == 'all':
- fields = self.plots.keys()
- else:
- fields = [field]
- for field in self.data_source._determine_fields(fields):
- self._cbar_minorticks[field] = False
- return self
-
- @invalidate_plot
- def cbar_minorticks_on(self, field='all'):
- """display colorbar minor ticks on the current plot
-
- Displaying minor ticks reduces performance; turn them off
- using cbar_minorticks_off() if drawing speed is a problem.
-
- Parameters
- ----------
- field : string
- the field to display colorbar minorticks
-
- """
- if field == 'all':
- fields = self.plots.keys()
- else:
- fields = [field]
- for field in self.data_source._determine_fields(fields):
- self._cbar_minorticks[field] = True
+ if state == 'on':
+ self._cbar_minorticks[field] = True
+ else:
+ self._cbar_minorticks[field] = False
return self
def setup_callbacks(self):
diff -r 3dcf093dfeca2844d5e922ad5b0bfa69bcbc9a51 -r b9cffb8f88241913b56fde84638a89c26f3dff24 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -894,10 +894,8 @@
if self._field_transform[f] == log_transform:
mticks = self.plots[f].image.norm( get_log_minorticks(vmin, vmax) )
else: # symlog_transform
- if isinstance(vmin, YTArray): vmin = vmin.d
- if isinstance(vmax, YTArray): vmax = vmax.d
flinthresh = 10**np.floor( np.log10( self.plots[f].cb.norm.linthresh ) )
- mticks = self.plots[f].image.norm( get_symlog_minorticks(flinthresh, vmin, vmax) )
+ mticks = self.plots[f].image.norm( get_symlog_minorticks(flinthresh, vmin.d, vmax.d) )
self.plots[f].cax.yaxis.set_ticks(mticks, minor=True)
else:
self.plots[f].cax.minorticks_off()
diff -r 3dcf093dfeca2844d5e922ad5b0bfa69bcbc9a51 -r b9cffb8f88241913b56fde84638a89c26f3dff24 yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -29,7 +29,7 @@
from .base_plot_types import ImagePlotMPL
from .plot_container import \
ImagePlotContainer, \
- log_transform, linear_transform
+ log_transform, linear_transform, get_log_minorticks
from yt.data_objects.profiles import \
create_profile
from yt.utilities.exceptions import \
@@ -848,6 +848,29 @@
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
+ if self._minorticks[f] is True:
+ self.plots[f].axes.minorticks_on()
+ else:
+ self.plots[f].axes.minorticks_off()
+
+ # colorbar minorticks
+ if f not in self._cbar_minorticks:
+ self._cbar_minorticks[f] = True
+ if self._cbar_minorticks[f] is True:
+ if self._field_transform[f] == linear_transform:
+ self.plots[f].cax.minorticks_on()
+ else:
+ vmin = self.plots[f].cb.norm.vmin
+ vmax = self.plots[f].cb.norm.vmax
+ mticks = self.plots[f].image.norm( get_log_minorticks(vmin.d, vmax.d) )
+ self.plots[f].cax.yaxis.set_ticks(mticks, minor=True)
+ else:
+ self.plots[f].cax.minorticks_off()
+
self._plot_valid = True
@classmethod
https://bitbucket.org/yt_analysis/yt/commits/de7802382dc0/
Changeset: de7802382dc0
Branch: yt
User: MatthewTurk
Date: 2014-10-21 11:41:13+00:00
Summary: Merged in aaron_smith/yt-aaron (pull request #1273)
Support for minor ticks
Affected #: 4 files
diff -r 2972a66a5c6e830050263882e3eca08e3f9691ac -r de7802382dc0cc71b3e1eb15b37bbdcfec5b218a doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -546,6 +546,26 @@
slc.set_buff_size(1600)
slc.save()
+Turning off minorticks
+~~~~~~~~~~~~~~~~~~~~~~
+
+By default minorticks for the x and y axes are turned on.
+The minorticks may be removed using the
+:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.set_minorticks`
+function, which either accepts a specific field name including the 'all' alias
+and the desired state for the plot as 'on' or 'off'. There is also an analogous
+:meth:`~yt.visualization.plot_window.AxisAlignedSlicePlot.set_cbar_minorticks`
+function for the colorbar axis.
+
+.. python-script::
+
+ import yt
+ ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ slc = yt.SlicePlot(ds, 'z', 'density', width=(10,'kpc'))
+ slc.set_minorticks('all', 'off')
+ slc.set_cbar_minorticks('all', 'off')
+ slc.save()
+
.. _matplotlib-customization:
Further customization via matplotlib
@@ -758,7 +778,7 @@
Adjusting the plot units does not require recreating the histogram, so adjusting
units will always be inexpensive, requiring only an in-place unit conversion.
-In the following example we create a a plot of the average density in solar
+In the following example we create a plot of the average density in solar
masses per cubic parsec as a function of radius in kiloparsecs.
.. python-script::
@@ -907,7 +927,7 @@
``fractional`` keyword to ``True``. When set to ``True``, the value in each bin
is divided by the sum total from all bins. These can be turned into cumulative
distribution functions (CDFs) by setting the ``accumulation`` keyword to
-``True``. This will make is so that the value in any bin N is the cumulative
+``True``. This will make it so that the value in any bin N is the cumulative
sum of all bins from 0 to N. The direction of the summation can be reversed by
setting ``accumulation`` to ``-True``. For ``PhasePlot``, the accumulation can
be set independently for each axis by setting ``accumulation`` to a list of
diff -r 2972a66a5c6e830050263882e3eca08e3f9691ac -r de7802382dc0cc71b3e1eb15b37bbdcfec5b218a yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -80,6 +80,53 @@
return args[0]
return newfunc
+def get_log_minorticks(vmin, vmax):
+ """calculate positions of linear minorticks on a log colorbar
+
+ Parameters
+ ----------
+ vmin : float
+ the minimum value in the colorbar
+ vmax : float
+ the maximum value in the colorbar
+
+ """
+ expA = np.floor(np.log10(vmin))
+ expB = np.floor(np.log10(vmax))
+ cofA = np.ceil(vmin/10**expA)
+ cofB = np.floor(vmax/10**expB)
+ lmticks = []
+ while cofA*10**expA <= cofB*10**expB:
+ if expA < expB:
+ lmticks = np.hstack( (lmticks, np.linspace(cofA, 9, 10-cofA)*10**expA) )
+ cofA = 1
+ expA += 1
+ else:
+ lmticks = np.hstack( (lmticks, np.linspace(cofA, cofB, cofB-cofA+1)*10**expA) )
+ expA += 1
+ return np.array(lmticks)
+
+def get_symlog_minorticks(linthresh, vmin, vmax):
+ """calculate positions of linear minorticks on a symmetric log colorbar
+
+ Parameters
+ ----------
+ linthresh: float
+ the threshold for the linear region
+ vmin : float
+ the minimum value in the colorbar
+ vmax : float
+ the maximum value in the colorbar
+
+ """
+ if vmin >= 0 or vmax <= 0:
+ raise RuntimeError(
+ '''attempting to set minorticks for
+ a symlog plot with one-sided data:
+ got vmin = %s, vmax = %s''' % (vmin, vmax))
+ return np.hstack( (-get_log_minorticks(linthresh,-vmin)[::-1], 0,
+ get_log_minorticks(linthresh, vmax)) )
+
field_transforms = {}
@@ -144,6 +191,8 @@
self._font_color = None
self._xlabel = None
self._ylabel = None
+ self._minorticks = {}
+ self._cbar_minorticks = {}
self._colorbar_label = PlotDictionary(
self.data_source, lambda: None)
@@ -280,6 +329,58 @@
self.plots[field].zmax = myzmax
return self
+ @invalidate_plot
+ def set_minorticks(self, field, state):
+ """turn minor ticks on or off in the current plot
+
+ Displaying minor ticks reduces performance; turn them off
+ using set_minorticks('all', 'off') if drawing speed is a problem.
+
+ Parameters
+ ----------
+ field : string
+ the field to remove minorticks
+ state : string
+ the state indicating 'on' or 'off'
+
+ """
+ if field == 'all':
+ fields = self.plots.keys()
+ else:
+ fields = [field]
+ for field in self.data_source._determine_fields(fields):
+ if state == 'on':
+ self._minorticks[field] = True
+ else:
+ self._minorticks[field] = False
+ return self
+
+ @invalidate_plot
+ def set_cbar_minorticks(self, field, state):
+ """turn colorbar minor ticks on or off in the current plot
+
+ Displaying minor ticks reduces performance; turn them off
+ using set_cbar_minorticks('all', 'off') if drawing speed is a problem.
+
+ Parameters
+ ----------
+ field : string
+ the field to remove colorbar minorticks
+ state : string
+ the state indicating 'on' or 'off'
+
+ """
+ if field == 'all':
+ fields = self.plots.keys()
+ else:
+ fields = [field]
+ for field in self.data_source._determine_fields(fields):
+ if state == 'on':
+ self._cbar_minorticks[field] = True
+ else:
+ self._cbar_minorticks[field] = False
+ return self
+
def setup_callbacks(self):
# Left blank to be overriden in subclasses
pass
diff -r 2972a66a5c6e830050263882e3eca08e3f9691ac -r de7802382dc0cc71b3e1eb15b37bbdcfec5b218a yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -35,6 +35,7 @@
from .plot_container import \
ImagePlotContainer, \
log_transform, linear_transform, symlog_transform, \
+ get_log_minorticks, get_symlog_minorticks, \
invalidate_data, invalidate_plot, apply_callback
from yt.data_objects.time_series import \
@@ -873,6 +874,32 @@
self.plots[f].cb.ax.axes.yaxis.get_offset_text()]):
label.set_fontproperties(fp)
+ # x-y axes minorticks
+ if f not in self._minorticks:
+ self._minorticks[f] = True
+ if self._minorticks[f] is True:
+ self.plots[f].axes.minorticks_on()
+ else:
+ self.plots[f].axes.minorticks_off()
+
+ # colorbar minorticks
+ if f not in self._cbar_minorticks:
+ self._cbar_minorticks[f] = True
+ if self._cbar_minorticks[f] is True:
+ if self._field_transform[f] == linear_transform:
+ self.plots[f].cax.minorticks_on()
+ else:
+ vmin = self.plots[f].cb.norm.vmin
+ vmax = self.plots[f].cb.norm.vmax
+ if self._field_transform[f] == log_transform:
+ mticks = self.plots[f].image.norm( get_log_minorticks(vmin, vmax) )
+ else: # symlog_transform
+ flinthresh = 10**np.floor( np.log10( self.plots[f].cb.norm.linthresh ) )
+ mticks = self.plots[f].image.norm( get_symlog_minorticks(flinthresh, vmin.d, vmax.d) )
+ self.plots[f].cax.yaxis.set_ticks(mticks, minor=True)
+ else:
+ self.plots[f].cax.minorticks_off()
+
self.run_callbacks(f)
if draw_axes is False:
diff -r 2972a66a5c6e830050263882e3eca08e3f9691ac -r de7802382dc0cc71b3e1eb15b37bbdcfec5b218a yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -29,7 +29,7 @@
from .base_plot_types import ImagePlotMPL
from .plot_container import \
ImagePlotContainer, \
- log_transform, linear_transform
+ log_transform, linear_transform, get_log_minorticks
from yt.data_objects.profiles import \
create_profile
from yt.utilities.exceptions import \
@@ -848,6 +848,29 @@
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
+ if self._minorticks[f] is True:
+ self.plots[f].axes.minorticks_on()
+ else:
+ self.plots[f].axes.minorticks_off()
+
+ # colorbar minorticks
+ if f not in self._cbar_minorticks:
+ self._cbar_minorticks[f] = True
+ if self._cbar_minorticks[f] is True:
+ if self._field_transform[f] == linear_transform:
+ self.plots[f].cax.minorticks_on()
+ else:
+ vmin = self.plots[f].cb.norm.vmin
+ vmax = self.plots[f].cb.norm.vmax
+ mticks = self.plots[f].image.norm( get_log_minorticks(vmin.d, vmax.d) )
+ self.plots[f].cax.yaxis.set_ticks(mticks, minor=True)
+ else:
+ self.plots[f].cax.minorticks_off()
+
self._plot_valid = True
@classmethod
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