Generate pgfplots or gnuplots from embedded SQL statements