posit-dev / positron

Positron, a next-generation data science IDE
Other
2.5k stars 77 forks source link

Plotting a `stars` raster does not work while `terra` does. #3834

Open jospueyo opened 3 months ago

jospueyo commented 3 months ago

Positron Version:

Positron Version: 2024.06.1 (system setup) build 2024.06.1-54 Code - OSS Version: 1.90.0 Commit: 5115c73e0670f39139e55eeedf0717b468a0658d Date: 2024-07-03T03:17:46.140Z Electron: 29.4.0 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Windows_NT x64 10.0.22631

Steps to reproduce the issue:

library(stars)
library(terra)

r <- matrix(runif(9), nrow = 3) |> 
  st_as_stars()

plot(r)

rast(r) |> plot()

What did you expect to happen?

Plotting the stars raster only plots the legend while plotting a terra raster works properly. I tried the same in the R console outside positron and both plots were correct.

Were there any error messages in the output or Developer Tools console?

No

jmcphers commented 3 months ago

Thanks for reporting (and for the minimal example); I can reproduce this.

image

Interestingly enough if you render a second plot and then go back to the first one, it's rendered correctly!

image
juliasilge commented 1 month ago

Take a look at the code for plot.stars: https://github.com/r-spatial/stars/blob/main/R/plot.R

I believe this is related to #3667 and #3562 and our problems with par().