Multiple values of 'shrink'

Hello,

I’m seeking help because I encountered an error while trying to use the IFermi program with my recent VASP calculation results for the first time.

First, with the default Plotly option, the HTML file is generated normally, and I can open it in a web browser and interact with it.
ifermi plot --property velocity --property-colormap coolwarm

However, since the Plotly program doesn’t open in Firefox on Linux, it’s cumbersome to have to move the image to my local PC every time to view it. Therefore, I’d like to output the graphic using matplotlib instead.

But when I use the -t matplotlib command:
ifermi plot -t matplotlib --property velocity --property-colormap coolwarm

TypeError: matplotlib.figure.FigureBase.colorbar() got multiple values for keyword argument ‘shrink’

This error occurs, and the Fermi surface cannot be displayed.

Looking at the vim ~/anaconda3/lib/python3.11/site-packages/ifermi/plot.py code:

487 if polyc:
488 _mpl_cbar_style.update(cbar_kwargs)
489 fig.colorbar(polyc, ax=ax, shrink=0.5, **_mpl_cbar_style)

The shrink value is hardcoded to 0.5.
If I modify that part in the following way, the Fermi surface will be plotted normally.

fig.colorbar(polyc, ax=ax, shrink=0.5, **{k:v for k,v in _mpl_cbar_style.items() if k != ‘shrink’})

I’m wondering if this is the cause of the error in the current code, or if I need to modify the existing options when using matplotlib.

  • Error code
(base) [mydir@blue NSCF]$ ifermi plot -t matplotlib --property velocity --property-colormap coolwarm
WARNING: We strongly encourage explicit `encoding`, and we would use UTF-8 by default as per PEP 686

WARNING: We strongly encourage explicit `encoding`, and we would use UTF-8 by default as per PEP 686

WARNING: We strongly encourage explicit `encoding`, and we would use UTF-8 by default as per PEP 686

spglib reported the following space group: P6_3/mmc(194)
spglib reported the following space group: P6_3/mmc(194)
WARNING: Structure does not match expected primitive cell

qt.qpa.xcb: X server does not support XInput 2
failed to get the current screen resources
Traceback (most recent call last):
  File "/home/mydir/anaconda3/bin/ifermi", line 7, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/mydir/anaconda3/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mydir/anaconda3/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/mydir/anaconda3/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mydir/anaconda3/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mydir/anaconda3/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mydir/anaconda3/lib/python3.11/site-packages/ifermi/cli.py", line 333, in plot
    fig = plotter.get_plot(
          ^^^^^^^^^^^^^^^^^
  File "/home/mydir/anaconda3/lib/python3.11/site-packages/ifermi/plot.py", line 326, in get_plot
    plot = self._get_matplotlib_plot(plot_data, **plot_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mydir/anaconda3/lib/python3.11/site-packages/ifermi/plot.py", line 489, in _get_matplotlib_plot
    fig.colorbar(polyc, ax=ax, shrink=0.5, **_mpl_cbar_style)
TypeError: matplotlib.figure.FigureBase.colorbar() got multiple values for keyword argument 'shrink'

Thank you for your help.

Sincerely.