MATLAB Answers

Malcolm Lidierth

Publication quality graphics in MATLAB

Asked by Malcolm Lidierth
on 18 Dec 2012
Latest activity Commented on by Malcolm Lidierth
on 17 Jan 2014

A Java based graphics package - "Project Waterloo" - is presently being developed to provide good quality anti-aliased graphics in any environment with a Java Virtual Machine available. It is open-source LGPL code that includes MATLAB OOP wrappers providing convenient support for MATLAB programmers.

This question is to ask for feedback from potential users: are there features missing that would make this package more attractive?

For example use in MATLAB, see

The project website with zipped builds and a GIT repo is at

Here are a few screenshots:


I like the new shift-drag feature allowing selectable ROIs to be created. It currently appears that when you are shift-click dragging, you can only make the ROI larger. (In other words, if you try and make your ROI smaller before releasing the mouse, the rectangle remains at the largest dimensions that your mouse traversed.)

Is this intended, or will this eventually be made such that the final ROI will match the size designated by the initial shift-click point and the final mouse release position?

GUI-resizeable ROIs like Matlab's native imrect() would, of course, also be nice. :)

@HAC I see your point. I think that can be implemented.

@HAC - now implemented in the Git repo.

Regions of interest can be added using enter+left mouse (to highlight and area), shift+right mouse (to select and display a region) or by adding a GJRoi object to a graph. The GJRoi class provides imrect-style behaviour allowing the ROI to be moved/resized.

All ROIs are fully serialisable so will be restored when loading from a file saved with them in place on the original.

2 Answers

Answer by Image Analyst
on 30 Dec 2012

  1. Can you give some advantages and disadvantages of using this over export_fig?
  2. When would you use Waterloo, and when would you use export_fig?
  3. Can you make bitmapped output images with arbitrarily large dimensions that you specify (i.e. more pixels than on your screen)?


Matt J
on 30 Dec 2012

Personally I have not had a need for bitmaps larger than the screen, but I have seen it asked here many times and that is a shortcoming of export_fig.

Book publishers ask for 300 dpi images and 600 dpi line art which I've found to be a real pain to generate. This sounds like it would help


Fixed dpi can be added to Waterloo. For MATLAB graphics an image processing tool would be probably be more appropriate as MATLAB is supplying the bitmap.

The GXFigure methods let you insert a function handle that exports the MATLAB graphics in the format of your choice (using e.g. export_fig) along with a MATLAB fig file and the Waterloo XML file. Java code like the Graph Explorer in Waterloo can load the exported MATLAB graphics when deserializing the XML file.

The Beta version of Waterloo now also supports output of vector graphics using the Processing visual language and also automatically generates HTML files allowing those graphics to be shown on an HTML canvas using ProcessingJS.

MATLAB graphics will still be bitmapped, but the HTML files might still be useful to some uses as they can be annotated using HTML5 or Processing. Details and a download of the relevant Java code are available without the rest of Waterloo: see

Use within MATLAB is pretty simple, e,g. to embed a MATLAB figure:

h=get(gcc, 'JavaFrame');

An s.append() method allows animations to be created fairly simply e.g. if the figure is changed s.append(jhandle, 1000); will update the graphics on a website after a delay of 1s.

Using the default options, as here, the output will be in a folder named '/myFile' with the following contents:

  • myFile.pde: a Processing script file
  • myFile.html: a "plain" HTML5 file
  • index.html: a styled HTML5 file
  • PDEGraphics2D.css: the stylesheet
  • processing.js: copy of the required Javascript
  • a Python 2.7 script (only needed if the system browser will not allow direct viewing of files from the local file system)
  • /data: a folder with required images etc. (as PNG)

Answer by Rookshana Trollope on 17 Jan 2014

Unfortunately this does not help me much. I have produced a Matlab scatter plot in 3D. I should see 7500 points X 2 (X,Y) and (X,Z). But the graphics looks like it has 200 points. I know there are multiple populations in my data and I want to high light this by the plot. But it looks real bad and one cannot see the multiple populations at all, let alone trying to fit regression lines to them. I can see the multiple populations on my other software in 2D only and I got Matlab to be able to see them in 3D.

Is there a Matlab graphics user that I can e-mail results to - To see what I mean and maybe can help ?


Malcolm is your man. Did you click on his name and try to contact him that way?

Thanks IA. I have updated the broken image links above.

@Rookshana - the first of these is a cloud plot - code in the Git repo but not yet in the zip build. Waterloo is 2D only and this may not do what you need.Cloud is a minimalist scatter plot designed to be fast with lots of data points. I am not entirely sure what you are trying - would using transparency with a set of overlaid 2D plots achieve what you need (is the data 3D?)?

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!