Creating a plotting system that is useful for both beginners and expert is a difficult challenge. Expert users desire a diverse set of graphics, and fine control over the display parameters. Beginners just want an easy way to create standard, tried and true, plots. The plot builder attempts to satisfy both of these requirements within a single interface.
The fundamental model behind building plots is the grammar of graphics, as implemented by the ggplot2 package. Much of the documentation of the ggplot2 package is relevant to the components of the plot builder. You can learn more about ggplot2 here.
The huge advantage of the grammar for a GUI is that though there are a finite number of components, almost any possible statistical graphic can be produced. Leading to a hugely flexible tool. With this flexibility comes the cost of complexity. To mitigate the impact of this complexity on beginners, the GUI introduces a new concept, Templates, to assist new users.
Getting Started Using Templates
If you were left scratching your head when the "grammar of graphics" was mentioned, don't worry. Many standard statistical graphics can be produced without needing to know about it.
After selecting the Plot Builder menu item from the Plot menu on the menu bar of the Console window, the following window will appear.
The bar at the top a series of standard plots (pie, histogram, bar, etc.). When one of these are dragged onto the plot area below, a dialog will appear allowing you to specify which variables you would like to visualize. For example if we have the mtcars dataset loaded (run: data(mtcars) ) dragging histogram onto the plot and selecting mpg gives us:
Clicking okay will plot the histogram, and add an item to the component list on the right.
Double clicking on histogram in the component list allows you to edit your plotting options. For example you could change the bin width.
Hitting Run will run the R code that generated the plot into the R console.
In addition to histograms there are a number of standard statistical graphics that can be made. For each, all that is necessary is to specify the variables that you wish to visualize. If you need more guidance to create specific plots, please see How to Make Bar Plots, How to Make Histograms, How to Make Box Plots,
Building plots Component by Component
The fundamental model behind building plots is the grammar of graphics, as implemented by the ggplot2 package. The plot is created layer by layer, with components dragged from the lists at the top onto the plot, which adds them to the list on the right, and alters the plot accordingly.
Some components add new features to the plot:
- Geometric Elements
- Adds a layer by how data will look (e.g. bar, and point).
- Adds a layer by how the data is computed (e.g. bin, and summary).
Others components alter the characteristics of the plot:
- Applies transformations to the data (e.g. levels of a factor to colors)
- Breaks the plot up into panels.
- Changes the coordinate system (e.g. polar, and map projections)
- Change the look and feel of the plot.
The huge advantage of the grammar for a GUI is that though there are a finite number of components, almost any possible statistical graphic can be produced. Leading to a very flexible tool.
Saving and Opening Plots
Plots can be saved in the plot builder by going to the File > Save menu item. This will save the plot along with the data used to create it. Saved Plot Builder plots use the file extension .ggp, and can be loaded later by going to File > Open. The histogram example above can be downloaded here.
Creating and Sharing Templates
New templates can be created and shared among users without the need to do any coding whatsoever. Simply do the following:
- Make a plot in the builder
- Select Tools > Make template
- Right click on the new template and select Edit Dialog
- Select which GUI components to exclude.
Here is an example video showing template creation
The following video examples should provide some idea of how the builder works:
right click and select download link: