[yt-users] Setting Color map and x and y axis ticks in PlotCollection or ProjectionPlot

Britton Smith brittonsmith at gmail.com
Wed Nov 6 06:24:34 PST 2013


Hi Kearn,

You can use the set_zlim command (prj.set_zlim(field, min, max)) to adjust
the scale, but I don't think there is any simply way of fixing the values
for colors in the middle of the colorbar.

Britton


On Wed, Nov 6, 2013 at 2:15 PM, <k.grisdale at surrey.ac.uk> wrote:

>  Hi Britton,
>
>  Thank you for you help. That makes it very simple.
>
>  One follow on question: Is there a command that allows me to set the
> range for the colours so for exam that green 1g/cm^3 and red is 5g/cm^3?
>
>  Thanks again
>
>  Kearn
>
>  On 6 Nov 2013, at 14:02, Britton Smith <brittonsmith at gmail.com> wrote:
>
>  Hi Kearn,
>
>  You can solve this with your first approach by doing:
> prj.set_cmap('Density', ‘YlOrRd’)
>
>  The reason for this is that ProjectionPlot allows you to project more
> than one field at a time and so this functionality lets you set the
> colormap for each projection individually.
>
>  We are currently in the process of phasing out the PlotCollection, so I
> would discourage you from using the second approach.
>
>  Britton
>
>
> On Wed, Nov 6, 2013 at 12:32 PM, <k.grisdale at surrey.ac.uk> wrote:
>
>> Hi Everyone,
>>
>> I am trying to plot 3D data from RAMSES as a projection. The plots I have
>> created with the ProjectionPlot look good (with the command below) but I
>> want to rescale the colour map so that when I compare different times the
>> scale matches. I would also like to change colour map used.
>>
>> [ProjectionPlot(p6,'z','Density',center=[0.5,0.5,0.5]).save(“p6”)]
>>
>> I started by trying to change just the colour map on these plots using
>> the following:
>>
>> prj=ProjectionPlot(p6,'z','Density',center=[0.5,0.5,0.5]).save(“p6”)
>> prj.set_cmap(‘YlOrRd’)
>>
>> but I get the error:
>>
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File
>> "/Applications/Code/yt/yt-x86_64/src/yt-hg/yt/visualization/plot_window.py",
>> line 107, in newfunc
>>     rv = f(*args, **kwargs)
>>
>> and I’m not sure what I am missing.
>>
>> I have now tried a different approach of
>>
>> cen = [0.5,0.5,0.5]
>> pc = PlotCollection(p6, cen)
>> pc.add_projection("Density",2)
>> pc.set_width(0.5, 'cm')
>> pc.set_xlim(-0.35, 0.35)
>> pc.set_ylim(-0.35, 0.35)
>> pc.set_zlim(0.06, 0.22)
>> pc.set_cmap('YlOrRd')
>> pc.save('test’)
>>
>> While this new approach changes the colour map on the image it does
>> update the colour map on the colour bar(not sure if thats the correct name)
>> on the left of the image.The scale however does update. Also this method
>> produces graphs with out ticks for x and y axis which I would like have.
>>
>> Can anyone point out what I am missing or what I can do differently?
>>
>> Thanks In advance
>>
>> Kearn
>>
>>
>>
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20131106/79a90c66/attachment.htm>


More information about the yt-users mailing list