How to create bitmap display in R?

The X Window System is a windowing system for bitmap displays. In R, we can create this graphical display by simply typing x11 in the R console and the graphic interface will pop-up on the right-hand side. We can change the width and height of this display by using the arguments width and height inside x11 call. There are many other arguments of x11 that helps us to change the aesthetic property of the bitmap display. The description of those arguments is as written below:


the display on which the graphics window will appear. The default is to use the value in the user's environment variable DISPLAY. This is ignored (with a warning) if an X11 device is already open on another display.

width, height

the width and height of the plotting window, in inches. If NA, taken from the resources and if not specified there defaults to 7 inches.


the default pointsize to be used. Defaults to 12.


gamma correction fudge factor. Colours in R are sRGB; if your monitor does not conform to sRGB, you might be able to improve things by tweaking this parameter to apply additional gamma correction to the RGB channels. By default 1 (no additional gamma correction).


colour, the initial background colour. Default "transparent".


colour. The colour of the canvas, which is visible only when the background colour is transparent. Should be an opaque colour (and any alpha value will be ignored). Default "white".


for type = "Xlib" only: X11 font description strings into which weight, slant and size will be substituted. There are two, the first for fonts 1 to 4 and the second for font 5, the symbol font. See section ‘Fonts’.


The default family: a length-one character string. This is primarily intended for cairo-based devices, but for type = "Xlib", the X11Fonts() database is used to map family names to fonts (and this argument takes precedence over that one).

xpos, ypos

integer: initial position of the top left corner of the window, in pixels. Negative values are from the opposite corner, e.g.xpos = -100 says the top right corner should be 100 pixels from the right edge of the screen. If NA (the default), successive devices are cascaded in 20 pixel steps from the top left. See also ‘Resources’.


character string, up to 100 bytes. With the default, "", a suitable title is created internally. A C-style format for an integer will be substituted by the device number (see the file argument to postscript for further details). How non-ASCII titles are handled is implementation-dependent.


character string, one of "Xlib", "cairo", "nbcairo" or "dbcairo". Only the first will be available if the system was compiled without support for cairographics. The default is "cairo" where available except on macOS, otherwise "Xlib".


for cairo types, the type of anti-aliasing (if any) to be used. One of c("default", "none", "gray", "subpixel").


logical: should the defaults be reset to their defaults?


> x11()



> x11(width=4,height=2)


Updated on: 23-Nov-2020


Kickstart Your Career

Get certified by completing the course

Get Started