import ggplotnim, numericalnim, sequtils
for N in [10, 15, 20, 25, 30, 35, 37, 40]:
let xRow: seq[float] = linspace(0.0, 10.0, N)
let yCol: seq[float] = linspace(0.0, 10.0, N)
let z: seq[float] = newSeqWith(N*N, 1.0)
var x, y: seq[float]
for xi in xRow:
for yi in yCol:
x.add xi
y.add yi
let df = seqsToDf(x, y, z)
ggplot(df, aes("x", "y", fill = "z")) +
geom_raster() +
scale_x_continuous() + scale_y_continuous() +
scale_fill_continuous(scale = (low: -70.0, high: 70.0)) +
xlim(0.0, 10.0) + ylim(0.0, 10.0) +
ggsave("grid" & $N & ".png", width = 900, height = 800)
Result:
10x10
15x15
20x20
25x25
30x30
35x35
37x37
40x40
Expected behavior
No white lines.
No squares outside what xlim and ylim specifies. Here squares are outside of the range 0-10 that was specified.
Further note
It has the correct number of squares, N, draw out but the relevant range (0-10) only has N - 1 squares. This could lead to multiple points inside the same square potentially.
Code to reproduce:
Result:
Expected behavior
xlim
andylim
specifies. Here squares are outside of the range 0-10 that was specified.Further note
It has the correct number of squares, N, draw out but the relevant range (0-10) only has N - 1 squares. This could lead to multiple points inside the same square potentially.