sceneDevice: Graphics device based on Qt's Graphics View framework

Description Usage Arguments Details Value Note Author(s)


Starts a QGraphicsScene graphics device.


qsceneDevice(width = 10, height = 10, pointsize = 12, family = "")
QT(rscene, ..., antialias = TRUE, opengl = FALSE)



Width of the scene in inches, assuming 72 pixels per inch.


Height of the scene in inches, assuming 72 pixels per inch.


Default pointsize.


Default font family.


A QGraphicsScene instance produced by a call to qsceneDevice. Can be missing, in which case a suitable instance will be created (see ... below).


Arguments passed on to qsceneDevice if rscene is missing.


Logical flag. Specifies whether the view should be antialiased.


Logical flag. Specifies whether the view should be a QGLWidget, used for rendering OpenGL graphics.


qsceneDevice starts a graphics device that is based on Qt's Graphics View framework. In the abstract sense, the device is a ‘graphics scene’, which contains various graphical items such as circles, lines, and text. The scene itself is not tied to a particular on-screen view or output file. Further steps must be taken to view the contents of the scene, or render it to a file in a suitable format.

QT is convenient user-level wrapper for the qsceneDevice device. It returns a QGraphicsView instance (which is also a QWidget instance) whose scene is set to the QGraphicsScene instance created by a call to qsceneDevice(...). In addition, several predefined actions are associated with the view, allowing (through a context menu and keyboard shortcuts) zooming, printing, and exporting as a bitmap image. The device also supports basic interaction, namely, confirming new pages by pressing Enter and locator functionality.


qsceneDevice returns a QGraphicsScene instance. Drawing operations will result in QGraphicsItems being added to the scene. Note that unlike common R graphics devices, the return value is nontrivial.

QT returns a QGraphicsView instance.


There are several limitations in the current implementation, and it should not be considered stable. Reports of problematic behaviour (and of course suggested fixes) are welcome.

In particular, plotmath has trouble with character placement, although the characters themselves are mostly correct.


Deepayan Sarkar

qtutils documentation built on May 29, 2017, 5:54 p.m.

Related to sceneDevice in qtutils...