-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #408 from SpeedyWeather/mk/plot
plot(::LowerTriangularMatrix)
- Loading branch information
Showing
5 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
function plot(L::LowerTriangularMatrix{T}; mode::Function=abs) where T | ||
|
||
l,m = size(L) | ||
title ="$l×$m LowerTriangularMatrix{$T}" | ||
|
||
Lplot = similar(L,real(T)) | ||
for lm in eachharmonic(L) | ||
Lplot[lm] = mode(L[lm]) | ||
end | ||
|
||
# use at most 33x32 points in height x width, but fewer for smaller matrices | ||
height = min(l,33) | ||
width = min(m,32) | ||
|
||
plot_kwargs = pairs(( xlabel="m", | ||
xoffset=-1, | ||
ylabel="ℓ", | ||
yoffset=-1, | ||
title=title, | ||
colormap=:inferno, | ||
compact=true, | ||
colorbar=true, | ||
zlabel=string(mode), | ||
array=true, | ||
width=width, | ||
height=height)) | ||
|
||
return UnicodePlots.heatmap(Lplot;plot_kwargs...) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# to avoid ambiguity with exporting plot | ||
plot(L::LowerTriangularMatrix{T}; kwargs...) where T = LowerTriangularMatrices.plot(L;kwargs...) | ||
plot(G::AbstractGrid{T}; kwargs...) where T = RingGrids.plot(G;kwargs...) |