SMTG-Bham / ThermoParser

A tool for streamlining data analysis and visualisation for thermoelectrics and charge carrier transport in computational materials science.
https://smtg-bham.github.io/ThermoParser/
GNU Affero General Public License v3.0
47 stars 15 forks source link

Matplotlib Error #103

Closed kavanase closed 4 months ago

kavanase commented 5 months ago

Running tp plot phonons sumo_band.yaml gives me:

Traceback (most recent call last):
  File "/Users/kavanase/miniconda3/bin/tp", line 33, in <module>
    sys.exit(load_entry_point('tp', 'console_scripts', 'tp')())
  File "/Users/kavanase/miniconda3/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/kavanase/miniconda3/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/kavanase/miniconda3/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/kavanase/miniconda3/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/kavanase/miniconda3/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/kavanase/miniconda3/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/kavanase/Packages/ThermoParser/tp/cli/cli.py", line 1597, in converge_phonons
    tp.plot.phonons.add_multi(ax, data, colour=colour, linestyle=linestyle,
  File "/Users/kavanase/Packages/ThermoParser/tp/plot/phonons.py", line 294, in add_multi
    colours = mpl.cm.get_cmap(colour)(np.linspace(0, 1, len(data)))
AttributeError: module 'matplotlib.cm' has no attribute 'get_cmap'

I think I saw this error before actually, and manually fixed it. I think it might be due to a matplotlib version error? I'm using the most recent version

kbspooner commented 4 months ago

Right you are, its fixed now, thanks! (it maintains compatability with previous versions for now too)

kavanase commented 3 months ago

@kbspooner just a suggestion, might be worth releasing a new version on pip with this and the other bug fixes you added? Doing pip install -U tp still gives the older versions with these issues, so would save the users some time in updating (without having to git clone etc)