ggplot in r-templates

Hello again

I'm trying to get ggplot working in templates, but i'm not doing such a great job at it.

My script works in R, this is what i want to get: http://ksilem.be/r-templates/quality%20plate%20chart.png

and this is the script in R to get it. http://ksilem.be/r-templates/ggplot.txt

my used data can be found here: http://ksilem.be/r-templates/output.csv

My template is located here:

http://ksilem.be/r-templates/ggplot-templates.txt

I just use a filereader and a R Plot as variables I give in these values: http://ksilem.be/r-templates/input.png

When I execute the node, I get a blank screen.

Has anybody already tried working with ggplot in r-templates or can anybody get me on the right track?

Kind regards

Kris

Hi Kris,

if you use other than basic plots it's necessary to 'print' them. Just try the following:

 

myplot <- ggplot(qc, aes(x=as.character(PlateId))) + 
		opts(title="blabla") +
		geom_bar(aes(y=HC.Maximum), binwidth=1, stat="identity", fill="cyan") + 
		geom_errorbar(aes(ymin=HC.Median-(HC.Stdev*3), ymax=HC.Median+(HC.Stdev*3)), colour="red") + 
		geom_errorbar(aes(ymin=LC.Median-(LC.Stdev*3), ymax=LC.Median+(LC.Stdev*3)), colour="purple")
print(myplot)

I've already worked with ggplots in RPlot nodes and it works.
I hope, I could help you

Antje

Hi Antje

Thank you, that did the trick.

Kris :)

Antje,

You are referring to using ggplot in RPlot nodes. Do you mean the R View (local) node? Does ggplot work without an R server, just with the R Statistics Integration binaries for Windows?

Thanks!

No, I speak about the nodes from our Scripting Integration plugin (http://tech.knime.org/community/scripting).
For these R nodes you would need a running R-server (can be locally started in the R console without any problems. I'll tell you details if you are interested in but there should be enough documentation too).