0

Hi I am wondering how to plot a heatmap with Gadfly for a n x n matrix. From what I saw the closest thing is Geom.rect or Geom.rectbin, but I am unable to get it in the format of grid.

using Gadfly: Geom, plot
a = rand(3,3)
plot(x = 1:9, y=1:9,color = a, Geom.rectbin)

enter image description here

imantha
  • 2,676
  • 4
  • 23
  • 46

1 Answers1

3

One option is to use spy():

using Gadfly
a=rand(9,9);
spy(a)

enter image description here

Ashlin Harris
  • 414
  • 2
  • 6
  • How would you add a text label inside each rectangle with the value of the element? – Royi Jul 14 '23 at 11:06