[yt-users] Coexistence of positive and negative values on a SlicePlot in log scale

John Zuhone jzuhone at gmail.com
Wed Jul 16 16:06:46 PDT 2014


Hi Suoqing,

Probably cannot do what you're looking for with PlotWindow, but you
might want to try Matplotlib's symlog:

http://matplotlib.org/examples/pylab_examples/symlog_demo.html

This is what the S-Z projection analysis module does, see the images
of the S-Z decrement/increment here:

http://yt-project.org/doc/analyzing/analysis_modules/sunyaev_zeldovich.html

If you look in the code in
yt.analysis_modules.sunyaev_zeldovich.projection.py, the SZProjection
class has a write_png method that uses the symlog in a color plot.

So my suggestion would be to write your image to a fixed resolution
buffer and plot it directly with Matplotlib's imshow using the symlog
scaling on the colorbar.

Best,

John

On Wed, Jul 16, 2014 at 6:53 PM, Nathan Goldbaum <nathan12343 at gmail.com> wrote:
>
>
>
> On Wed, Jul 16, 2014 at 3:50 PM, Suoqing JI <suoqing at physics.ucsb.edu>
> wrote:
>>
>> Hi,
>>
>> I understand that typically the negative values would appear as white
>> color on a log slice plot. However, if I directly plot the fields that are
>> generically defined in FLASH, the negative values DO appear correctly. For
>> example, the velx field: http://pbrd.co/1jz3iqR.
>
>
> Yup - that plot is on a linear scale.  I believe the FLASH frontend has it
> explicitly defined *not* to log-scale velx.
>
>>
>>
>> But for any derived fields, for example, defining velx1 = 1.*velx, the
>> negative values appear white again: http://pbrd.co/1jz4oD8.
>
>
> That happens because the default for a derived field is to log scale the
> field in plots.
>
>>
>>
>> So, is there anyway to show both positive and negative values on a log
>> slice plot for derived fields (I’m using YT2)?
>>
>
> Nope.  In general you can't show negative values on a log-scaled plot.
>
> You could plot the absolute value of a field but then you aren't really
> plotting the field as such.
>
> What is the visualization goal you are trying to accomplish here?
>
>>
>> Thanks!
>>
>> Best wishes,
>> --
>> Suoqing JI
>> Ph.D Student
>> Department of Physics
>> University of California, Santa Barbara
>> CA 93106, USA
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



-- 
John ZuHone

Postdoctoral Researcher
NASA/Goddard Space Flight Center

jzuhone at gmail.com
john.zuhone at nasa.gov



More information about the yt-users mailing list