Skip to content

Instantly share code, notes, and snippets.

@foldfelis
Created July 20, 2021 06:06
Show Gist options
  • Save foldfelis/46aa221da27bc4d8f63cc1b7446e2ff7 to your computer and use it in GitHub Desktop.
Save foldfelis/46aa221da27bc4d8f63cc1b7446e2ff7 to your computer and use it in GitHub Desktop.
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)))...])
@foldfelis
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment