Coexistence of positive and negative values on a SlicePlot in log scale
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. But for any derived fields, for example, defining velx1 = 1.*velx, the negative values appear white again: http://pbrd.co/1jz4oD8. So, is there anyway to show both positive and negative values on a log slice plot for derived fields (I’m using YT2)? Thanks! Best wishes, -- Suoqing JI Ph.D Student Department of Physics University of California, Santa Barbara CA 93106, USA
On Wed, Jul 16, 2014 at 3:50 PM, Suoqing JI <suoqing@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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
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@gmail.com> wrote:
On Wed, Jul 16, 2014 at 3:50 PM, Suoqing JI <suoqing@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@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
-- John ZuHone Postdoctoral Researcher NASA/Goddard Space Flight Center jzuhone@gmail.com john.zuhone@nasa.gov
On Wed, Jul 16, 2014 at 4:06 PM, John Zuhone <jzuhone@gmail.com> wrote:
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
I didn't know this was a thing. We could probably add support for it to PlotWindow.
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@gmail.com> wrote:
On Wed, Jul 16, 2014 at 3:50 PM, Suoqing JI <suoqing@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@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
-- John ZuHone
Postdoctoral Researcher NASA/Goddard Space Flight Center
jzuhone@gmail.com john.zuhone@nasa.gov _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
I've opened an issue here: https://bitbucket.org/yt_analysis/yt/issue/857/add-support-for-symmetric-log... On Wed, Jul 16, 2014 at 4:09 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
On Wed, Jul 16, 2014 at 4:06 PM, John Zuhone <jzuhone@gmail.com> wrote:
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
I didn't know this was a thing. We could probably add support for it to PlotWindow.
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@gmail.com> wrote:
On Wed, Jul 16, 2014 at 3:50 PM, Suoqing JI <suoqing@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@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
-- John ZuHone
Postdoctoral Researcher NASA/Goddard Space Flight Center
jzuhone@gmail.com john.zuhone@nasa.gov _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Nathan, John, The example I gave does be on a linear scale and not appropriate… but yes, John’s information is exactly I want. Although it might be possible to superpose two plots (one positive and one negative) with two color bars, but it appears a little bit redundant. Thanks a lot! Best wishes, Suoqing On Jul 16, 2014, at 4:09 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
On Wed, Jul 16, 2014 at 4:06 PM, John Zuhone <jzuhone@gmail.com> wrote: 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
I didn't know this was a thing. We could probably add support for it to PlotWindow.
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@gmail.com> wrote:
On Wed, Jul 16, 2014 at 3:50 PM, Suoqing JI <suoqing@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@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
-- John ZuHone
Postdoctoral Researcher NASA/Goddard Space Flight Center
jzuhone@gmail.com john.zuhone@nasa.gov _______________________________________________ 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
What I've done to address this issue in the past is plot the absolute value in logspace, and then have the symbol plotted be an up arrow if it is positive or a down arrow if it is negative. This way you can keep it all on a single plot. Example: http://i.imgur.com/Y77UokD.png Cameron On Wed, Jul 16, 2014 at 4:13 PM, Suoqing JI <suoqing@physics.ucsb.edu> wrote:
Hi Nathan, John,
The example I gave does be on a linear scale and not appropriate… but yes, John’s information is exactly I want.
Although it might be possible to superpose two plots (one positive and one negative) with two color bars, but it appears a little bit redundant.
Thanks a lot!
Best wishes, Suoqing
On Jul 16, 2014, at 4:09 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
On Wed, Jul 16, 2014 at 4:06 PM, John Zuhone <jzuhone@gmail.com> wrote:
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
I didn't know this was a thing. We could probably add support for it to PlotWindow.
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@gmail.com> wrote:
On Wed, Jul 16, 2014 at 3:50 PM, Suoqing JI <suoqing@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@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
-- John ZuHone
Postdoctoral Researcher NASA/Goddard Space Flight Center
jzuhone@gmail.com john.zuhone@nasa.gov _______________________________________________ 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
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Cameron Hummels Postdoctoral Researcher Steward Observatory University of Arizona http://chummels.org
Hi Cameron, That’s true, or we can multiply a sign function to get the correct sign even. But for a 2-D plot, maybe the symlog scaling is a suitable solution... Thanks! Best wishes, -- Suoqing JI Ph.D Student Department of Physics University of California, Santa Barbara CA 93106, USA On Jul 16, 2014, at 4:22 PM, Cameron Hummels <chummels@gmail.com> wrote:
What I've done to address this issue in the past is plot the absolute value in logspace, and then have the symbol plotted be an up arrow if it is positive or a down arrow if it is negative. This way you can keep it all on a single plot. Example:
http://i.imgur.com/Y77UokD.png
Cameron
On Wed, Jul 16, 2014 at 4:13 PM, Suoqing JI <suoqing@physics.ucsb.edu> wrote: Hi Nathan, John,
The example I gave does be on a linear scale and not appropriate… but yes, John’s information is exactly I want.
Although it might be possible to superpose two plots (one positive and one negative) with two color bars, but it appears a little bit redundant.
Thanks a lot!
Best wishes, Suoqing
On Jul 16, 2014, at 4:09 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
On Wed, Jul 16, 2014 at 4:06 PM, John Zuhone <jzuhone@gmail.com> wrote: 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
I didn't know this was a thing. We could probably add support for it to PlotWindow.
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@gmail.com> wrote:
On Wed, Jul 16, 2014 at 3:50 PM, Suoqing JI <suoqing@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@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
-- John ZuHone
Postdoctoral Researcher NASA/Goddard Space Flight Center
jzuhone@gmail.com john.zuhone@nasa.gov _______________________________________________ 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
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-- Cameron Hummels Postdoctoral Researcher Steward Observatory University of Arizona http://chummels.org _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
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@gmail.com> wrote:
On Wed, Jul 16, 2014 at 3:50 PM, Suoqing JI <suoqing@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@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
-- John ZuHone Postdoctoral Researcher NASA/Goddard Space Flight Center jzuhone@gmail.com john.zuhone@nasa.gov
participants (4)
-
Cameron Hummels
-
John Zuhone
-
Nathan Goldbaum
-
Suoqing JI