-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Something in the lines of this snippet should do the trick
using Plots
gr()
# Sample data with discrete values
x = LinRange(-2, 2, 100)
y = LinRange(-2, 2, 100)
z = [round(xi^2 + yi^2) for xi in x, yi in y] # Discrete values`
# Identify unique values in z
unique_vals = sort(unique(vec(z)))
# Plot with one level per unique value
heatmap(x, y, z;
levels = length(unique_vals),
clims = (minimum(unique_vals), maximum(unique_vals)),
c = :viridis,
colorbar = true,
colorbar_ticks = (unique_vals, string.(unique_vals)) # Optional: label each tick
)Metadata
Metadata
Assignees
Labels
No labels