1. Trelliscope options
Now that we've learned how to create Trelliscope displays with facet_trelliscope and data frames of plots, let's look a little closer at some of the customization options provided when creating a Trelliscope display.
2. Trelliscope options
There are many options provided for customizing the output of a Trelliscope display. This includes where the display is stored on your computer, storing multiple displays, specifying the panel aspect ratio, and specifying the default viewer state.
3. Specifying the output directory
One of the most commonly-used options for trelliscope output is to specify the location where the display is stored.
By default, a trelliscope display is stored as a stand-alone web page stored in a directory. This has many benefits, including the ability to easily share the display with others by sending the directory or hosting the directory on the web through various services such as github pages.
You can specify where a display should be stored using the path argument, which is available in both facet_trelliscope() and trelliscope(). If no path is specified, the display is stored in a temporary directory.
Note that if a display is created in a directory that already contains a display with the same name, it will be overwritten. However, if you create a display with a different name in the same directory, the Trelliscope viewer will initially bring up both displays and provide an option for which one to view.
4. Detailed descriptions
Often the single-string display description is not sufficient to communicate the purpose of your display. If you want to provide more detail, an argument, md_desc, is available that will allow you to provide multi-line markdown content as a description, which will be displayed when the "info" icon is clicked in the viewer.
5. Plot aspect ratio
The panel aspect ratio, which is the plot height divided by the plot width) is a very important consideration for effective data display. It is often easier to communicate various visual phenomena by deliberately choosing an aspect ratio that emphasizes the interesting behavior.
For example, in an earlier exercise, we specified the aspect ratio to help us see the difference in patterns of number of taxi rides between day-of-week behavior and payment type.
6. Plot aspect ratio
If we had instead chosen a different aspect ratio, we wouldn't be able to see the pattern.
7. Plot aspect ratio
In trelliscope, the panel aspect ratio is determined by specifying the panel width and height, which can be thought of in units of pixels. Note that panels are expanded or shrunk according to the available screen real estate (while preserving aspect ratio), so that these numbers are not absolute, but are used to compute the aspect ratio.
When creating panels using systems that generate static images such as ggplot2, the units of pixels matter in that you can increase or decrease the width and height to change the size of markers and labels in the plot.
By default the panel aspect ratio is square, with width and height set at 500 pixels.
8. Default viewer state
We've seen that we can specify some aspects of the default viewer state fairly easily, such as the number of rows and columns of panels and which cognostic labels are displayed by default. The state argument provides additional control over the default sorted and filtered state of a display. This is an advanced feature, and the interface for specifying this is being actively improved and therefore I simply am mentioning it here for awareness.
9. Let's practice!
Let's now try specifying additional trelliscope options.