r-devel / r-dev-day

Repo to organize tasks for R Dev Days
7 stars 2 forks source link

Bug 17148: rasterImage shows incorrect image orientation #75

Open hturner opened 4 hours ago

hturner commented 4 hours ago

This task is to create some test images to help with fixing Bug 17148. It has two parts - the second should only be attempt once the first is completed at least for the Cairo device.

Part 1: Image to check rotation

The following hand-drawn image is intended to demonstrate the documented behaviour of rasterImage: IMG_0863

We expect this image to display correctly on a Cairo device, but incorrectly on other devices. You can draw on a Cairo device by changing the graphics backend in RStudio (Tools > Global Options > General > Graphics > Backend: Cairo) or setting type = "cairo" when opening a file to draw on, e.g.

png("demo.png", type = "cairo)
plot(1:10)
dev.off()

Todo:

Share your R code and the 4 images (or as many of the 4 images that you can produce) in a comment on this issue.

hturner commented 4 hours ago

Part 2: Image to check orientation

In the first part, the raster (black square) was symmetrical about the diagonal from bottom-left (blue square) to top-right (red square). For the second image, we will use a non-symmetrical matrix that depicts an "F" shape: IMG_0866 This will help us check if rasterImage() preserves the order of cells within thewhen the axes are rotated (i.e. when the location of "bottom-left" and "top-right" are not in the same orientation as the canvas). When everything is working correctly, the plot should look something like this: IMG_0865

Warning: we think this will display correctly in the Cairo device, but it might not! Do not adapt the code to fix any problems you see!

Todo: