In this section, the following type of plots are being discussed:
- Bar Chart
- Pie Chart
- Strip Plot
- Swarm Plot
- Box and Whisker Plot
- Violin Plot
- Histogram
- Scatter Plot
- Sunflower Plot
- Bag Plot
- Regression Plot
- Bland-Altman Plot
- Funnel Plot
- Forest Plot
- Radar Plot
- Mosaic Plot
- ROC Plot
- Survival Plot
- Time Series
- Correlation Plot
- Hierarchical Edge Bundling Plot
- Decision Tree Plot
- Exploratory Plot
- Interactive Plot
Plots can be created with plot builder 1 in JGR 2. The plot can be subsequently saved in the desired format. As described, scalable vector graphics are advised, but ultimately the choice of format depends on its subsequent use / journal requirements.
Code created using plot builder can be copied into a script file for convenience. Rather that creating the plots and saving them it may be more convenient to save the plot directly in the desired format. For example to create a plot of Anscombe’s 3 first data set; load the dataset and create a plot with the following commands:
ggplot() + geom_point(aes(x = X1,y = Y1),data=anscombe.quartet) + geom_smooth(aes(x = X1,y = Y1),data=anscombe.quartet,method = ‘lm’) + theme_bw() +ggtitle(label = ‘Anscombe\’s First Data Set’) + xlab(label = ‘X1 [cm]’) + ylab(label = ‘Y1 [cm]’)
The plot can subsequently be saved in the appropriate format.
To save directly as a PDF file in the default directory of R:
pdf(‘AnscombePlot.pdf’)
ggplot() + geom_point(aes(x = X1,y = Y1),data=anscombe.quartet) + geom_smooth(aes(x = X1,y = Y1),data=anscombe.quartet,method = ‘lm’) + theme_bw() +ggtitle(label = ‘Anscombe\’s First Data Set’) + xlab(label = ‘X1 [cm]’) + ylab(label = ‘Y1 [cm]’)
dev.off()
To create a jpg file:
jpeg(‘AnscombePlot.jpg’,quality=100,width=960,height=960,res=200)
ggplot() + geom_point(aes(x = X1,y = Y1),data=anscombe.quartet) + geom_smooth(aes(x = X1,y = Y1),data=anscombe.quartet,method = ‘lm’) + theme_bw() +ggtitle(label = ‘Anscombe\’s First Data Set’) + xlab(label = ‘X1 [cm]’) + ylab(label = ‘Y1 [cm]’)
dev.off()
There are similar commands for different graphical formats. For bitmap:
??png
and for scalable vector graphics:
??svg