Open
Description
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:
- The blue square marks the position of the (xleft, ybottom) coordinate
- The red square marks the position of the (xright, ytop) coordinate.
- Based on the blue and red squares, we can determine the direction of the positive x axis (from xleft to xright) and the positive y axis (from ybottom to ytop). These are marked by the arrows labelled x and y.
- Each quadrant shows a square with no rotation (angle = 0) and a rotation of 20 degrees anti-clockwise from positive x-axis about the bottom-left corner (angle = 20)
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:
- Write some R code based on the
raster4()
function in Martin Maechler's comment to create the test plot. Use a Cairo device when developing your code.- The quadrants in the test plot are reordered from Martin's code: the first column of plots in the test plot corresponds to the second column in Martin's code.
- Draw each black square based on a raster created from a 4x4 matrix of colours.
- Redraw the border of each black square using
rect()
,grid.rect()
. When everything is working correctly, this should draw on top of the previous border (you might play with line thickness/colour so we can see the overplotting). When something is not working, it may help us work out what is going wrong.
- Once you have a working plot on the Cairo device, try drawing the plot on the devices below. Create the device using
png(type = *)
orwindows()
. You may need to enlist helpers to draw the plot on different operating systems. We expect some or all of these to look incorrect due to the existing bug(s)!- Quartz (only available on macOS) - set via RStudio or
png()
- Xlib (only available on macOS/Linux)
- windows (only available on Windows)
- Quartz (only available on macOS) - set via RStudio or
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.
Activity