Skip to content

Commit

Permalink
Add arrows example
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 committed Jun 8, 2024
1 parent 60329c4 commit 7733e6a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ examples = [
"geostationary_image.jl",
"multiple_crs.jl",
"is_it_a_plane.jl",
joinpath("gmt", "antioquia.jl"),
joinpath("cartopy", "annotation.jl"),
joinpath("cartopy", "katrina.jl"),
joinpath("cartopy", "arrows.jl"),
joinpath("cartopy", "vesta.jl"),
joinpath("gmt", "antioquia.jl"),
"german_lakes.jl",
"field_and_countries.jl",
"meshimage.jl",
Expand Down
36 changes: 36 additions & 0 deletions examples/cartopy/arrows.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# # Gridded arrows
# This example was taken from the [Cartopy gridded arrow example].

# The big idea is to plot arrows from one CRS in another!

xs = LinRange(311.9, 391.1, 30)
ys = LinRange(-23.6, 24.8, 20)

us = @. 1 * (2 * cos(2 * deg2rad(xs) + 3 * deg2rad(ys' + 30)) ^ 2)
vs = @. 2 * cos(6 * deg2rad(xs)) .+ ys' * 0 # that last part is just to establish the shape

pole_longitude=177.5
pole_latitude=37.5
arrow_crs = "+proj=ob_tran +o_proj=latlon +o_lon_p=0 +o_lat_p=$(pole_latitude) +lon_0=$(180+pole_longitude) +to_meter=$(deg2rad(1) * 6378137.0)"

f, a, p = arrows(
xs, ys, us, vs;
arrowsize = 4,
source = arrow_crs,
axis = (; type = GeoAxis, dest = "+proj=ortho +lon_0=-10 +lat_0=45")
)
# Now we plot the background:
ep = surface!(a,
-180..180, -90..90,
zeros(axes(rotr90(GeoMakie.earth())));
shading = NoShading, color = rotr90(GeoMakie.earth())
)
translate!(ep, 0, 0, -1)
f

```@cardmeta
Title = "Arrows"
Description = "Gridded arrows"
Cover = f
```

3 changes: 3 additions & 0 deletions examples/cartopy/vesta3d.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using CairoMakie, GeoMakie

const Da

0 comments on commit 7733e6a

Please sign in to comment.