diff --git a/docs/source/recipes/plot_17_recipe.py b/docs/source/recipes/plot_17_recipe.py index a34f872c3a..17112913eb 100644 --- a/docs/source/recipes/plot_17_recipe.py +++ b/docs/source/recipes/plot_17_recipe.py @@ -1,9 +1,11 @@ """ -Plotting Contour Subplots with different Colour Maps/Scales -============================================ +Plotting contour subplots with different colour maps/scales +=========================================================== + In this recipe, we will plot data with different colour maps to illustrate the importance of choosing the correct one for a plot. This is to ensure the use of perceptually uniform scales and avoid unintended bias. + """ # %% @@ -15,9 +17,8 @@ # %% # 2. Read the field in: -# Here I've used sample data ggap.nc (and later pressure=850), but you could use tas_A1.nc -# (with time=15) - +# Here I've used sample data ggap.nc (and later pressure=850), but you +# could use tas_A1.nc (with time=15) PATH="~/git-repos/cf-plot/cfplot/test/cfplot_data" f = cf.read(f"{PATH}/ggap.nc")[0] @@ -26,18 +27,16 @@ # Choose a set of predefined colour scales to view (based on NCAR) # You could also choose your own from # https://ncas-cms.github.io/cf-plot/build/colour_scales.html -# Simply change the name in quotes and ensure the number of rows * number of columns = -# number of colour scales +# Simply change the name in quotes and ensure the +# number of rows * number of columns = number of colour scales # %% # a. Perceptually uniform colour scales, with no zero value - colour_scale = ["viridis", "magma", "inferno", "plasma", "parula", "gray"] cfp.gopen(rows=2, columns=3, bottom=0.2) # %% # b. NCAR Command Language - Enhanced to help with colour blindness - colour_scale = [ "StepSeq25", "posneg_2", @@ -53,12 +52,10 @@ # %% # c. Orography/bathymetry colour scales - -# These are used to show the shape/contour of landmasses, bear in mind the example data -# we use is with pressure so doesnt accurately represent this. -# You could instead use cfp.cscale('wiki_2_0', ncols=16, below=2, above=14) or any other -# orography colour scale in a similar way - +# These are used to show the shape/contour of landmasses, bear in mind the +# example data we use is with pressure so doesnt accurately represent this. +# You could instead use cfp.cscale('wiki_2_0', ncols=16, below=2, above=14) +# or any other orography colour scale in a similar way. colour_scale = [ "os250kmetres", "wiki_1_0_2", @@ -70,9 +67,9 @@ cfp.gopen(rows=2, columns=3, bottom=0.2, file="ColourPlot.png") # %% -# 5. We then use a for loop to cycle through all the different colour maps: -# Only gpos has 1 added because it can only take 1 as its first value, otherwise there are -# errors. +# 4. We then use a for loop to cycle through all the different colour maps: +# Only gpos has 1 added because it can only take 1 as its first value, +# otherwise there are errors. for i, colour_scale in enumerate(colour_scale): cfp.gpos(i + 1) cfp.mapset(proj="cyl")