Skip to content

Commit

Permalink
plot_structure_2d() in site /api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Mar 21, 2023
1 parent a0665ec commit fcf75de
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ repos:
exclude_types: [csv, svg, html, yaml, jupyter]

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.6.3
rev: 1.6.4
hooks:
- id: nbqa-ruff

Expand Down
2 changes: 2 additions & 0 deletions assets/make_api_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# - prettier badges linking to source code on GitHub
# - remove bold tags since they break inline code

ROOT = os.path.dirname(os.path.dirname(__file__))
os.chdir(ROOT)
pkg = json.load(open("site/package.json"))
route = "site/src/routes/api"

Expand Down
2 changes: 1 addition & 1 deletion pymatviz/ptable.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def ptable_heatmap_plotly(
will be bold and 1.5x this size.
bg_color (str): Plot background color. Defaults to "rgba(0, 0, 0, 0)".
color_bar (dict[str, Any]): Plotly color bar properties documented at
https://plotly.com/python/reference#heatmap-colorbar. Defaults to {}.
https://plotly.com/python/reference#heatmap-colorbar. Defaults to `{}`.
cscale_range (tuple[float | None, float | None]): Color bar range. Defaults to
(None, None) meaning the range is automatically determined from the data.
exclude_elements (list[str]): Elements to exclude from the heatmap. E.g. if
Expand Down
3 changes: 2 additions & 1 deletion pymatviz/structure_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def unit_cell_to_lines(cell: Array) -> tuple[Array, Array, Array]:
return lines, z_indices, unit_cell_lines


# TODO rewrite this doc string so that it doesn't mess up the /api page
def plot_structure_2d(
struct: Structure,
ax: plt.Axes = None,
Expand All @@ -124,6 +123,7 @@ def plot_structure_2d(
avoids the conversion hassle of AseAtomsAdaptor.get_atoms(pmg_struct).
For example, these two snippets should give very similar output:
```py
from pymatgen.ext.matproj import MPRester
Expand All @@ -142,6 +142,7 @@ def plot_structure_2d(
```
Multiple structures in single figure example:
```py
import matplotlib.pyplot as plt
from pymatgen.ext.matproj import MPRester
Expand Down

0 comments on commit fcf75de

Please sign in to comment.