DataSHIELD Training Part 4: Plotting graphs


Introduction

This is the fourth in a 6-part DataSHIELD tutorial series.

The other parts in this DataSHIELD tutorial series are:

Quick reminder for logging in:


Generating graphs

It is currently possible to produce 4 types of graphs in DataSHIELD: histograms, contour plots, heatmap plots and scatter plots.


Histograms 

  • The ds.histogram function can be used to create a histogram of LAB_HDL that is in the assigned variable dataframe (named "D", by default). The default analysis is set to run on separate data from all studies. Note that Study 1 contains 2 invalid cells (bins) - those bins contain counts less than the data provider minimal cell count.

  • To produce histograms from a pooled study, the argument type='combine' is used.

Contour plots 

Contour plots are used to visualize a correlation pattern.

  • The function ds.contourPlot is used to visualise the correlation between the variables LAB_TSC (total serum cholesterol and LAB_HDL (HDL cholesterol). The default is type='combined' - the results represent a contour plot on pooled data across all studies:

Heat map plots 

An alternative way to visualise correlation between variables is via a heat map plot.

  • The function ds.heatmapPlot is applied to the variables LAB_TSC and LAB_HDL :

Saving Graphs / Plots in R Studio

  • Any plots will appear in the bottom right window in R Studio, within the  plot  tab
  • Select  export  save as image

  • Name the file and select  / create a folder to store the image in on the DataSHIELD Client server. 
  • You can also edit the width and height of the graph

  • The plot will now be accessible from your Home folder directory structure. 

Conclusion

The other parts in this DataSHIELD tutorial series are: