Learn R Programming

ggtern (version 1.0.6.1)

theme_showgrid: Show or Hide Grid

Description

A set of convenience functions to enable or disable the use of major or minor (or both) gridlines.

theme_showgrid is a function which enables both MAJOR and MINOR gridlines.

theme_hidegrid or theme_nogrid (alias) is a function which disables both MAJOR and MINOR gridlines.

theme_showgrid_major is a function which enables MAJOR gridlines.

theme_hidegrid_major or theme_nogrid_major (alias) is a function which disables MAJOR gridlines.

theme_showgrid_major is a function which enables MINOR gridlines.

theme_hidegrid_minor or theme_nogrid_minor (alias) is a function which disables MINOR gridlines.

Usage

theme_showgrid()

theme_hidegrid()

theme_showgrid_major()

theme_hidegrid_major()

theme_showgrid_minor()

theme_hidegrid_minor()

Arguments

Details

These flags operate at the 'rendering' level, and, supercede the presence of theme elements, therefore, theme_hidegrid(...) or its aliases will PREVENT rendering of grid elements, irrespective of whether those grid elements are valid (renderable). From the counter perspective, theme_showgrid(...) or its aliases will ALLOW rendering of grid elements, subject to those grid elements being valid (renderable, ie say element_line as opposed to element_blank).

Examples

Run this code
#Load data
  data(Feldspar)
  plot <- ggtern(data=Feldspar,aes(Ab,An,Or)) +
          geom_point()   + #Layer
          theme_bw()     + #For clarity
          theme_hidegrid() #Turn off both major and minor
  plot

  #Demonstrate switching on major, minor and both gridlines
  plot + theme_showgrid_minor() #show minor only
  plot + theme_showgrid_major() #show major only
  plot + theme_showgrid()       #show both major and minor

  #Demonstrate switching OFF major, minor and both gridlines, Uncomment to run
  #plot <- plot + theme_showgrid() #as before
  #plot + theme_hidegrid_minor() #show major only (hide minor)
  #plot + theme_hidegrid_major() #show minor only (hide major)
  #plot + theme_hidegrid()       #show none (hide both major and minor)

Run the code above in your browser using DataLab