Visualizing with a Transition Plot - Super Useful!
Statistics
2017
Author
Cliff Weaver
Published
May 22, 2016
Transition plot
It’s closely related to the plotMat for plotting networks but aimed at less complex relations with only a one-way relation between two groups of states. Wait till you see this - it is something you can likely use all the time in your job!
This is simple to understand but understanding the flow can be challenging and time-consuming. Visualizing it using the transition plot gives a quick and more intuitive understanding:
library(Gmisc)
Loading required package: Rcpp
Loading required package: htmlTable
transitionPlot(transition_matrix)
The minimum width reached and the arrow at box no. '1' to no. '3' will not be shown. This is due to the fact that the lwd will generate a falsely strong arrow.
The minimum width reached and the arrow at box no. '1' to no. '1' will not be shown. This is due to the fact that the lwd will generate a falsely strong arrow.
The minimum width reached and the arrow at box no. '1' to no. '3' will not be shown. This is due to the fact that the lwd will generate a falsely strong arrow.
The minimum width reached and the arrow at box no. '1' to no. '1' will not be shown. This is due to the fact that the lwd will generate a falsely strong arrow.
Here you can see the thick lines representing the transition from that particular group into the next. So far I’ve used the graph for the same measure on left and right side but I guess your imagination sets the limit. It can just as well be two or more treatment arms with some discrete outcomes.
Basic Improvement - Arrows
Change the arrow type to my alternative arrow we get a nicer plot:
Added a white background to each arrow in order to visually separate the arrows (the overlay order can be customized with the overlap order parameter). To further enhance the transition add the option of a color gradient. To do this you need to specify arrow_type = 'gradient':
Additionally you can choose different colors for your boxes:
library(RColorBrewer)transitionPlot(transition_matrix, txt_start_clr ="black", txt_end_clr ="black",fill_start_box =brewer.pal(n =3, name ="Pastel1"), fill_end_box =brewer.pal(n =6, name ="Pastel1")[4:6],overlap_add_width =1.3, type_of_arrow ="gradient")
Add Proportions
Sometimes you might want to split the color of each box into two colors to illustrate a proportion. Note that the gradient color is a blend between the two proportions: