Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java	(revision 1770)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java	(revision 1771)
@@ -460,9 +460,8 @@
 	 * @throws REXPMismatchException the rEXP mismatch exception
 	 * @throws StatException the stat exception
 	 */
-	public void plot(File file, String expr)throws REXPMismatchException,
-	StatException {
-		plot(file, expr, "svg");
+	public File plot(File file, String expr) throws REXPMismatchException, StatException, RserveException {
+		return plot(file, expr, "svg");
 	}
 	/**
 	 * Plot.
@@ -472,54 +471,57 @@
 	 * @param device the device (svg, png, jpeg, ...)
 	 * @throws REXPMismatchException the rEXP mismatch exception
 	 * @throws StatException the stat exception
+	 * @throws RserveException 
 	 */
-	public void plot(File file, String expr, String devicename)throws REXPMismatchException,
-	StatException
-	{
+	public File plot(File file, String expr, String devicename) throws REXPMismatchException, StatException, RserveException	{
+		
 		try {
 			file.createNewFile();
-		} catch (IOException e1) {
-			org.txm.utils.logger.Log.printStackTrace(e1);
-			return;
-		}
-		if (!file.canWrite()) {
-			System.out.println(NLS.bind("{0} cannot be written.", file)); //$NON-NLS-1$
-		}
-		
-		String name;
-		if (OSDetector.isFamilyWindows()) { //$NON-NLS-1$ //$NON-NLS-2$
-			try {
+
+			if (!file.canWrite()) {
+				System.out.println(NLS.bind("{0} cannot be written.", file)); //$NON-NLS-1$
+				return null;
+			}
+			
+			String name;
+			if (OSDetector.isFamilyWindows()) { //$NON-NLS-1$ //$NON-NLS-2$
 				name = file.getCanonicalPath().replaceAll("/", "\\");
-			} catch (IOException e) {
-				throw new StatException(e);
 			}
-		} else {
-			name = file.getAbsolutePath();
-		}
+			else {
+				name = file.getAbsolutePath();
+			}
 
-		if (devicename.equals("devSVG")) voidEval("library(RSvgDevice);");
+			if (devicename.equals("devSVG")) safeEval("library(RSvgDevice);");
 
-		// FIXME : test for window dimensions so the large plots can be entirely displayed. Need to pass width and height to RWorkspace.plot() so
-		// RChartsEngine will be able to dynamically compute the width from the number of bars in a barplot for example.
-		//REXP xp = eval("try("+devicename+"(\"" + name + "\", width=20, height=10))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			// FIXME : test for window dimensions so the large plots can be entirely displayed. Need to pass width and height to RWorkspace.plot() so
+			// RChartsEngine will be able to dynamically compute the width from the number of bars in a barplot for example.
+			//REXP xp = eval("try("+devicename+"(\"" + name + "\", width=20, height=10))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
-		REXP xp = eval("try("+devicename+"(\"" + name + "\"))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			REXP xp = eval("try("+devicename+"(\"" + name + "\"))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
-		if (xp.isString() && xp.asString() != null) { // if there's a string
-			// then we have a
-			// problem, R sent an
-			// error
-			// System.out.println("Can't open svg graphics device:\n"+xp.asString());
-			// this is analogous to 'warnings', but for us it's sufficient to
-			// get just the 1st warning
-			REXP w = eval("if (exists(\"last.warning\") && length(last.warning)>0) names(last.warning)[1] else 0"); //$NON-NLS-1$
-			// if (w.asString()!=null) System.out.println(w.asString());
-			throw new StatException(w.asString());
+			if (xp.isString() && xp.asString() != null) { // if there's a string
+				// then we have a
+				// problem, R sent an
+				// error
+				// System.out.println("Can't open svg graphics device:\n"+xp.asString());
+				// this is analogous to 'warnings', but for us it's sufficient to
+				// get just the 1st warning
+				REXP w = eval("if (exists(\"last.warning\") && length(last.warning)>0) names(last.warning)[1] else 0"); //$NON-NLS-1$
+				// if (w.asString()!=null) System.out.println(w.asString());
+				throw new StatException(w.asString());
+			}
+
+			// ok, so the device should be fine - let's plot
+			safeEval(expr);
+			safeEval("dev.off()"); //$NON-NLS-1$
+			
+			return file;
 		}
-
-		// ok, so the device should be fine - let's plot
-		voidEval(expr);
-		voidEval("dev.off()"); //$NON-NLS-1$
+		catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			return null;
+		}
 	}
 	
 	/**
