I'm using QGIS 2.6.1 and R version 3.2.2.
I'm struggling to get the syntax on a R Script for creating plots via QGIS processing to work. My understanding is that R syntax in QGIS Processing is slightly different from other R interfaces ... and I specifically can't get
ggplot() to generate panels of histograms for my data.
In essence, I have a vector layer with polygon land cover features that I appended mean temperature values for each feature to. I used the "join attributes by location" function to calculate the average of all mean temperature tiles from the BioClim mean temperature raster dataset. A glimpse of the data is here:
I now want to create a panel of histograms using
ggplot() that shows the distribution of mean temperature ("MEANDN") for each of the difference Forest Types ("Forest Typ").
The code for generating a histogram across all forest types works:
##Vector Processing=group ##showplots ##Layer=vector ##X=Field Layer library("ggplot2") ggplot() + geom_histogram(aes(Layer[[X]]/10))
However, if I add in a
facet_wrap() call to try to generate distinct plots for each forest type to show:
# Example attempt... I added in a "##Y=Field Layer" call, # just didn't show so here. ggplot() + geom_histogram(aes(Layer[[X]]/10)) + facet_wrap(~Layer[[Y]], ncol=3, scales="free")
Does anyone have any clues on how the syntax should look to get
facet_wrap to work?