Skip to content

Commit

Permalink
Merge pull request #344 from ubermag/fix-mesh-mpl
Browse files Browse the repository at this point in the history
Mesh.mpl: fix scaling bug
  • Loading branch information
lang-m authored Jul 14, 2023
2 parents cd44eb9 + f05bba5 commit c9bc7dc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions discretisedfield/plotting/mpl_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,18 @@ def __call__(
multiplier = self._setup_multiplier(multiplier)

rescaled_mesh = self.mesh.scale(1 / multiplier)
rescaled_mesh.region.units = [
f"{uu.rsi_prefixes[multiplier]}{unit}" for unit in self.mesh.region.units
]
cell_region = df.Region(
p1=rescaled_mesh.region.pmin,
p2=rescaled_mesh.region.pmin + rescaled_mesh.cell,
units=rescaled_mesh.region.units,
)
rescaled_mesh.region.mpl(ax=ax, color=color[0], box_aspect=box_aspect, **kwargs)
cell_region.mpl(ax=ax, color=color[1], box_aspect=None, **kwargs)
rescaled_mesh.region.mpl(
ax=ax, color=color[0], box_aspect=box_aspect, multiplier=1, **kwargs
)
cell_region.mpl(ax=ax, color=color[1], box_aspect=None, multiplier=1, **kwargs)

self._savefig(filename)

Expand Down

0 comments on commit c9bc7dc

Please sign in to comment.