CREATE OR REPLACE FUNCTION test.plot() RETURNS void LANGUAGE plr IMMUTABLE AS $$ # e.g. # SELECT test.plot(); lab = paste(collapse='\n', c( 'PostgreSQL 9.5dev', 'and PL/R 8.13.0.6', '', 'on CentOS 6.6')) png('Rplots.png') par(lheight=1.4) n = 100 plot( cex=runif(n) * 10, col=adjustcolor(topo.colors(n), 0.15), pch=16, x=runif(n), y=runif(n), xlim=0:1, ylim=0:1) text( cex=2, font=2, label=lab, x=0.5, y=0.5) graphics.off() $$; SELECT test.plot();