-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update scalebar.py Formalizes the changes suggested by altanir84 in #39 to add support for bbox_to_anchor Additionally implements get_window_extent * Update scalebar.py * Update scalebar.py * Update scalebar.py * Apply linter * Fix use of bbox and add example * Add doc in README. Add unit test * Add contributor --------- Co-authored-by: Philippe Pinard <philippe.pinard@gmail.com>
- Loading branch information
Showing
6 changed files
with
130 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from pathlib import Path | ||
import matplotlib.pyplot as plt | ||
from matplotlib_scalebar.scalebar import ScaleBar | ||
|
||
fig, ax = plt.subplots() | ||
|
||
scalebar = ScaleBar( | ||
1, | ||
"cm", | ||
length_fraction=0.25, | ||
bbox_to_anchor=(0.5, 0.5), | ||
bbox_transform=ax.transAxes, | ||
location="lower left", | ||
label="lower left", | ||
box_color="0.8", | ||
) | ||
ax.add_artist(scalebar) | ||
|
||
scalebar = ScaleBar( | ||
1, | ||
"cm", | ||
length_fraction=0.25, | ||
bbox_to_anchor=(0.5, 0.5), | ||
bbox_transform=ax.transAxes, | ||
location="upper right", | ||
label="upper right", | ||
box_color="0.8", | ||
) | ||
ax.add_artist(scalebar) | ||
|
||
outdir = Path(__file__).parent.resolve() | ||
fig.savefig(outdir / "argument_bbox_to_anchor.png", dpi=60, bbox_inches="tight") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters