9.3 rgg

After you finish editing the plots the natural progression is to use them in the rest of the script. In ggedit there is the function rgg (remove and replace ggplot). Using this function you can chain into the original code changes to the plot without multiplying script needlessly.

  • Specify which layer you want to remove from a plot:

ggObj%>%rgg('line')

  • Provide an index to a specific layer, in instances where there are more than one layer of the same type in the plot

ggObj%>%rgg('line',2)

  • Remove a layer from ggObj and replace it with a new one from the ggedit output p.out

ggObj%>%rgg('line',newLayer = p.out$UpdatedLayers)

  • Remove a layer and replace it with a new one and the new theme

ggObj%>%rgg('line',newLayer = p.out$UpdatedLayers)+p.out$UpdatedThemes