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

Overlayed subplots from BSPlotterProjected.get_projected_plots_dots() and get_projected_plots_dots_patom_pmorb() #3760

Closed
HERTZCAI opened this issue Apr 16, 2024 · 1 comment · Fixed by #3798
Labels
bug data viz PRs and issues about pymatgen plotting functionality electronic structure Electronic structure functionality related

Comments

@HERTZCAI
Copy link

Python version

3.11.7

Pymatgen version

2024.4.13

Operating system version

Ubuntu 22.04.3 LTS

Current behavior

I try to get band structures with specific elements and orbitals with get_projected_plots_dots(). While a figure with 3 subfigures is expected, the program returns a figure with only one subfigure and the place where the other two subfigures are supposed to be is blank.
image
However, when I downgrade pymatgen to 2023.8.10, no such problems occur.
get_projected_plots_dots_patom_pmorb() also does not work properly.
Moreover, there are extra axes in the figure.
matplotlib version is 3.8.0.

Expected Behavior

A figure with several subfigures displays normally

Minimal example

vasprun = Vasprun("vasprun.xml",parse_projected_eigen=True)
bs_data = vasprun.get_band_structure(line_mode=True)
plt_3=BSPlotterProjected(bs=bs_data)
plt_3.get_projected_plots_dots({'K':['s'],'Ti':['d'],'O':['p']})
plt.show()

Relevant files to reproduce this bug

No response

@HERTZCAI HERTZCAI added the bug label Apr 16, 2024
@janosh janosh changed the title 'get_projected_plots_dots()' and 'get_projected_plots_dots_patom_pmorb()' do not work properly Overlayed subplots from BSPlotterProjected.get_projected_plots_dots() and get_projected_plots_dots_patom_pmorb() May 1, 2024
@janosh janosh added data viz PRs and issues about pymatgen plotting functionality electronic structure Electronic structure functionality related labels May 1, 2024
DanielYang59 added a commit to DanielYang59/pymatgen that referenced this issue May 2, 2024
DanielYang59 added a commit to DanielYang59/pymatgen that referenced this issue May 2, 2024
@DanielYang59
Copy link
Contributor

DanielYang59 commented May 2, 2024

Hopefully the fix produces satisfactory results for you @HERTZCAI (feel free to ping me if you have more suggestions).

Also to improve the overlapping markers, you could now pass a marker_size arg for example:

plotter = BSPlotterProjected(bs=bs_data)
plotter.get_projected_plots_dots({"Cu":["s", "d"], "O":["p"]}, marker_size=6.5)

plt.show()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug data viz PRs and issues about pymatgen plotting functionality electronic structure Electronic structure functionality related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants