Skip to content

Commit 3c01d3c

Browse files
committed
update AoG examples
1 parent 71438cb commit 3c01d3c

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

docs/src/tutorials/plottingmaps.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ nothing # hide
134134
and now plot
135135

136136
````@example AoG
137-
data(dim_data) * mapping(:lon, :lat; color=:value) * visual(Scatter) |> draw
137+
data(dim_data) * mapping(:lon, :lat; color=Symbol("Near-Surface Air Temperature")) * visual(Scatter) |> draw
138138
````
139139

140140
::: warning
@@ -146,7 +146,7 @@ Note that we are using a `Scatter` type per point and not the `Heatmap` one. The
146146
set other attributes
147147

148148
````@example AoG
149-
plt = data(dim_data) * mapping(:lon, :lat; color=:value)
149+
plt = data(dim_data) * mapping(:lon, :lat; color=Symbol("Near-Surface Air Temperature"))
150150
draw(plt * visual(Scatter, marker=:rect), scales(Color = (; colormap = :plasma));
151151
axis = (width = 600, height = 400, limits=(0, 360, -90, 90)))
152152
````
@@ -166,14 +166,15 @@ nothing # hide
166166
````
167167

168168
````@example AoG
169-
plt = data(dim_time) * mapping(:lon, :lat; color = :value, layout = :time => nonnumeric)
169+
plt = data(dim_time) * mapping(:lon, :lat; color=Symbol("Near-Surface Air Temperature"), layout = :time => nonnumeric)
170170
draw(plt * visual(Scatter, marker=:rect))
171171
````
172172

173173
again, let's add some additional attributes
174174

175175
````@example AoG
176-
plt = data(dim_time) * mapping(:lon, :lat; color = :value, layout = :time => nonnumeric)
176+
plt = data(dim_time) * mapping(:lon, :lat; color=Symbol("Near-Surface Air Temperature"),
177+
layout = :time => nonnumeric)
177178
draw(plt * visual(Scatter, marker=:rect), scales(Color = (; colormap = :magma));
178179
axis = (; limits=(0, 360, -90, 90)),
179180
figure=(; size=(900,600)))
@@ -182,14 +183,16 @@ draw(plt * visual(Scatter, marker=:rect), scales(Color = (; colormap = :magma));
182183
most [Makie plot functions](https://docs.makie.org/stable/reference/plots/overview) should work. See `lines` for example
183184

184185
````@example AoG
185-
plt = data(dim_data[lon=50..100]) * mapping(:lat, :value => "tas"; color=:value => "tas")
186+
plt = data(dim_data[lon=50..100]) * mapping(:lat, Symbol("Near-Surface Air Temperature") => "tas";
187+
color=Symbol("Near-Surface Air Temperature") => "tas")
186188
draw(plt * visual(Lines); figure=(; size=(650,400)))
187189
````
188190

189191
or faceting them
190192

191193
````@example AoG
192-
plt = data(dim_data[lon=50..59]) * mapping(:lat, :value => "tas"; color=:value => "tas",
194+
plt = data(dim_data[lon=50..59]) * mapping(:lat, Symbol("Near-Surface Air Temperature") => "tas";
195+
color=Symbol("Near-Surface Air Temperature") => "tas",
193196
layout = :lon => nonnumeric)
194197
draw(plt * visual(Lines); figure=(; size=(650,400)))
195198
````
@@ -204,7 +207,7 @@ dim_series = c[time=DateTime("2015-01-01") .. DateTime("2015-01-04"), lon = 150
204207
and plot
205208

206209
````@example AoG
207-
plt = data(dim_series) * mapping(:time, :value => "tas"; color=:lon => nonnumeric)
210+
plt = data(dim_series) * mapping(:time, Symbol("Near-Surface Air Temperature") => "tas"; color=:lon => nonnumeric)
208211
draw(plt * visual(ScatterLines), scales(Color = (; palette = :tableau_colorblind));
209212
figure=(; size=(800,400)))
210213
````
@@ -214,7 +217,7 @@ draw(plt * visual(ScatterLines), scales(Color = (; palette = :tableau_colorblind
214217
Basic statistical [analysis](https://aog.makie.org/stable/generated/analyses/) can also be done, for example:
215218

216219
````@example AoG
217-
specs = data(dim_data[lat=50..55]) * mapping(:lon, :value => "tas"; color=:lat => nonnumeric)
220+
specs = data(dim_data[lat=50..55]) * mapping(:lon, Symbol("Near-Surface Air Temperature") => "tas"; color=:lat => nonnumeric)
218221
specs *= (smooth() + visual(Scatter))
219222
draw(specs; figure=(; size=(700,400)))
220223
````

src/Cubes/Cubes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function name(a::YAXArray)
142142
return NoName()
143143
end
144144

145-
"Label of an YAXArrray using CF conventions. Includes the name and the unit, if present. Searches first for metadata `units` followed by `unit``"
145+
"Label of an YAXArrray using CF conventions. Includes the name and the unit, if present. Searches first for metadata `units` followed by `unit`"
146146
function label(a::YAXArray)
147147
# as implemented in python xarray
148148
isempty(a.properties) && return ""

0 commit comments

Comments
 (0)