Skip to content

Commit 09853eb

Browse files
authored
fix docs visuals (#223)
1 parent dbb54f8 commit 09853eb

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

docs/projections.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
state = np.random.RandomState(51423)
6363
x = np.linspace(0, 2 * np.pi, N)[:, None] + np.arange(5) * 2 * np.pi / 5
6464
y = 100 * (state.rand(N, 5) - 0.3).cumsum(axis=0) / N
65-
fig, axs = uplt.subplots([[1, 1, 2, 2], [0, 3, 3, 0]], proj="polar")
65+
fig, axs = uplt.subplots([[1, 1, 2, 2], [0, 3, 3, 0]], proj="polar", share=0)
6666
axs.format(
6767
suptitle="Polar axes demo",
6868
linewidth=1,
@@ -134,10 +134,12 @@
134134
# Use an on-the-fly projection
135135
import ultraplot as uplt
136136

137-
fig = uplt.figure(refwidth=3)
138-
axs = fig.subplots(nrows=2, proj="robin", proj_kw={"lon0": 150})
139-
# proj = uplt.Proj('robin', lon0=180)
140-
# axs = uplt.subplots(nrows=2, proj=proj) # equivalent to above
137+
fig = uplt.figure(refwidth=3, share=0)
138+
axs = fig.subplots(
139+
nrows=2,
140+
proj="robin",
141+
proj_kw={"lon0": 150},
142+
)
141143
axs.format(
142144
suptitle="Figure with single projection",
143145
land=True,
@@ -151,7 +153,7 @@
151153
# Geographic backends
152154
# -------------------
153155
#
154-
# The :class:`ultraplot.axes.GeoAxes` class uses either `cartopy`_ or `basemap`_ as "backends"
156+
# The :class:`~ultraplot.axes.GeoAxes` class uses either `cartopy`_ or `basemap`_ as "backends"
155157
# to :ref:`format the axes <ug_geoformat>` and :ref:`plot stuff <ug_geoplot>` in
156158
# the axes. A few details:
157159
#
@@ -224,7 +226,7 @@
224226
# %%
225227
import ultraplot as uplt
226228

227-
fig = uplt.figure()
229+
fig = uplt.figure(share=0)
228230

229231
# Add projections
230232
gs = uplt.GridSpec(ncols=2, nrows=3, hratios=(1, 1, 1.4))
@@ -254,7 +256,7 @@
254256
# Plotting in projections
255257
# -----------------------
256258
#
257-
# In UltraPlot, plotting with `~ultraplot.axes.GeoAxes` is just like plotting
259+
# In UltraPlot, plotting with :class:`~ultraplot.axes.GeoAxes` is just like plotting
258260
# with :class:`~ultraplot.axes.CartesianAxes`. UltraPlot makes longitude-latitude
259261
# (i.e., Plate Carrée) coordinates the *default* coordinate system for all plotting
260262
# commands by internally passing ``transform=ccrs.PlateCarree()`` to cartopy commands
@@ -291,7 +293,7 @@
291293
for globe in (False, True):
292294
string = "with" if globe else "without"
293295
gs = uplt.GridSpec(nrows=2, ncols=2)
294-
fig = uplt.figure(refwidth=2.5)
296+
fig = uplt.figure(refwidth=2.5, share=0)
295297
for i, ss in enumerate(gs):
296298
cmap = ("sunset", "sunrise")[i % 2]
297299
backend = ("cartopy", "basemap")[i % 2]
@@ -321,7 +323,7 @@
321323
# Formatting projections
322324
# ----------------------
323325
#
324-
# The :meth:`ultraplot.axes.GeoAxes.format` command facilitates geographic-specific axes
326+
# The :meth:`~ultraplot.axes.GeoAxes.format` command facilitates geographic-specific axes
325327
# modifications. It can toggle and configure the "major" and "minor" longitude and
326328
# latitude gridline locations using the `grid`, `lonlocator`, `latlocator`, `gridminor`,
327329
# `lonminorlocator`, and `latminorlocator` keys, and configure gridline label formatting
@@ -334,7 +336,7 @@
334336
# to ``True``. The padding between the map edge and the labels can be changed
335337
# using `labelpad` or by changing :rcraw:`grid.labelpad`.
336338
#
337-
# `ultraplot.axes.GeoAxes.format` can also set the cartopy projection bounding longitudes
339+
# :meth:`~ultraplot.axes.GeoAxes.format` can also set the cartopy projection bounding longitudes
338340
# and latitudes with `lonlim` and `latlim` (analogous to `xlim` and `ylim`), set the
339341
# latitude bound for circular polar projections using `boundinglat`, and toggle and
340342
# configure geographic features like land masses, coastlines, and administrative
@@ -349,7 +351,7 @@
349351
import ultraplot as uplt
350352

351353
gs = uplt.GridSpec(ncols=3, nrows=2, wratios=(1, 1, 1.2), hratios=(1, 1.2))
352-
fig = uplt.figure(refwidth=4)
354+
fig = uplt.figure(refwidth=4, share=0)
353355

354356
# Styling projections in different ways
355357
ax = fig.subplot(gs[0, :2], proj="eqearth")
@@ -444,7 +446,7 @@
444446
# Plate Carrée map projection
445447
uplt.rc.reso = "med" # use higher res for zoomed in geographic features
446448
basemap = uplt.Proj("cyl", lonlim=(-20, 180), latlim=(-10, 50), backend="basemap")
447-
fig, axs = uplt.subplots(nrows=2, refwidth=5, proj=("cyl", basemap))
449+
fig, axs = uplt.subplots(nrows=2, refwidth=5, proj=("cyl", basemap), share=0)
448450
axs.format(
449451
land=True,
450452
labels=True,
@@ -462,7 +464,7 @@
462464

463465
# Pole-centered map projections
464466
basemap = uplt.Proj("npaeqd", boundinglat=60, backend="basemap")
465-
fig, axs = uplt.subplots(ncols=2, refwidth=2.7, proj=("splaea", basemap))
467+
fig, axs = uplt.subplots(ncols=2, refwidth=2.7, proj=("splaea", basemap), share=0)
466468
fig.format(suptitle="Zooming into polar projections")
467469
axs.format(land=True, latmax=80) # no gridlines poleward of 80 degrees
468470
axs[0].format(boundinglat=-60, title="Cartopy example")
@@ -472,7 +474,7 @@
472474
import ultraplot as uplt
473475

474476
# Zooming in on continents
475-
fig = uplt.figure(refwidth=3)
477+
fig = uplt.figure(refwidth=3, share=0)
476478
ax = fig.subplot(121, proj="lcc", proj_kw={"lon0": 0})
477479
ax.format(lonlim=(-20, 50), latlim=(30, 70), title="Cartopy example")
478480
proj = uplt.Proj("lcc", lon0=-100, lat0=45, width=8e6, height=8e6, backend="basemap")
@@ -557,7 +559,7 @@
557559
"eck5",
558560
"eck6",
559561
]
560-
fig, axs = uplt.subplots(ncols=3, nrows=10, figwidth=7, proj=projs)
562+
fig, axs = uplt.subplots(ncols=3, nrows=10, figwidth=7, proj=projs, share=0)
561563
axs.format(land=True, reso="lo", labels=False, suptitle="Table of cartopy projections")
562564
for proj, ax in zip(projs, axs):
563565
ax.format(title=proj, titleweight="bold", labels=False)
@@ -592,7 +594,9 @@
592594
"npaeqd",
593595
"nplaea",
594596
]
595-
fig, axs = uplt.subplots(ncols=3, nrows=8, figwidth=7, proj=projs, backend="basemap")
597+
fig, axs = uplt.subplots(
598+
ncols=3, nrows=8, figwidth=7, proj=projs, backend="basemap", share=0
599+
)
596600
axs.format(land=True, labels=False, suptitle="Table of basemap projections")
597601
for proj, ax in zip(projs, axs):
598602
ax.format(title=proj, titleweight="bold", labels=False)

0 commit comments

Comments
 (0)