Visualizations

Plotting bar charts in R, geom_bar vs geom_col

Plotting the Nightingale data made me realize that there are more to plotting a bar chart than first meets the eye. While a histogram visualize the distribution of a numerical variable, a bar plot visualize the relationship between a categorical variable and a numerical variable. ggplot has two functions for plotting bar charts, geom_bar and geom_col. In short, geom_bar() counts the categorical values for you, while geom_col() takes the summarized numerical value as input.

Plot coxcomb diagrams like Florence Nightingale

Florence Nightingale (1820-1910) is best known as a pioneer in modern nursing, but she was also a pioneer in statistics and the use of statistical graphics in data analysis. In her work during the Crimean War, she tended to the wounded soldiers in the hospitals and helped to improve the conditions in which they were treated. She collected data on patients and their outcomes, and used a coxcomb diagram to visually display the causes of death in soldiers. Nightingales coxcomb plot “Diagram of the Causes of Mortality in the Army in the East” illustrated that the main cause of death among the British troops in the Crimean War was preventable disease rather than injuries from fighting. The plot also shows that the death rate decreased when a Sanitary Commissioner arrived to aid in improving hygiene and sanitation. The coxcomb plot was later used by Nightingale to lobby for improved sanitation and hygiene in hospitals. This eventually led to a reduction in the death rate from disease in hospitals. She was a firm believer that statistical data presented as charts and diagrams is a powerful tool to make complex data more understandable. It help people see relationships between data and enables us to make informed decisions. I wanted to recreate Nightingales historical plot using R, and at the same time give a tutorial on “How to” make a coxcomb/polar-area plot/rose diagram

Calculate Z-Score and plot heatmaps

Z-score is a measure for how values deviates from the mean in a given population. Calculating z-score is a handy way to standardize, or normalize data. This kind of normalization is frequently used in gene expression studies to visualize heat maps of differential expressed genes.

Plotting categorical values as a tiled chart

Plotting your variables as a tiled map, can visualize interactions between them very efficiently. Here is a “How to” plot categorical values as a tiled chart with fixed squares.

How to make a waterfall plot with ggpubr

Results from clinical trials in oncology is often presented as a waterfall plot. The plot visualize how tumor growth is affected by treatment for each subject after a given time. It can communicate very effectively the overall results for an entire study using only one figure. A waterfall plot is in essence a bar-chart ordered according to size. Each bar represents one subject and describes how much in % a tumor has changed from baseline (start of treatment), to the defined end of treatment.