Heatmap wrong colorbar number resolution limits

Hello, good morning

I’m having some diffucults plotting a covariance matrix with low values. The colorbar always shows zero, and cant acquire the correct values. There are configurations thats solves this issue?

let
	# now for pca
	X = Matrix(df[!, 2:10])
	@info size(X)
	X = X .- mean(X, dims=1)
	@info size(X)

	# these data are observations by features, so we need X'X, not XX'
	covmat = X'*X / (size(X)[1] -1)
	@info covmat
	# visualize it
	heatmap(covmat, yflip=true, clims=(-.0002, .0002))
end

It is always good practice to share the plotting library being used. Also, do you expect a solution with this plotting library specifically, or a solution with an alternative library is desirable?

Its the Plots.jl. Solution maybe in any library, but will be better if it was implemented in Plots.jl

The problem seems to be that the colorbar got truncated by a narrow figure margin. Increase it with Measures:

using Measures(), Plots; gr()
M = (rand(9,9) .- 0.5)/2000
heatmap(M, clims=(-0.0002, 0.0002), margins=10mm)
4 Likes

@rafael.guerra thank you. It worked