The imshow command in matplotlib normally puts the origin in the upper
left. Change your call to imshow to include the argument:
and it may fix your problem. If you look at the yt source, this is
scattered throughout to account for this. You probably also want to
On Mon, Aug 22, 2011 at 7:09 PM, Elizabeth Tasker
I feel I have a co-ordinate problem.
I have a yt script that uses extract_connected_sets to find a bunch of
contoured objects, for which I calculate the centre of mass (core_com
I then cut out a covering_grid centred on each object that is 2 kpc in
I image the slice of the covering_grid through its and over-plot the
positions of the centre of mass of the contoured objects on it.
The problem is, they don't line up!
cloud50.png shows the process centred on object 50. Object 50 itself is
nicely over a blob but the others are randomly scattered. Although
only a slice, the z-direction of the objects differs only slightly: it
shouldn't be possible to have an object sitting over nothing (especially
when the slice effectively shows potential, which varies smoothly).
cloud51.png shows the same process now centred on object 51. 51 is
a clear blob, but you can see that the image has moved differently to
numbers. (The image has shifted down and the numbers way up).
It looks to me that this should be flipped somehow (although
inverting the x-y axes have failed!), but I cannot see where the
The (abbreviated) code looks like:
contours = dd.extract_connected_sets("NegEscapeVelocity", 1, 30.0, maxv,
allcloudcores = contours #cores defined by contour 0
thiscore = allcloudcores[c]
core_com = 
for c in range(ncores):
extractLE = 
extractRE = 
extractDims = 
min_x, max_x = thiscore.quantities["Extrema"]("x")
min_y, max_y = thiscore.quantities["Extrema"]("y")
min_z, max_z = thiscore.quantities["Extrema"]("z")
for dim in range(3):
extractCube = pf.h.covering_grid(extract_level,
num_ghost_zones = 3)
plotfig = pylab.figure()
extent=[extractLE, extractRE, extractLE, extractRE])
colorbar = pylab.colorbar()
colorbar.set_label("Negative escape velocity [km/s]")
for m in range(ncores):
pylab.annotate('%s' % (m), xy=(core_com[m], core_com[m]),
pylab.savefig('clouds_novel%s' % (c))
Is this a problem of where the "zero" point is in yt / enzo / python?
assuming (0,0,0) is the bottom left?
yt-users mailing list
yt-users mailing list