Skip to content

Commit d827fcc

Browse files
Update recipe 20: gopen & gclose in same block for plot to emerge
1 parent d162dcb commit d827fcc

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

docs/source/recipes/plot_20_recipe.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,22 @@
6868
div = cf.div_xy(u_2, v_2, radius="earth")
6969

7070
# %%
71-
# 8. Generate the final plot. First we configure the overall plot by
71+
# 8. First we configure the overall plot by
7272
# making the map higher resolution, to show the coastlines of the UK and
7373
# Ireland in greater detail, and changing the colourmap to better reflect
7474
# the data which can be positive or negative, i.e. has 0 as the 'middle'
75-
# value of significance, so should use a diverging colour map. Then we
76-
# plot the current vectors, noting we had to play around with the 'stride'
77-
# and 'scale' parameter values to adjust the vector spacing and size so that
78-
# the vector field is best represented and visible without over-cluttering
79-
# the plot. Finally we plot the divergence as a contour plot without any
80-
# lines showing. This compound plot is saved on one canvas using 'gopen'
81-
# and 'gclose' to wrap the two plotting calls:
75+
# value of significance, so should use a diverging colour map.
8276
cfp.mapset(resolution="10m")
8377
cfp.cscale("ncl_default")
78+
79+
# %%
80+
# 9. Now generate the final plot. Plot the current vectors, noting we had
81+
# to play around with the 'stride' and 'scale' parameter values to adjust
82+
# the vector spacing and size so that the vector field is best represented
83+
# and visible without over-cluttering the plot. Finally we plot the
84+
# divergence as a contour plot without any lines showing. This compound
85+
# plot is saved on one canvas using 'gopen' and 'gclose' to wrap the two
86+
# plotting calls:
8487
cfp.gopen(
8588
file=f"irish-sea-currents-divergence-{chosen_time.replace(' ', '-')}.png"
8689
)

0 commit comments

Comments
 (0)