Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Meta data

yihui edited this page · 1 revision

The meta data is used to store auxiliary information related to plotting, e.g. the limits of data (will be used in qlayer(..., limits)), the axis labels, tick mark locations and so on. Meta data is created by reference classes (setRefClass) using signaling fields in the objectSignals package. Examples can be found in qbar() and qparallel(). Two main advantages of using reference classes are:

  1. it is a dynamic data structure in the sense that we can modify it anywhere so we do not have to worry about the variable scope (actually we can modify any copy of it anywhere); for example, the xat and yat components of meta contain the tick marks locations and they are used to create axes (in qaxis()); if they are updated inside a plotting function, the axes layers will be updated accordingly.

  2. we can bind events on it, which is very convenient; for example, we can attach an event on meta$limits so that whenever it is changed, the layer using these limits will be updated:

meta$limitsChanged$connect(function() {

Many functions in cranvas are using this meta data structure, e.g. layer functions qaxis(), qgrid(), qmtext and qbxp(); utilities common_key_press(), common_key_release(), update_brush_size(), draw_brush() and manual_brush(), etc. To make these functions work, we need to design the meta data with some common components, currently including:

Something went wrong with that request. Please try again.