[yt-dev] Issue #903: Plot.set_xlim Error using ProfilePlot.from_profiles (yt_analysis/yt)
Alan Kap
issues-reply at bitbucket.org
Wed Sep 17 15:45:27 PDT 2014
New issue 903: Plot.set_xlim Error using ProfilePlot.from_profiles
https://bitbucket.org/yt_analysis/yt/issue/903/plotset_xlim-error-using
Alan Kap:
import yt
from yt import derived_field
from yt.units import kpc
from matplotlib import pylab as plt
# Lists to hold profiles, labels, and plot specifications.
profiles = []
labels = []
center = [0.5,0.5,0.5]
@derived_field(name = "code_r", units = "")
def _code_r(field, data):
return data["spherical_r"]/kpc/10
ran = [1,2,4,15]
for i in ran:
qs = yt.load("../old_code/DD%4.4d/data%4.4d" % (i,i))
ad = qs.sphere(center,1)
profiles.append(yt.create_profile(ad, ["code_r"],
fields=["HI_kph"],
weight_field=None,
accumulation=True))
labels.append("old: file %d" % i)
plot = yt.ProfilePlot.from_profiles(profiles, labels=labels)
plot.set_xlim(1e-3, 1e5)
plot.save()
--> this gives me the error "ReferenceError: weakly-referenced object no longer exists"
More information about the yt-dev
mailing list