matplotlib-map-utils 3.1.2__tar.gz → 4.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. matplotlib_map_utils-4.1.0/PKG-INFO +108 -0
  2. matplotlib_map_utils-4.1.0/README.md +88 -0
  3. matplotlib_map_utils-4.1.0/docs/assets/index/generator_logo.py +141 -0
  4. matplotlib_map_utils-4.1.0/docs/assets/index/generator_map.py +63 -0
  5. matplotlib_map_utils-4.1.0/docs/assets/inset_maps/generator.py +388 -0
  6. matplotlib_map_utils-4.1.0/docs/assets/north_arrows/generator.py +334 -0
  7. matplotlib_map_utils-4.1.0/docs/assets/quick/generator.py +153 -0
  8. matplotlib_map_utils-4.1.0/docs/assets/scale_bars/generator.py +539 -0
  9. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/__init__.py +16 -4
  10. matplotlib_map_utils-4.1.0/matplotlib_map_utils/config.py +4 -0
  11. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/core/inset_map.py +192 -238
  12. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/core/north_arrow.py +99 -136
  13. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/core/scale_bar.py +116 -187
  14. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/defaults/__init__.py +3 -3
  15. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/defaults/inset_map.py +5 -5
  16. matplotlib_map_utils-4.1.0/matplotlib_map_utils/defaults/north_arrow.py +204 -0
  17. matplotlib_map_utils-4.1.0/matplotlib_map_utils/defaults/scale_bar.py +156 -0
  18. matplotlib_map_utils-4.1.0/matplotlib_map_utils/validation/inset_map.py +74 -0
  19. matplotlib_map_utils-4.1.0/matplotlib_map_utils/validation/north_arrow.py +177 -0
  20. matplotlib_map_utils-4.1.0/matplotlib_map_utils/validation/scale_bar.py +237 -0
  21. matplotlib_map_utils-4.1.0/matplotlib_map_utils/validation/shared.py +66 -0
  22. matplotlib_map_utils-4.1.0/matplotlib_map_utils.egg-info/PKG-INFO +108 -0
  23. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils.egg-info/SOURCES.txt +15 -2
  24. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils.egg-info/requires.txt +1 -0
  25. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/pyproject.toml +8 -3
  26. matplotlib_map_utils-4.1.0/site/assets/index/generator_logo.py +141 -0
  27. matplotlib_map_utils-4.1.0/site/assets/index/generator_map.py +63 -0
  28. matplotlib_map_utils-4.1.0/site/assets/inset_maps/generator.py +389 -0
  29. matplotlib_map_utils-4.1.0/site/assets/north_arrows/generator.py +336 -0
  30. matplotlib_map_utils-4.1.0/site/assets/quick/generator.py +153 -0
  31. matplotlib_map_utils-4.1.0/site/assets/scale_bars/generator.py +542 -0
  32. matplotlib_map_utils-3.1.2/PKG-INFO +0 -485
  33. matplotlib_map_utils-3.1.2/README.md +0 -466
  34. matplotlib_map_utils-3.1.2/matplotlib_map_utils/defaults/north_arrow.py +0 -416
  35. matplotlib_map_utils-3.1.2/matplotlib_map_utils/defaults/scale_bar.py +0 -407
  36. matplotlib_map_utils-3.1.2/matplotlib_map_utils/validation/functions.py +0 -264
  37. matplotlib_map_utils-3.1.2/matplotlib_map_utils/validation/inset_map.py +0 -91
  38. matplotlib_map_utils-3.1.2/matplotlib_map_utils/validation/north_arrow.py +0 -176
  39. matplotlib_map_utils-3.1.2/matplotlib_map_utils/validation/scale_bar.py +0 -285
  40. matplotlib_map_utils-3.1.2/matplotlib_map_utils.egg-info/PKG-INFO +0 -485
  41. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/LICENSE +0 -0
  42. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/core/__init__.py +0 -0
  43. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/scratch/map_utils.py +0 -0
  44. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/scratch/north_arrow_old_classes.py +0 -0
  45. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/utils/__init__.py +0 -0
  46. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/utils/usa.json +0 -0
  47. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/utils/usa.py +0 -0
  48. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils/validation/__init__.py +0 -0
  49. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils.egg-info/dependency_links.txt +0 -0
  50. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/matplotlib_map_utils.egg-info/top_level.txt +0 -0
  51. {matplotlib_map_utils-3.1.2 → matplotlib_map_utils-4.1.0}/setup.cfg +0 -0
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: matplotlib-map-utils
3
+ Version: 4.1.0
4
+ Summary: A suite of tools for creating maps in matplotlib
5
+ Author-email: David Moss <davidmoss1221@gmail.com>
6
+ Project-URL: Homepage, https://github.com/moss-xyz/matplotlib-map-utils/
7
+ Project-URL: Bug Tracker, https://github.com/moss-xyz/matplotlib-map-utils/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: GNU General Public License (GPL)
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Framework :: Matplotlib
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: matplotlib>=3.9.0
16
+ Requires-Dist: cartopy>=0.23.0
17
+ Requires-Dist: great-circle-calculator>=1.3.1
18
+ Requires-Dist: pydantic>=2.13.3
19
+ Dynamic: license-file
20
+
21
+ ![matplotlib_map_utils logo](docs/assets/index/mmu_logo_w_elements.png)
22
+
23
+ ---
24
+
25
+ **Documentation:** Available at [https://moss-xyz.github.io/matplotlib-map-utils/](https://moss-xyz.github.io/matplotlib-map-utils/)
26
+
27
+ **Source Code:** [Available on GitHub](https://github.com/moss-xyz/matplotlib-map-utils)
28
+
29
+ **Feedback:** I welcome any and all feedback! See the *Development Notes* below for more details.
30
+
31
+ **Current Version:** `v4.1.0`, featuring a brand-new documentation site and improved type validation! This DID introduce some breaking changes, see the documentation site for details!
32
+
33
+ ---
34
+
35
+ ### 👋 Introduction
36
+
37
+ `matplotlib_map_utils` is a package that that assists with the creation of maps using [`matplotlib`](https://matplotlib.org/stable/).
38
+
39
+ As of `v4.x` (the current version), this includes the ability to easily create three common map elements:
40
+
41
+ * <span style="color: orange; font-weight: bold;">North arrows</span>, which automatically point to true north,
42
+
43
+ * <span style="color: orange; font-weight: bold;">Scale bars</span>, available in different styles and automatic unit conversion, and
44
+
45
+ * <span style="color: orange; font-weight: bold;">Inset maps</span>, including both detail and extent-style plots.
46
+
47
+ The three elements listed above are all intended to be high-resolution, easily modifiable, and context-aware relative to your specific plot.
48
+
49
+ This package also contains a single utility object:
50
+
51
+ * <span style='color: orange; font-weight: bold; font-family: var(--md-code-font-family);'>USA</span>, a class that helps filter for states and territories within the USA based on given characteristics, used primarily for building queries based on FIPS codes or names.
52
+
53
+ Together, these allow for the (relatively) easy creation of a map such as the following:
54
+
55
+ ![Map with all common elements added](docs/assets/index/bigmap_w_elements.png)
56
+
57
+ ---
58
+
59
+ ### 💾 Installation
60
+
61
+ This package is available on PyPi, and can be installed like so:
62
+
63
+ ```bash
64
+ pip install matplotlib-map-utils
65
+ # or
66
+ uv add matplotlib-map-utils
67
+ ```
68
+
69
+ The requirements for this package are:
70
+
71
+ * `python >= 3.10` (due to the use of the pipe operator to concatenate dictionaries and types)
72
+
73
+ * `matplotlib >= 3.9` (might work with lower versions but not guaranteed)
74
+
75
+ * `cartopy >= 0.23` (due to earlier bug with calling `copy()` on `CRS` objects)
76
+
77
+ * `pydantic >= 2.13.3` (for type validation; might work with older versions, open an issue if you have questions)
78
+
79
+ ---
80
+
81
+ ### Quick Start and Usage Guides
82
+
83
+ For a primer on how to import the package and use the primary functions and methods to create elements, see the [Quick Start guide](https://moss_xyz.github.io/matplotlib_map_utils/quick).
84
+
85
+ Each part of the package also has a dedicated page that lays out usage and customisation options in more detail:
86
+
87
+ - 🧭 [__North Arrows__](https://moss_xyz.github.io/matplotlib_map_utils/north_arrows)
88
+ - 📏 [__Scale Bars__](https://moss_xyz.github.io/matplotlib_map_utils/scale_bars)
89
+ - 🗺️ [__Inset Maps__](https://moss_xyz.github.io/matplotlib_map_utils/inset_maps)
90
+ - 🛠️ [__Utilities__](https://moss_xyz.github.io/matplotlib_map_utils/utilities)
91
+
92
+ Finally, the [Package Information page](https://moss_xyz.github.io/matplotlib_map_utils/package) provides additional context around the development of and overall structure of the package.
93
+
94
+ ---
95
+
96
+ ### Support and Contributions
97
+
98
+ If you notice something is not working as intended or if you'd like to add a feature yourself, I welcome PRs - just be sure to be descriptive as to what you are changing and why, including code examples!
99
+
100
+ If you are having issues using this script, feel free to leave a post explaining your issue, and I will try and assist, though I have no guaranteed SLAs as this is just a hobby project.
101
+
102
+ I am open to contributions, especially to help tackle the roadmap above!
103
+
104
+ ---
105
+
106
+ ### ⚖️ License
107
+
108
+ I know nothing about licensing, so I went with the GPL license. If that is incompatible with any of the dependencies, please let me know.
@@ -0,0 +1,88 @@
1
+ ![matplotlib_map_utils logo](docs/assets/index/mmu_logo_w_elements.png)
2
+
3
+ ---
4
+
5
+ **Documentation:** Available at [https://moss-xyz.github.io/matplotlib-map-utils/](https://moss-xyz.github.io/matplotlib-map-utils/)
6
+
7
+ **Source Code:** [Available on GitHub](https://github.com/moss-xyz/matplotlib-map-utils)
8
+
9
+ **Feedback:** I welcome any and all feedback! See the *Development Notes* below for more details.
10
+
11
+ **Current Version:** `v4.1.0`, featuring a brand-new documentation site and improved type validation! This DID introduce some breaking changes, see the documentation site for details!
12
+
13
+ ---
14
+
15
+ ### 👋 Introduction
16
+
17
+ `matplotlib_map_utils` is a package that that assists with the creation of maps using [`matplotlib`](https://matplotlib.org/stable/).
18
+
19
+ As of `v4.x` (the current version), this includes the ability to easily create three common map elements:
20
+
21
+ * <span style="color: orange; font-weight: bold;">North arrows</span>, which automatically point to true north,
22
+
23
+ * <span style="color: orange; font-weight: bold;">Scale bars</span>, available in different styles and automatic unit conversion, and
24
+
25
+ * <span style="color: orange; font-weight: bold;">Inset maps</span>, including both detail and extent-style plots.
26
+
27
+ The three elements listed above are all intended to be high-resolution, easily modifiable, and context-aware relative to your specific plot.
28
+
29
+ This package also contains a single utility object:
30
+
31
+ * <span style='color: orange; font-weight: bold; font-family: var(--md-code-font-family);'>USA</span>, a class that helps filter for states and territories within the USA based on given characteristics, used primarily for building queries based on FIPS codes or names.
32
+
33
+ Together, these allow for the (relatively) easy creation of a map such as the following:
34
+
35
+ ![Map with all common elements added](docs/assets/index/bigmap_w_elements.png)
36
+
37
+ ---
38
+
39
+ ### 💾 Installation
40
+
41
+ This package is available on PyPi, and can be installed like so:
42
+
43
+ ```bash
44
+ pip install matplotlib-map-utils
45
+ # or
46
+ uv add matplotlib-map-utils
47
+ ```
48
+
49
+ The requirements for this package are:
50
+
51
+ * `python >= 3.10` (due to the use of the pipe operator to concatenate dictionaries and types)
52
+
53
+ * `matplotlib >= 3.9` (might work with lower versions but not guaranteed)
54
+
55
+ * `cartopy >= 0.23` (due to earlier bug with calling `copy()` on `CRS` objects)
56
+
57
+ * `pydantic >= 2.13.3` (for type validation; might work with older versions, open an issue if you have questions)
58
+
59
+ ---
60
+
61
+ ### Quick Start and Usage Guides
62
+
63
+ For a primer on how to import the package and use the primary functions and methods to create elements, see the [Quick Start guide](https://moss_xyz.github.io/matplotlib_map_utils/quick).
64
+
65
+ Each part of the package also has a dedicated page that lays out usage and customisation options in more detail:
66
+
67
+ - 🧭 [__North Arrows__](https://moss_xyz.github.io/matplotlib_map_utils/north_arrows)
68
+ - 📏 [__Scale Bars__](https://moss_xyz.github.io/matplotlib_map_utils/scale_bars)
69
+ - 🗺️ [__Inset Maps__](https://moss_xyz.github.io/matplotlib_map_utils/inset_maps)
70
+ - 🛠️ [__Utilities__](https://moss_xyz.github.io/matplotlib_map_utils/utilities)
71
+
72
+ Finally, the [Package Information page](https://moss_xyz.github.io/matplotlib_map_utils/package) provides additional context around the development of and overall structure of the package.
73
+
74
+ ---
75
+
76
+ ### Support and Contributions
77
+
78
+ If you notice something is not working as intended or if you'd like to add a feature yourself, I welcome PRs - just be sure to be descriptive as to what you are changing and why, including code examples!
79
+
80
+ If you are having issues using this script, feel free to leave a post explaining your issue, and I will try and assist, though I have no guaranteed SLAs as this is just a hobby project.
81
+
82
+ I am open to contributions, especially to help tackle the roadmap above!
83
+
84
+ ---
85
+
86
+ ### ⚖️ License
87
+
88
+ I know nothing about licensing, so I went with the GPL license. If that is incompatible with any of the dependencies, please let me know.
@@ -0,0 +1,141 @@
1
+ import matplotlib.pyplot as plt
2
+ import numpy as np
3
+
4
+ import matplotlib.cm as cm
5
+ import matplotlib.font_manager
6
+ from matplotlib.patches import PathPatch, Rectangle
7
+ from matplotlib.text import TextPath
8
+ import matplotlib.transforms as mtrans
9
+
10
+ # This is based on the functions from the MPL documentation page here: https://matplotlib.org/stable/gallery/misc/logos2.html
11
+
12
+ # NOTE: updated to a soft green
13
+ MMU_GREEN = '#155e3c'
14
+
15
+
16
+ def get_font_properties():
17
+ # NOTE: had to update
18
+ if matplotlib.font_manager.findfont('Calibri:bold'):
19
+ return matplotlib.font_manager.FontProperties(family='Calibri',
20
+ weight='bold')
21
+ if matplotlib.font_manager.findfont('Carlito:bold'):
22
+ print('Original font not found. Falling back to Carlito. '
23
+ 'The logo text will not be in the correct font.')
24
+ return matplotlib.font_manager.FontProperties(family='Carlito',
25
+ weight='bold')
26
+ print('Original font not found. '
27
+ 'The logo text will not be in the correct font.')
28
+ return None
29
+
30
+
31
+ def create_icon_axes(fig, ax_position, lw_bars, lw_grid, lw_border, rgrid):
32
+ """
33
+ Create a polar Axes containing the matplotlib radar plot.
34
+
35
+ Parameters
36
+ ----------
37
+ fig : matplotlib.figure.Figure
38
+ The figure to draw into.
39
+ ax_position : (float, float, float, float)
40
+ The position of the created Axes in figure coordinates as
41
+ (x, y, width, height).
42
+ lw_bars : float
43
+ The linewidth of the bars.
44
+ lw_grid : float
45
+ The linewidth of the grid.
46
+ lw_border : float
47
+ The linewidth of the Axes border.
48
+ rgrid : array-like
49
+ Positions of the radial grid.
50
+
51
+ Returns
52
+ -------
53
+ ax : matplotlib.axes.Axes
54
+ The created Axes.
55
+ """
56
+ with plt.rc_context({'axes.edgecolor': MMU_GREEN,
57
+ 'axes.linewidth': lw_border}):
58
+ ax = fig.add_axes(ax_position, projection='polar')
59
+ ax.set_axisbelow(True)
60
+
61
+ N = 7
62
+ arc = 2. * np.pi
63
+ theta = np.arange(0.0, arc, arc / N)
64
+ radii = np.array([2, 6, 8, 7, 4, 5, 8])
65
+ width = np.pi / 4 * np.array([0.4, 0.4, 0.6, 0.8, 0.2, 0.5, 0.3])
66
+ bars = ax.bar(theta, radii, width=width, bottom=0.0, align='edge',
67
+ edgecolor='0.3', lw=lw_bars)
68
+ for r, bar in zip(radii, bars):
69
+ color = *cm.jet(r / 10.)[:3], 0.6 # color from jet with alpha=0.6
70
+ bar.set_facecolor(color)
71
+
72
+ ax.tick_params(labelbottom=False, labeltop=False,
73
+ labelleft=False, labelright=False)
74
+
75
+ ax.grid(lw=lw_grid, color='0.9')
76
+ ax.set_rmax(9)
77
+ ax.set_yticks(rgrid)
78
+
79
+ # the actual visible background - extends a bit beyond the axis
80
+ ax.add_patch(Rectangle((0, 0), arc, 9.58,
81
+ facecolor='white', zorder=0,
82
+ clip_on=False, in_layout=False))
83
+ return ax
84
+
85
+
86
+ def create_text_axes(fig, height_px):
87
+ """Create an Axes in *fig* that contains 'matplotlib' as Text."""
88
+ ax = fig.add_axes((0, 0, 1, 1))
89
+ ax.set_aspect("equal")
90
+ ax.set_axis_off()
91
+
92
+ path = TextPath((0, 0), "matplotlib_map_utils", size=height_px * 0.8,
93
+ prop=get_font_properties())
94
+
95
+ angle = 4.25 # degrees
96
+ trans = mtrans.Affine2D().skew_deg(angle, 0)
97
+
98
+ patch = PathPatch(path, transform=trans + ax.transData, color=MMU_GREEN,
99
+ lw=0)
100
+ ax.add_patch(patch)
101
+ ax.autoscale()
102
+
103
+
104
+ def make_logo(height_px, lw_bars, lw_grid, lw_border, rgrid, with_text=False):
105
+ """
106
+ Create a full figure with the Matplotlib logo.
107
+
108
+ Parameters
109
+ ----------
110
+ height_px : int
111
+ Height of the figure in pixel.
112
+ lw_bars : float
113
+ The linewidth of the bar border.
114
+ lw_grid : float
115
+ The linewidth of the grid.
116
+ lw_border : float
117
+ The linewidth of icon border.
118
+ rgrid : sequence of float
119
+ The radial grid positions.
120
+ with_text : bool
121
+ Whether to draw only the icon or to include 'matplotlib' as text.
122
+ """
123
+ dpi = 100
124
+ height = height_px / dpi
125
+ figsize = (5 * height, height) if with_text else (height, height)
126
+ fig = plt.figure(figsize=figsize, dpi=dpi)
127
+ # NOTE: updated this
128
+ fig.patch.set_alpha(1)
129
+
130
+ if with_text:
131
+ create_text_axes(fig, height_px)
132
+ # NOTE updated this, manually positioned it
133
+ ax_pos = (0.28, 0.12, .075, 0.75) if with_text else (0.03, 0.03, .94, .94)
134
+ ax = create_icon_axes(fig, ax_pos, lw_bars, lw_grid, lw_border, rgrid)
135
+
136
+ return fig, ax
137
+
138
+ make_logo(height_px=500, lw_bars=0.7, lw_grid=0.5, lw_border=1,
139
+ rgrid=[1, 3, 5, 7], with_text=True)
140
+ # plt.show()
141
+ plt.savefig("./mmu_logo.png", bbox_inches="tight")
@@ -0,0 +1,63 @@
1
+ import pygris
2
+ import geopandas
3
+ import pyproj
4
+ import shapely
5
+ import contextily
6
+ import matplotlib.pyplot
7
+ from matplotlib_map_utils.core import north_arrow, scale_bar, ScaleBar, inset_map, indicate_detail, indicate_extent, dual_bars
8
+ from matplotlib_map_utils.utils import USA
9
+
10
+ # This is just a function to create a new, blank map with matplotlib, with our default settings
11
+ def new_map(rows=1, cols=1, figsize=(5,5), dpi=150, ticks=False):
12
+ # Creating the plot(s)
13
+ fig, ax = matplotlib.pyplot.subplots(rows,cols, figsize=figsize, dpi=dpi)
14
+ # Turning off the x and y axis ticks
15
+ if ticks==False:
16
+ if rows > 1 or cols > 1:
17
+ for a in ax.flatten():
18
+ a.set_xticks([])
19
+ a.set_yticks([])
20
+ else:
21
+ ax.set_xticks([])
22
+ ax.set_yticks([])
23
+ # Returning the fig and ax
24
+ return fig, ax
25
+
26
+ # states = pygris.states(cb=True, year=2022, cache=False).to_crs(3857)
27
+ states = geopandas.read_file("../../../matplotlib_map_utils/scratch/states.gpkg").to_crs(3857)
28
+ usa = USA()
29
+ contiguous = states.query(f"GEOID in {usa.filter_contiguous(True)}")
30
+ georgia = states.query(f"GEOID == '{usa.filter_abbr("GA")}'")
31
+
32
+ # Making a map of Georgia
33
+ fig, ax = new_map(figsize=(10,10))
34
+ georgia.buffer(75000).plot(ax=ax, facecolor="none", edgecolor="none") # this helps us "zoom out" a bit
35
+ georgia.plot(ax=ax, edgecolor="black", facecolor="none")
36
+
37
+ # Creating an inset map and extent indicator for the USA
38
+ cax = inset_map(ax, location="lower right", imsize=1.75, pad=0.1, xticks=[], yticks=[])
39
+ contiguous.plot(ax=cax, facecolor="none", edgecolor="black", linewidth=0.5)
40
+ indicate_extent(cax, ax, 3857, 3857)
41
+
42
+ # Creating an inset map and detail indicator for Atlanta, GA
43
+ atl_centroid = shapely.Point(pyproj.Transformer.from_crs(4326, 3857, always_xy=True).transform(-84.40123859860549, 33.75203795433787))
44
+ atl_buffer = atl_centroid.buffer(20000)
45
+ aax = inset_map(ax, location="upper right", imsize=1.75, pad=0.25, xticks=[], yticks=[])
46
+ geopandas.GeoSeries(atl_buffer).plot(ax=aax, facecolor="none", edgecolor="none")
47
+ indicate_detail(ax, aax, 3857, 3857, linecolor="cornflowerblue")
48
+
49
+ # Creating a north arrow
50
+ na = north_arrow(ax=ax, location="upper left", scale=0.5, rotation={"degrees":0})
51
+
52
+ # Creating a scale bar
53
+ # sb = scale_bar(ax=ax, style="boxes", location="lower left", bar={"length":2, "projection":3857}, text={"fontsize":8})
54
+ db = dual_bars(ax=ax, style="boxes", location="lower left",
55
+ bar={"rotation":0, "reverse":False, "projection":3857},
56
+ text={"fontsize": 8}, units={"loc":"text"})
57
+
58
+ # Adding contextily basemaps
59
+ contextily.add_basemap(ax, attribution="", source=contextily.providers.CartoDB.Voyager)
60
+ contextily.add_basemap(cax, attribution="", source=contextily.providers.CartoDB.VoyagerNoLabels)
61
+ contextily.add_basemap(aax, attribution="", source=contextily.providers.CartoDB.Voyager)
62
+
63
+ matplotlib.pyplot.savefig("./bigmap_w_elements.png", bbox_inches="tight")