[Yt-svn] commit/yt: MatthewTurk: Adding a set of checks to try to fix 308. The idea is that quadmesh/pcolormesh
Bitbucket
commits-noreply at bitbucket.org
Mon Oct 3 10:34:32 PDT 2011
1 new changeset in yt:
http://bitbucket.org/yt_analysis/yt/changeset/aaf037607cf4/
changeset: aaf037607cf4
branch: yt
user: MatthewTurk
date: 2011-09-26 13:29:03
summary: Adding a set of checks to try to fix 308. The idea is that quadmesh/pcolormesh
is used for some types of plots, but for those types of plots the extents are
also set by matplotlib. So the logic now becomes:
* If there are two components to the image shape, we know it is a VMPlot, so
it does *not* have real data coordinates available. So, we plot the
coordinates like normal. data_coords get translates into possition in the
axis by conversion to pixel space.
* Otherwise, we know we either don't want data coordinates and have a VMplot,
or that we have a quadmesh plot. So we either plot directly or we use the
transAxes transform to get it in axes-space coordinates.
This script demonstrates failure/success:
http://paste.yt-project.org/show/1824/
using data_coords on and off for both projections and phase plots.
affected #: 1 file (-1 bytes)
--- a/yt/visualization/plot_modifications.py Sun Sep 25 13:26:29 2011 -0400
+++ b/yt/visualization/plot_modifications.py Mon Sep 26 07:29:03 2011 -0400
@@ -918,16 +918,18 @@
self.text_args = text_args
def __call__(self, plot):
- if self.data_coords:
+ kwargs = self.text_args.copy()
+ if self.data_coords and len(plot.image._A.shape) == 2:
if len(self.pos) == 3:
pos = (self.pos[x_dict[plot.data.axis]],
self.pos[y_dict[plot.data.axis]])
else: pos = self.pos
x,y = self.convert_to_pixels(plot, pos)
else:
- x = plot.image._A.shape[0] * self.pos[0]
- y = plot.image._A.shape[1] * self.pos[1]
- plot._axes.text(x, y, self.text, **self.text_args)
+ x, y = self.pos
+ if not self.data_coords:
+ kwargs["transform"] = plot._axes.transAxes
+ plot._axes.text(x, y, self.text, **kwargs)
class ParticleCallback(PlotCallback):
_type_name = "particles"
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