iPlots is a package which provides interactive statistical graphics, written in Java. You can find many interesting plots such as histograms, barcharts, scatterplots, boxplots, fluctuation diagrams, parallel coordinates plots and spineplots. The amazing part is that all of these plots support querying, linked highlighting, color brushing, and interactive changing of parameters.
Furthermore, iPlots includes an API for managing plots and adding user-defined objects, such as lines or polygons to a plot.
PACKAGES & DATA
In order to use the iPlots package we have to install and call it. Moreover we need a dataset to work with. Tha dataset we chose in our case is “Cars93” which contains data from 93 Cars on Sale in the USA in 1993 and we can find it in the MASS package which of course must be installed and called too. To install and call those packages and attach the “Cars93” dataset use:
You can use
head(Cars93) in order to see the variables of your dataset.
Some of the most important features that mosaic plots in iPlots provide are standard selection, highlighting, color brushing, reordering of variables and addition or exclusion of variables. An example of a mosaic plot with iPlots follows:
iPlots through Model View also allows same Binsize, Fluctuation Diagram and Multiple Barchart. In order to rearrange the variables use the four arrow keys
Note that you can gain further information about your plot using -mouse-over and ctlr.
Barcharts in iPlots also feature Spineplots (use ctrl-s or the “View” menu to switch between the two representations). See the example below.
To get a spineplot via the command line use:
You can reorder Bars with two ways. Firstly by using the options in the “View” menu and secondly by -dragging a bar to the position you wish.
Of course you can order the categories through R in a barchart. Look at the example below:
 "Driver & Passenger" "Driver only" "None"
AirBags2 <- ordered(AirBags,
c("None", "Driver only", "Driver & Passenger"))
 "None" "Driver only" "Driver & Passenger"
I. Parallel Coordinate Plot
A parallel coordinate plot connects all cases by lines. Look at the example below which creates a Parallel Coordinate Plot for the continuous variables “Cylinders” and “Passengers” of the “Cars93” dataset.
Parallel boxplots are used to compare distributions of variables. Look how to create a parallel boxplot for all “MPG” variables of the”Cars93″ dataset
All options can be found in the “View” menu of the plot. Note, that the scale is only displayed when all variables share the same scale!
III. Boxplot y by x
Boxplots y by x show boxplots by group. If ibox() is called with a continuous variable and a factor, a boxplot y by x is created. Look at the example to see how to split “Horsepower” by “Passengers”.
Note that a boxplot y by x always uses the same scale for all boxplots for a proper comparison.
Now, let’s move on to the first set of real exercises on the iPlots package!
- Become a Top R Programmer Fast with our Individual Coaching Program
- Explore all our (>4000) R exercises
- Find an R course using our R Course Finder directory
- Subscribe to receive weekly updates and bonus sets by email
- Share with your friends and colleagues using the buttons below