Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in stellar_distributions #65

Open
xinyuewu21 opened this issue Jan 28, 2022 · 0 comments
Open

Error in stellar_distributions #65

xinyuewu21 opened this issue Jan 28, 2022 · 0 comments

Comments

@xinyuewu21
Copy link

In cell In[3] of the notebook stellar_distributions, an error about the plots appears as shown below. The same error appears in cells In[6] and In[7]. Running at git hash ec1024d.

The code of In[3] is:

fd1 = FixedDistance(10*u.kpc)
d1 = fd1.distance(10000)

fd2 = FixedDistance(10*u.kpc, sigma=0.5*u.kpc)
d2 = fd2.distance(10000)

fig, axes = plt.subplots(1,2, figsize=(12,4), sharex=True)
ax1, ax2 = axes

bins = np.linspace(7, 13, 61)
ax1.hist(d1.value, bins, normed=True)
ax1.set(ylabel='prob. density [kpc$^{-1}$]',
        xlabel='distance [kpc]',
        title='$d=${}'.format(fd1.dist))
ax1.grid(ls=':')
ax2.hist(d2.value, bins, normed=True)
ax2.set(xlabel='distance [kpc]',
        title='$d=${}, $\sigma=${}'.format(fd2.dist, fd2.sigma))
ax2.grid(ls=':')
fig.tight_layout()

The error is:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-05fa4a9355ef> in <module>
      9 
     10 bins = np.linspace(7, 13, 61)
---> 11 ax1.hist(d1.value, bins, normed=True)
     12 ax1.set(ylabel='prob. density [kpc$^{-1}$]',
     13         xlabel='distance [kpc]',

/opt/anaconda3/lib/python3.8/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
   1445     def inner(ax, *args, data=None, **kwargs):
   1446         if data is None:
-> 1447             return func(ax, *map(sanitize_sequence, args), **kwargs)
   1448 
   1449         bound = new_sig.bind(ax, *args, **kwargs)

/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_axes.py in hist(self, x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
   6813             if patch:
   6814                 p = patch[0]
-> 6815                 p.update(kwargs)
   6816                 if lbl is not None:
   6817                     p.set_label(lbl)

/opt/anaconda3/lib/python3.8/site-packages/matplotlib/artist.py in update(self, props)
    994                     func = getattr(self, f"set_{k}", None)
    995                     if not callable(func):
--> 996                         raise AttributeError(f"{type(self).__name__!r} object "
    997                                              f"has no property {k!r}")
    998                     ret.append(func(v))

AttributeError: 'Rectangle' object has no property 'normed'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant