Skip to content

Commit

Permalink
Refactor plots
Browse files Browse the repository at this point in the history
  • Loading branch information
juliohm committed Oct 7, 2024
1 parent 4407e87 commit 180b908
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 36 deletions.
13 changes: 3 additions & 10 deletions ext/transioplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@
# ------------------------------------------------------------------

function transioplot(t::Transiogram;
# empirical transiogram options
# common transiogram options
color=:slategray,
pointsize=12,
segmentsize=1.5,
showtext=true,
textsize=12,
showhist=true,
histcolor=:slategray,

# theoretical transiogram options
size=1.5,
maxlag=nothing
)
# retrieve maximum lag
Expand All @@ -33,7 +26,7 @@ function transioplot(t::Transiogram;
for i in 1:L, j in 1:L
ax = Makie.Axis(fig[i, j])
ys = getindex.(y, i, j)
Makie.lines!(ax, x, ys, color = color)
Makie.lines!(ax, x, ys, color=color, linewidth=size)
end
fig
end
16 changes: 8 additions & 8 deletions ext/varioplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@

Makie.@recipe(VarioPlot, γ) do scene
Makie.Attributes(
# empirical variogram options
# common variogram options
color=:slategray,
size=1.5,
maxlag=nothing,

# empirical variogram options
pointsize=12,
segmentsize=1.5,
showtext=true,
textsize=12,
showhist=true,
Expand All @@ -17,10 +20,7 @@ Makie.@recipe(VarioPlot, γ) do scene
colormap=:viridis,
showrange=true,
rangecolor=:white,
rangemodel=SphericalVariogram,

# theoretical variogram options
maxlag=nothing
rangemodel=SphericalVariogram
)
end

Expand Down Expand Up @@ -52,7 +52,7 @@ function Makie.plot!(plot::VarioPlot{<:Tuple{EmpiricalVariogram}})
end

# visualize variogram
Makie.scatterlines!(plot, x, y, color=plot[:color], markersize=plot[:pointsize], linewidth=plot[:segmentsize])
Makie.scatterlines!(plot, x, y, color=plot[:color], markersize=plot[:pointsize], linewidth=plot[:size])

# visualize text counts
if plot[:showtext][]
Expand Down Expand Up @@ -143,5 +143,5 @@ function Makie.plot!(plot::VarioPlot{<:Tuple{Variogram}})
y = Makie.@lift $γ.($x)

# visualize variogram
Makie.lines!(plot, x, y, color=plot[:color])
Makie.lines!(plot, x, y, color=plot[:color], linewidth=plot[:size])
end
28 changes: 10 additions & 18 deletions src/plotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
Plot the variogram or varioplane `γ` with given `options`.
## Common variogram options:
* `color` - color of variogram
* `size` - size of variogram
* `maxlag` - maximum lag of variogram
## Empirical variogram options:
* `color` - color of variogram
* `pointsize` - size of points of variogram
* `segmentsize` - size of segments of variogram
* `showtext` - show text counts
* `textsize` - size of text counts
* `showhist` - show histogram
Expand All @@ -24,10 +28,6 @@ Plot the variogram or varioplane `γ` with given `options`.
* `rangecolor` - color of varioplane range
* `rangemodel` - range model (e.g. `SphericalVariogram`)
## Theoretical variogram options:
* `maxlag` - maximum lag for theoretical model
### Notes
* This function will only work in the presence of
Expand All @@ -42,19 +42,11 @@ function varioplot! end
Plot the transiogram `t` with given `options`.
## Empirical transiogram options:
* `color` - color of variogram
* `pointsize` - size of points of variogram
* `segmentsize` - size of segments of variogram
* `showtext` - show text counts
* `textsize` - size of text counts
* `showhist` - show histogram
* `histcolor` - color of histogram
## Theoretical transiogram options:
## Common transiogram options:
* `maxlag` - maximum lag for theoretical model
* `color` - color of transiogram
* `size` - size of transiogram
* `maxlag` - maximum lag of variogram
### Notes
Expand Down

0 comments on commit 180b908

Please sign in to comment.