Skip to content

Commit 05b04da

Browse files
committed
Improve docstrings
1 parent 0038aee commit 05b04da

File tree

1 file changed

+82
-114
lines changed

1 file changed

+82
-114
lines changed

src/makie_plots.jl

Lines changed: 82 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ function draw_hemi!(hp::HemiPlot)
139139

140140
return hp
141141
end
142-
142+
143143
"""
144144
hemi(; kwargs...) -> HemiPlot
145145
@@ -151,48 +151,31 @@ immediately drawn and ready for adding graphical elements: planes,
151151
lines, and small circles.
152152
153153
# Keyword Arguments
154-
- `view::Tuple{Real,Real} = (0, 90)`
155-
Viewing direction as `(trend, plunge)` in degrees.
156-
157-
- `grid::Symbol = :show`
158-
Whether to draw the stereonet grid (`:show` or `:hide`).
159-
160-
- `frame::Symbol = :show`
161-
Whether to draw the stereonet frame (`:show` or `:hide`).
162-
163-
- `net::Symbol = :wulff`
164-
Projection type. Choose between `:wulff` for equiangular ptojectos and`:schmidt` for equiareal ptojection.
165-
166-
- `sstep::Int = 10`
167-
Angular spacing (degrees) for small-circle grid.
168-
169-
- `gstep::Int = 10`
170-
Angular spacing (degrees) for great-circle grid.
171-
172-
- `acor::Real = 0`
173-
Additional rotation angle (degrees) around the z-axis applied after view transformation.
174-
175-
- `grid_color::Symbol = :gray`
176-
Color used for grid and frame elements.
177-
178-
- `grid_linestyle::Symbol = :dash`
179-
Line style for grid elements.
180-
181-
- `grid_linewidth::Real = 0.5`
182-
Line width for grid elements.
183-
184-
- `grid_alpha::Real = 1.0`
185-
Transparency for grid elements.
186-
187-
- `size::Tuple{Real,Real} = (600, 600)`
188-
Figure size in pixels.
154+
- `view::Tuple{Real,Real}`: Viewing direction as `(trend, plunge)` in degrees.
155+
Default is `(0, 90)`.
156+
- `grid::Symbol`: Whether to draw the stereonet grid (`:show` or `:hide`).
157+
Default is `:show`.
158+
- `frame::Symbol`: Whether to draw the stereonet frame (`:show` or `:hide`).
159+
Default is `:show`.
160+
- `net::Symbol`: Projection type. Choose between `:wulff` for equiangular
161+
projection and `:schmidt` for equal-area projection. Default is `:wulff`.
162+
- `sstep::Int`: Angular spacing (degrees) for small-circle grid. Default is `10`.
163+
- `gstep::Int`: Angular spacing (degrees) for great-circle grid. Default is `10`.
164+
- `acor::Real`: Additional rotation angle (degrees) around the z-axis applied
165+
after view transformation. Default is `0`.
166+
- `grid_color::Symbol`: Color used for grid and frame elements. Default is `:gray`.
167+
- `grid_linestyle::Symbol`: Line style for grid elements. Default is `:dash`.
168+
- `grid_linewidth::Real`: Line width for grid elements. Default is `0.5`.
169+
- `grid_alpha::Real`: Transparency for grid elements. Default is `1.0`.
170+
- `size::Tuple{Real,Real}`: Figure size in pixels. Default is `(600, 600)`.
189171
190172
# Returns
191-
- `HemiPlot`
192-
A plotting object to which elements can be added.
173+
- `HemiPlot`: A plotting object to which elements can be added.
193174
194175
# Examples
176+
```julia
195177
h = hemi(net = :wulff, view = (0, 90))
178+
```
196179
"""
197180
function hemi(;
198181
view::Tuple{Real,Real} = (0, 90),
@@ -255,31 +238,25 @@ Lineations are defined by trend and plunge and rendered as points
255238
on the selected stereonet projection.
256239
257240
# Arguments
258-
- `h::HemiPlot`
259-
Target stereonet plot.h = hemi(net = :wulff, view = (0, 90))
260-
261-
- `trd::Real or AbstractVector{<:Real}`
262-
Trend(s) in degrees.
263-
264-
- `plg::Real or AbstractVector{<:Real}`
265-
Plunge(s) in degrees.
241+
- `h::HemiPlot`: Target stereonet plot.
242+
- `trd::Real` or `AbstractVector{<:Real}`: Trend(s) in degrees.
243+
- `plg::Real` or `AbstractVector{<:Real}`: Plunge(s) in degrees.
266244
267245
# Keyword Arguments
268-
- `form::Symbol or AbstractVector{Symbol} = :a`
269-
270-
Whether linear features are treated as axis or vectors.
271-
Use `:a` to plot lines as axes or `:v` to plot lines as vectors.
272-
273-
- `kwargs...`
274-
Additional keyword arguments passed to Makie’s `scatter!`.
246+
- `form::Symbol` or `AbstractVector{Symbol}`: Whether linear features are treated
247+
as axes or vectors. Use `:a` to plot lines as axes or `:v` to plot lines as
248+
vectors. Default is `:a`.
249+
- `kwargs...`: Additional keyword arguments passed to Makie's `scatter!`.
275250
276251
# Returns
277252
- Makie plot object.
278253
279254
# Examples
255+
```julia
280256
lineations!(h, 45, 30)
281257
lineations!(h, [10, 40], [20, 60])
282-
"""
258+
```
259+
"""
283260
function lineations!(
284261
h::HemiPlot,
285262
trd::Union{Real, AbstractVector{<:Real}},
@@ -312,8 +289,6 @@ end
312289
return trend, plunge
313290
end
314291

315-
316-
317292
"""
318293
traces!(h::HemiPlot, dipdir, dip; hemi=:lower, view=:trace, kwargs...)
319294
@@ -324,43 +299,45 @@ the selected `view` mode. Multiple planes may be plotted in a single call
324299
by passing vectors of equal length.
325300
326301
# Arguments
327-
- `h::HemiPlot`
328-
Target stereonet plot.
329-
330-
- `dipdir::Real or AbstractVector{<:Real}`
331-
Dip direction(s) in degrees.
332-
333-
- `dip::Real or AbstractVector{<:Real}`
334-
Dip angle(s) in degrees.
302+
- `h::HemiPlot`: Target stereonet plot.
303+
- `dipdir::Real` or `AbstractVector{<:Real}`: Dip direction(s) in degrees.
304+
- `dip::Real` or `AbstractVector{<:Real}`: Dip angle(s) in degrees.
335305
336306
# Keyword Arguments
337-
- `hemi::Symbol = : lower`
338-
Hemisphere selection (`:lower` or `:upper`).
339-
340-
- `view::Symbol = :trace`
341-
Plot representation:
342-
- `:trace` — great-circle trace of the plane
343-
- `:pole` — pole to the plane
344-
345-
- `kwargs...`
346-
Additional keyword arguments passed to Makie’s `lines!` or `scatter!`.
307+
- `hemi::Symbol`: Hemisphere selection (`:lower` or `:upper`). Default is `:lower`.
308+
- `view::Symbol`: Planar feature representation. Options are `:trace` (great-circle
309+
trace of the plane) or `:pole` (pole to the plane). Default is `:trace`.
310+
- `polecolor::Symbol`: Fill color of the pole. Default is `:black`.
311+
- `polealpha::Real`: Alpha value of the pole fill color attribute. Default is `1.0`.
312+
- `strokecolor::Symbol`: Stroke color for pole outlines. Default is `:black`.
313+
- `strokewidth::Real`: Line width for pole outlines. Default is `0`.
314+
- `linecolor::Symbol`: Line color for traces. Default is `:black`.
315+
- `linewidth::Real`: Line width for traces. Default is `1.3`.
316+
- `linealpha::Real`: Line alpha value for traces. Default is `1.0`.
317+
- `kwargs...`: Additional keyword arguments passed to Makie's `lines!` or `scatter!`.
347318
348319
# Returns
349320
- Makie plot object.
350321
351322
# Examples
352-
lines!(h, 120, 45)
353-
lines!(h, [30, 60], [40, 50], view = :pole)
323+
```julia
324+
traces!(h, 120, 45)
325+
traces!(h, [30, 60], [40, 50], view = :pole)
326+
```
354327
"""
355328
function traces!(
356329
h::HemiPlot,
357330
dipdir::Union{Real, AbstractVector{<:Real}},
358331
dip::Union{Real, AbstractVector{<:Real}};
359332
hemi::Symbol = :lower,
360333
view::Symbol = :trace,
361-
color::Symbol = :black,
362-
linewidth::Real = 1,
363-
strokewidth=0,
334+
polecolor::Symbol = :black,
335+
polealpha::Real = 1,
336+
strokecolor::Symbol = :black,
337+
strokewidth::Real = 0,
338+
linecolor::Symbol = :black,
339+
linewidth::Real = 1.3,
340+
linealpha::Real = 1,
364341
kwargs...
365342
)
366343

@@ -381,12 +358,11 @@ function traces!(
381358
isa(curves, Matrix) && (curves = [curves])
382359

383360
for line in curves
384-
lines!(h.ax, line[:,1], line[:,2]; color=color, linewidth=linewidth, kwargs...)
361+
lines!(h.ax, line[:,1], line[:,2]; color=linecolor, alpha=linealpha, linewidth=linewidth, kwargs...)
385362
end
386363
return nothing
387364
end
388365

389-
390366
# Pole view
391367
trd = similar(dipdir_vec, Float64)
392368
plg = similar(dip_vec, Float64)
@@ -405,8 +381,7 @@ function traces!(
405381
)
406382

407383
pts = vcat(pts...)
408-
409-
return scatter!(h.ax, pts[:,1], pts[:,2]; strokewidth=strokewidth, kwargs...)
384+
return scatter!(h.ax, pts[:,1], pts[:,2]; color=polecolor, alpha=polealpha, strokecolor=strokecolor, strokewidth=strokewidth, kwargs...)
410385
end
411386

412387
#######################
@@ -485,48 +460,41 @@ angle. Depending on the view direction, a small circle may appear as a
485460
single closed curve or as two separate curve segments.
486461
487462
# Arguments
488-
- `h::HemiPlot`
489-
Target stereonet plot.
490-
491-
- `trd::Real or AbstractVector{<:Real}`
492-
Trend(s) of the cone axis in degrees.
493-
494-
- `plg::Real or AbstractVector{<:Real}`
495-
Plunge(s) of the cone axis in degrees.
496-
497-
- `angle::Real or AbstractVector{<:Real}`
498-
Cone opening angle(s) in degrees.
463+
- `h::HemiPlot`: Target stereonet plot.
464+
- `trd::Real` or `AbstractVector{<:Real}`: Trend(s) of the cone axis in degrees.
465+
- `plg::Real` or `AbstractVector{<:Real}`: Plunge(s) of the cone axis in degrees.
466+
- `angle::Real` or `AbstractVector{<:Real}`: Cone opening angle(s) in degrees.
499467
500468
# Keyword Arguments
501-
- `draw::Symbol = :line`
502-
Drawing mode:
503-
- `:line` — draw curve(s)
504-
- `:poly` — draw filled polygon(s)
505-
506-
- `color::Symbol = :skyblue1`
507-
Fill color when `draw = :poly`.
508-
509-
- `strokewidth::Real = 1`
510-
Line width for outlines.
511-
512-
- `kwargs...`
513-
Additional keyword arguments passed to Makie.
469+
- `draw::Symbol`: Drawing mode. Options are `:line` (draw curve(s)) or `:poly`
470+
(draw filled polygon(s)). Default is `:line`.
471+
- `fill::Symbol`: Color of the polygon. Default is `:skyblue1`.
472+
- `polyalpha::Real`: Alpha value of the fill attribute. Default is `0.3`.
473+
- `linecolor::Symbol`: Line color for outlines. Default is `:black`.
474+
- `linewidth::Real`: Line width for outlines. Default is `1.3`.
475+
- `linealpha::Real`: Line alpha value for outlines. Default is `0.5`.
476+
- `kwargs...`: Additional keyword arguments passed to Makie.
514477
515478
# Returns
516479
- Makie plot object.
517480
518481
# Examples
482+
```julia
519483
smallc!(h, 0, 0, 30)
520484
smallc!(h, [0, 90], [0, 0], [20, 40])
521-
"""
485+
```
486+
"""
522487
function smallc!(
523488
h::HemiPlot,
524489
trd::Union{Real, AbstractVector{<:Real}},
525490
plg::Union{Real, AbstractVector{<:Real}},
526491
angle::Union{Real, AbstractVector{<:Real}};
527492
draw::Symbol = :line,
528-
color::Symbol = :black,
529-
linewidth::Real = 1,
493+
fill::Symbol = :skyblue1,
494+
polyalpha::Real = 0.3,
495+
linecolor::Symbol = :black,
496+
linewidth::Real = 1.3,
497+
linealpha::Real = 0.3,
530498
kwargs...
531499
)
532500

@@ -562,15 +530,15 @@ function smallc!(
562530
#plot
563531
if draw == :line
564532
if !isempty(pts1) && isempty(pts2)
565-
return lines!(h.ax, vcat(pts1...); color=color, linewidth=linewidth, kwargs...)
533+
return lines!(h.ax, vcat(pts1...); color=linecolor, alpha=linealpha, linewidth=linewidth, kwargs...)
566534
elseif isempty(pts1) && !isempty(pts2)
567-
return lines!(h.ax, vcat(pts2...); color=color, linewidth=linewidth, kwargs...)
535+
return lines!(h.ax, vcat(pts2...); color=linecolor, alpha=linealpha, linewidth=linewidth, kwargs...)
568536
else
569-
return lines!(h.ax, vcat(vcat(pts1...), vcat(pts2...), [NaN NaN]); kwargs...)
537+
return lines!(h.ax, vcat(vcat(pts1...), vcat(pts2...), [NaN NaN]); color=linecolor, alpha=linealpha, linewidth=linewidth, kwargs...)
570538
end
571539
elseif draw == :poly
572540
if !isempty(polys)
573-
return poly!(h.ax, polys; color = color, strokewidth = 0 ,kwargs...)
541+
return poly!(h.ax, polys; color=fill, alpha=polyalpha, strokewidth=0 ,kwargs...)
574542
end
575543
end
576544

0 commit comments

Comments
 (0)