[Clas12_software] Plotting package broken

Armstrong, Whitney R. warmstrong at anl.gov
Wed Jul 1 16:01:55 EDT 2015


Hello,

The script found here: http://clasweb.jlab.org/clas12offline/docs/software/html/plotting/graph_plotting.html does not run properly. Please fix the code or update the example. (see output below)

Also, it would be nice to have the ability to save the graphics in batch mode. Currently can this be done? That is can you call canvas.saveAs("some_file.png")?

Cheers,
Whitney

whit at ifarm1401:~$ cat plot_test.groovy 
import org.root.pad.*;
import org.root.data.*;
import org.root.func.*;
import org.root.histogram.*;

TGCanvas c1 = new TGCanvas("c1","My Plots",600,400,1,1); // Create Canvas with (1,1) divisions

double[] x = [ 1.0, 2.0, 3.0, 4.0]; // this is groovy syntax for array initialization
double[] y = [ 0.5, 0.7, 0.6, 0.4]; // in java : double[] x = new double[]{1.0,2.0,3.0,4.0};

GraphErrors  graph = new GraphErrors(x,y); // define graph with   X-Y points

graph.setTitle("Example Graph"); // Set   the Title string for the PAD
graph.setXTitle("Energy [GeV]"); // X axis title
graph.setYTitle("Efficiency");    // Y axis title

graph.setMarkerColor(4); // color from 0-9 for given palette
graph.setMarkerSize(15); // size in points on the screen
graph.setMarkerStyle(2); // Style can be 1 or 2

c1.draw(graph);
//c1.saveAs("test.png");
whit at ifarm1401:~$ run-groovy plot_test.groovy 
/group/clas12/packages/coatjava-1.0/bin/../lib/clas/ced-1.0-SNAPSHOT.jar
/group/clas12/packages/coatjava-1.0/bin/../lib/clas/cnuphys-1.0-SNAPSHOT.jar
/group/clas12/packages/coatjava-1.0/bin/../lib/clas/coat-libs-1.0-SNAPSHOT.jar
/group/clas12/packages/coatjava-1.0/bin/../lib/clas/JSAP-2.1.jar
/group/clas12/packages/coatjava-1.0/bin/../lib/clas/snakeyaml-1.12.jar
*****************************************
*    Running COAT-JAVA Groovy Scripts   *
*****************************************
 
Caught: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.root.pad.TGCanvas(java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer)
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.root.pad.TGCanvas(java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer)
	at plot_test.run(plot_test.groovy:6)



More information about the Clas12_software mailing list