[yt-users] Making averaged line plot.

Yuxiao Dai yuxiao.dai at nyu.edu
Mon Mar 14 22:57:27 PDT 2016


Dear all,

I have a line plot of some parameter along an axis as a function of
distance. Now I would like to get another line plot of the same parameter
but averaged over a certain distance (say 100 kpc, the plot below is
supposed to be flat after this). I've been searching the document for some
time but haven't found a method. Is there a simple way to do this?

I would very much appreciate it if anyone could help me on this.


===================================
import ...

def _ScaledBMag(field, data):

    return ...


....

pf = load(filename)

    add_field("ScaledBMag", function=_ScaledBMag)


    c = pf.h.find_max('ScaledBMag')[1]

    ax = 0

    ray = pf.h.ortho_ray(ax, (c[1], c[2]))



    P.subplot(211)

    P.semilogy(ray['x'], ray['ScaledBMag'])

    P.xlabel('x')

    P.ylabel('ScaledBMag')

    print "works"

    P.savefig("ScaledBMag_lineplot.png")

[image: Inline image 1]

===================================

I'm using yt

Version = 2.6.1

Changeset = c994959ed3be

===================================



Regards,

Dai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160315/4c67bd34/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 44176 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20160315/4c67bd34/attachment.png>


More information about the yt-users mailing list