-
Notifications
You must be signed in to change notification settings - Fork 34
Description
I'm following the tutorial on your GitHub page, but I encountered an error when calling pyemma.plots.plot_cktest(). The error traceback indicates:
File "/mnt/WORKSPACE/xiongyq/AD/Tau/7p65_av1451/analyse/msm/test2.py", line 21, in
pyemma.plots.plot_cktest(msm.cktest(4), units='ps')
File "/home/xiongyq/WORKSPACE/soft/anaconda3/lib/python3.11/site-packages/pyemma/plots/markovtests.py", line 168, in plot_cktest
fig.legend(handles, labels, 'upper center', ncol=2, frameon=False)
File "/home/xiongyq/WORKSPACE/soft/anaconda3/lib/python3.11/site-packages/matplotlib/figure.py", line 1146, in legend
handles, labels, kwargs = mlegend._parse_legend_args(self.axes, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/xiongyq/WORKSPACE/soft/anaconda3/lib/python3.11/site-packages/matplotlib/legend.py", line 1382, in _parse_legend_args
raise _api.nargs_error('legend', '0-2', len(args))
I suspect this may be related to my Matplotlib version (3.8.4).
Here’s the code I used:
import matplotlib.pyplot as plt
import numpy as np
import pyemma
import os
pdb = 'alanine-dipeptide-nowater.pdb'
files = sorted([f for f in os.listdir('.') if f.startswith('alanine-dipeptide-') and f.endswith('-250ns-nowater.xtc')])
feat = pyemma.coordinates.featurizer(pdb)
feat.add_backbone_torsions(periodic=False)
data = pyemma.coordinates.load(files, features=feat)
data_concatenated = np.concatenate(data)
cluster = pyemma.coordinates.cluster_kmeans(data, k=200, max_iter=50, stride=10)
msm = pyemma.msm.estimate_markov_model(cluster.dtrajs, lag=10, dt_traj='1 ps')
pyemma.plots.plot_cktest(msm.cktest(4), units='ps')
plt.savefig('ck_test_result.png', bbox_inches='tight')
Could this be an issue with the Matplotlib version? And how can I resolve this problem?
Thank you for your assistance!