-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
major update: rewrite imagesc parameters,
colorbar
, axis
, cgap
- Loading branch information
Showing
7 changed files
with
139 additions
and
30 deletions.
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
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 @@ | ||
# using GLMakie, MakieLayers | ||
using CairoMakie, MakieLayers | ||
using Test, Dates |
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,49 @@ | ||
include("main_pkgs.jl") | ||
## 该脚本用于说明,如何设置axis and colorbar properties | ||
|
||
t = 0.5:0.5:24 | ||
nhour = length(t) | ||
nday = 100 | ||
|
||
yticks = 0:3:24 |> format_ticks | ||
xticks = 0:20:100 |> format_ticks | ||
ticks = -0.5:0.1:0.5 |> format_ticks | ||
|
||
x = 1:nday | ||
y = t | ||
z = rand(nday, nhour, 2) | ||
|
||
# 2d array passed | ||
begin | ||
fig = Figure(; size=(600, 600)) | ||
ax, plt = imagesc!(fig, x, y, z[:, :, 1]; | ||
colorbar=(; ticks, width=30), cgap=5, | ||
axis=(; xticks, yticks, xlabel="Days", ylabel="Hours"), title="") | ||
fig | ||
end | ||
|
||
## 3d array passed perfectly | ||
z = rand(nhour, nday, 2) | ||
imagesc(x, y, z; | ||
colorbar=(; ticks, width=30), cgap=5, | ||
axis=(; xticks, yticks, xlabel="Days", ylabel="Hours")) | ||
|
||
## 3d array, 统一colorbar | ||
imagesc(x, y, z; | ||
colorrange=(0, 1), | ||
colorbar=(; ticks, width=30), cgap=15, | ||
axis=(; xticks, yticks, xlabel="Days", ylabel="Hours")) | ||
|
||
## 测试xlab and ylab | ||
begin | ||
fig = imagesc(x, y, z; | ||
colorrange=(0, 1), | ||
colorbar=(; ticks, width=30), cgap=15, gap=(10, 10), | ||
axis=(; xticks, yticks)) | ||
# xlabel = "Days", ylabel = "Hours" | ||
labs!(fig; xlabel="Days", ylabel="Hours") | ||
add_title!(fig, "Title"; fontsize=24, height=15) | ||
# add_xlabel!(fig, "Days") | ||
# add_ylabel!(fig, "Hours") | ||
fig | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
include("main_pkgs.jl") | ||
|
||
## 离散型变量colorbar | ||
z = round.(Int, rand(10, 10) * 10) | ||
|
||
colorrange = (0, 10) | ||
nbrk = colorrange[2] - colorrange[1] + 1 | ||
# 首尾 + (-0.5, 0.5),让ticks居中 | ||
|
||
cols = resample_colors(amwg256, 12) | ||
colors = cgrad(cols, nbrk, categorical=true) | ||
|
||
ticks = 0:10 |> format_ticks | ||
imagesc(z; colors, | ||
colorbar = (; ticks, width=30), cgap=5, | ||
colorrange=colorrange .+ (-0.5, 0.5), force_show_legend=true) |