PhasePlot losing negative values
Hi, I’m trying to create a PhasePlot of one component of velocity (which can be negative) as a function of temperature. f = yt.PhasePlot(box, ‘temperature’, ‘velocity_z’,[‘cell_mass’], weight_field=None,fractional=True) f.set_log(‘velocity_z’, False) f.show() This works as expected for cells with positive velocity. However, cells with negative velocities get completely dropped; everything with velocity_z <= 0 is blank. I assume that PhasePlot took the logarithm of velocity_z at some point in producing the plot and lost negative data. Is there an option I’m missing to tell PhasePlot not to do this? Running yt 3.2.2 and python 2.7 on a Mac. Cheers, Alex --------- Alex Hill Senior Postdoctoral Research Associate Office: KINSC Link L106 Department of Astronomy, Haverford College 370 Lancaster Ave, Haverford, PA 19041 USA phone: +1 484 297 2136 email/iMessage: ashill@haverford.edu
Hi Alex,
So I think what's happening is that the call to set_log() doesn't cause the
plot limits for the velocity_z axis to be rescaled, cutting off the
negative values in the plot. This can be fixed by calling set_ylim() after
set_log():
*https://gist.github.com/anonymous/4ec4fdfd66b0eee2015a
https://gist.github.com/anonymous/4ec4fdfd66b0eee2015a*
I think a good enhancement would be to somehow invalidate the plot limits
after calling set_log() so the y-axis limits are automatically
re-determined. I think this would be a reasonably straightforward fix and a
good first yt contribution if you're up for it. If you're not interested in
working on that yourself, can you go ahead and open an issue so we don't
lose this in the shuffle:
https://bitbucket.org/yt_analysis/yt/issues/new
Thanks!
-Nathan
On Thu, Dec 17, 2015 at 2:55 PM, Alex Hill
Hi,
I’m trying to create a PhasePlot of one component of velocity (which can be negative) as a function of temperature.
f = yt.PhasePlot(box, ‘temperature’, ‘velocity_z’,[‘cell_mass’], weight_field=None,fractional=True) f.set_log(‘velocity_z’, False) f.show()
This works as expected for cells with positive velocity. However, cells with negative velocities get completely dropped; everything with velocity_z <= 0 is blank.
I assume that PhasePlot took the logarithm of velocity_z at some point in producing the plot and lost negative data. Is there an option I’m missing to tell PhasePlot not to do this?
Running yt 3.2.2 and python 2.7 on a Mac.
Cheers, Alex
--------- Alex Hill Senior Postdoctoral Research Associate Office: KINSC Link L106 Department of Astronomy, Haverford College 370 Lancaster Ave, Haverford, PA 19041 USA phone: +1 484 297 2136 email/iMessage: ashill@haverford.edu
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Thanks, Nathan. I was doing something similar to that but omitted it from what I included in my first email: f = yt.PhasePlot(box, ‘temperature’, ‘velocity_z’,[‘cell_mass’], weight_field=None,fractional=True) f.set_log(‘velocity_z’, False) ax = f.plots[‘cell_mass’].axes ax.set_ylim(-5e7,5e7) f.show() It turns out that I was running yt 3.1 (though I thought I was running 3.2.2). In 3.1, the whole range was shown after the ax.set_ylim step, but everything at velocity_z <= 0 was white. I see that improved handling of f.set_ylim in this case was noted in the 3.2 release notes. After successfully updating to 3.2.2, with the f.set_ylim step, this works as expected. I’ll look into implementing the fix you suggest in a bit (or open an issue if I don’t get to it soon). Cheers, Alex
On Dec 17, 2015, at 16:13, Nathan Goldbaum
wrote: Hi Alex,
So I think what's happening is that the call to set_log() doesn't cause the plot limits for the velocity_z axis to be rescaled, cutting off the negative values in the plot. This can be fixed by calling set_ylim() after set_log():
https://gist.github.com/anonymous/4ec4fdfd66b0eee2015a
I think a good enhancement would be to somehow invalidate the plot limits after calling set_log() so the y-axis limits are automatically re-determined. I think this would be a reasonably straightforward fix and a good first yt contribution if you're up for it. If you're not interested in working on that yourself, can you go ahead and open an issue so we don't lose this in the shuffle:
https://bitbucket.org/yt_analysis/yt/issues/new
Thanks!
-Nathan
On Thu, Dec 17, 2015 at 2:55 PM, Alex Hill
wrote: Hi, I’m trying to create a PhasePlot of one component of velocity (which can be negative) as a function of temperature.
f = yt.PhasePlot(box, ‘temperature’, ‘velocity_z’,[‘cell_mass’], weight_field=None,fractional=True) f.set_log(‘velocity_z’, False) f.show()
This works as expected for cells with positive velocity. However, cells with negative velocities get completely dropped; everything with velocity_z <= 0 is blank.
I assume that PhasePlot took the logarithm of velocity_z at some point in producing the plot and lost negative data. Is there an option I’m missing to tell PhasePlot not to do this?
Running yt 3.2.2 and python 2.7 on a Mac.
Cheers, Alex
--------- Alex Hill Senior Postdoctoral Research Associate Office: KINSC Link L106 Department of Astronomy, Haverford College 370 Lancaster Ave, Haverford, PA 19041 USA phone: +1 484 297 2136 email/iMessage: ashill@haverford.edu
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (2)
-
Alex Hill
-
Nathan Goldbaum