plot_pixels {pixelclasser}R Documentation

Plot the pixels of a transformed image

Description

This function is a wrapper for function graphics::points() for plotting the pixels of an object of class "pixel_transformed_image" on an rgb plot.

Usage

plot_pixels(image_rgb, x_axis, y_axis, ...)

Arguments

image_rgb

an object of class "pixel_transformed_image" produced by read_image().

x_axis

a character string indicating the colour variable that corresponds to the x axis, one of "r", "g" or "b".

y_axis

a character string indicating the colour variable that corresponds to the x axis.

...

additional graphical parameters to be passed to graphics::points(), mainly to set the colour (col) of the points.

Details

It is advantageous to specify a colour such as "#00000005" which is black but almost transparent. In this way a kind of density plot is created because the clustering of points creates areas of darker colour. Note that a colour without specific transparency information defaults to an opaque colour, so "#000000" is the same as "#000000ff". The colours can be specified in any form understandable by grDevices::col2rgb, but the hexadecimal string allows setting the colour transparency. Note also that the points are plotted using pch = ".", as any other symbol would clutter the graph.

Warning: plotting several million points in an R graph is a slow process. Be patient or reduce the size of the images as much as possible. A nice smartphone with a petapixel camera sensor is good for artistic purposes, but not always for efficient scientific work.

Value

The function does not return any value.

See Also

plot_rgb_plane, col2rgb

Examples


# Plotting the pixels of the example image included in this package
ivy_oak_rgb <- read_image(system.file("extdata", "IvyOak400x300.JPG",
                                       package = "pixelclasser"))
plot_rgb_plane("g", "b")
plot_pixels(ivy_oak_rgb, "g", "b", col = "#00000005")


[Package pixelclasser version 1.1.1 Index]