[yt-users] User-defined field doesn't plot numbers
Clayton Strawn
cjstrawn at ucsc.edu
Wed Aug 23 17:04:25 PDT 2017
Hello,
I'm trying to define a new metal field and compare to the old, but the new
field doesn't have any numbers on the colorbar! Changing units and setting
minorticks "on" didn't help with this.
[image: Inline image 1][image: Inline image 2]
import yt
filename = "/Users/file_name_vela_sim.d"
ds = yt.load(filename)
def _SN_metal_dens(field, data):
return data[('gas','metal_ia_density')]+
data[('gas','metal_ii_density')]
yt.add_field(("gas", "sn_metal_density"), function=_SN_metal_dens,
units="g/cm**3")
p1 = yt.ProjectionPlot(ds,0,("gas", "sn_metal_density"), width = (1, "Mpc"))
p2 = yt.ProjectionPlot(ds,0,("gas", "metal_density"), width = (1, "Mpc"))
p1.set_cbar_minorticks(("gas", "sn_metal_density"),"on")
p2.set_cbar_minorticks(("gas", "metal_density"),"on")
p1.set_unit(("gas", "sn_metal_density"), 'g/cm**2')
p1.save()
p2.save()
How do I get a normal colorbar plot with numbers with a user-defined field?
--
Physics Department UC Santa Cruz
1156 HIGH STREET, SANTA CRUZ, CA 95064
916-749-2940
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170823/2c8bc184/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 10MpcBox_csf512_00570.d_Projection_x_metal_density.png
Type: image/png
Size: 201182 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170823/2c8bc184/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 10MpcBox_csf512_00570.d_Projection_x_sn_metal_density.png
Type: image/png
Size: 257706 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170823/2c8bc184/attachment-0003.png>
More information about the yt-users
mailing list