Created
July 20, 2021 06:06
-
-
Save foldfelis/46aa221da27bc4d8f63cc1b7446e2ff7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using Plots | |
######### | |
# utils # | |
######### | |
struct FontArgv | |
size::Int64 | |
color::Symbol | |
end | |
function with_font(v::Number, font::FontArgv) | |
return text("$v", font.size, font.color) | |
end | |
############ | |
# user def # | |
############ | |
# data | |
xs = ys = [1:10...] | |
zs = rand(10, 10) | |
# ticks transform | |
xticks = yticks = (xs, ["$(string('a'-1+i))pple" for i in xs]) | |
# PlotFont generator | |
wf = v -> with_font(v, FontArgv(8, :black)) | |
# plotting process | |
heatmap( | |
xs, ys, zs, | |
xticks=xticks, yticks=yticks, xrotation=45, | |
xlabel="xpple", ylabel="ypple", title="Peter's farm", | |
color=:coolwarm | |
) | |
annotate!([tuple.(xs', ys, wf.(round.(zs, digits=2)))...]) |
Author
foldfelis
commented
Jul 20, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment