Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raster plot has white lines for big plots and doesn't use xlim and ylim correctly #107

Open
HugoGranstrom opened this issue Jan 3, 2021 · 1 comment

Comments

@HugoGranstrom
Copy link
Contributor

Code to reproduce:

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
    grid10
  • 15x15
    grid15
  • 20x20
    grid20
  • 25x25
    grid25
  • 30x30
    grid30
  • 35x35
    grid35
  • 37x37
    grid37
  • 40x40
    grid40

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.

@Vindaar
Copy link
Owner

Vindaar commented Jan 3, 2021

The white lines are fixed with #108.

geom_raster not respecting x/ylim is still an open issue though, which is why I'm leaving this open for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants