traja-team / traja

Python tools for spatial trajectory and time-series data analysis
https://traja.readthedocs.io
MIT License
98 stars 25 forks source link

Autocorrelation plotting not working #87

Closed a-paxton closed 3 years ago

a-paxton commented 3 years ago

Hi, there! As part of my review for your JOSS submission, I've been running through your documentation. I'm testing your package from a clean conda env using the conda-forge installation instructions. When I tried to generate the autocorrelation plot, I ran into the following issue:

>>> trj = traja.generate()
>>> trj.plotting.plot_autocorrelation('x')
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-34-b195eb5d1731> in <module>
      1 trj = traja.generate()
----> 2 trj.traja.plot_autocorrelation('x')

AttributeError: 'TrajaAccessor' object has no attribute 'plot_autocorrelation'

The paper noted that this functionality was ported from pandas, so I tried a slight edit and got a similar error:

>>> trj = traja.generate()
>>> pd.plotting.plot_autocorrelation(trj)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-51-e89baf0ed7ae> in <module>
      1 trj = traja.generate()
----> 2 pd.plotting.plot_autocorrelation(trj)

AttributeError: module 'pandas.plotting' has no attribute 'plot_autocorrelation'

I did a quick search and found that the pandas function is actually called autocorrelation_plot(), so I adapted the code and was able to get the following to work:

trj = traja.generate()
pd.plotting.autocorrelation_plot(trj)

It looks like it should be a pretty straightforward issue to fix. Thanks again!

a-paxton commented 3 years ago

(Oh, and I tried the variant provided here and got the same error as when I ran trj.plotting.plot_autocorrelation('x'). Just thought I'd note that for thoroughness!)