break_str() can break characters strings into "several lines" by replacing certain characters with
\n, which may be useful to wrap long (axis) labels. This is the default way to deal with labels in par-coords plot. See
?break_str for details.
extend_ranges() can accept a numeric vector or a vector of length 2 or a matrix and return the extended limits. The form of the matrix matches with
qrect in qtbase, i.e.
x0 y0 x1 y1
We aim to replace the old
make_window_ranges() in the near future.
match_key() was designed to save some typing efforts like
event$key() == Qt$Qt$Key_PageDown; we can use
match_key('PageDown') inside an event callback function to do the same thing. See
?match_key or the source code of
qparallel() for examples.
reorder_var() can reorder a data frame in various ways: ANOVA, MDS or random forest.
axis_loc() calculate the "pretty" locations of tick marks.
As long as you have a correct meta data structure, you can call
draw_brush(painter, brush, meta) to draw a brush rectangle. See the source code of
qparallel() for applications.
Similarly we can use
draw_identify() to draw labels.
sync_limits() can sync the limits of an arbitrary number of layers; all the limits are set to
meta$limits, so it is important that you remember to update this component in the meta data.
switch_value('x', 'y') can switch the values of the variables
y; this function is designed to make it easier to handle horizontal and vertical plots, in which we only need to switch some variables in the meta data and the drawing remains the same. See the source code of
qbar() for example.
check_data() in the first place in a plotting function; if the data provided was not created from
qdata(), it will do the conversion and issue a message.
last_data() should be a reasonable default for the
data argument of a plotting function.
set_cursor() can change the cursor on a plot view, as long as you attach an event on
qhist() for an example).
lighter() does the job.
A series of functions like
common_xxx_xxx() can reduce the length of code and make all plots more consistent in terms of interactions.