You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example above, data from the tips data set is arranged by the attributes 'sex' and 'smoker'. Since both of those attributes can take on one of two values, the resulting grid has two columns and two rows. A histogram is displayed for each cell of the grid.
Example above is the same as previous except the plot is set to kernel density estimation. This shows how easy it is to have different plots for the same Trellis structure.
It is possible to only use one attribute for grouping data. The example above only uses 'sex' attribute. If the second grouping attribute is not specified, the plots will be arranged in a column.
As shown above, scatter plots are also possible. Scatter plots allow you to map various data attributes to graphical properties of the plot. In the example above the colour and shape of the scatter plot graphical objects is mapped to 'day' and 'size' attributes respectively. You use scale objects to specify these mappings. The list of scale classes is given below with initialization arguments for quick reference.
1527
+
1528
+
1529
+
Scales
1530
+
~~~~~~
1531
+
1532
+
::
1533
+
1534
+
ScaleGradient(column, colour1, colour2)
1535
+
1536
+
This one allows you to map an attribute (specified by parameter column) value to the colour of a graphical object. The larger the value of the attribute the closer the colour will be to colour2, the smaller the value, the closer it will be to colour1.
1537
+
1538
+
::
1539
+
1540
+
ScaleGradient2(column, colour1, colour2, colour3)
1541
+
1542
+
The same as ScaleGradient but interpolates linearly between three colours instead of two.
1543
+
1544
+
::
1545
+
1546
+
ScaleSize(column, min_size, max_size, transform)
1547
+
1548
+
Map attribute value to size of the graphical object. Parameter min_size (default 5.0) is the minimum size of the graphical object, max_size (default 100.0) is the maximum size and transform is a one argument function that will be used to transform the attribute value (defaults to lambda x: x).
1549
+
1550
+
::
1551
+
1552
+
ScaleShape(column)
1553
+
1554
+
Map the shape of the object to attribute value. The attribute has to be categorical.
1555
+
1556
+
::
1557
+
1558
+
ScaleRandomColour(column)
1559
+
1560
+
Assign a random colour to a value of categorical attribute specified by column.
0 commit comments