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

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

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

http://undocumentedmatlab.com/blog/waterloo-graphics-examples/

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

http://waterloo.sourceforge.net/

Here are a few screenshots:

3 Comments

H.A. Camp on 20 Dec 2012

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. :)

Malcolm Lidierth on 21 Dec 2012

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

Malcolm Lidierth on 30 Dec 2012

@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.

Malcolm Lidierth

Products

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)?

6 Comments

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

Malcolm Lidierth on 31 Dec 2012

@Matt

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.

Malcolm Lidierth on 19 May 2013

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 http://waterloo.sourceforge.net/PDEGraphics2D/.

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

h=get(gcc, 'JavaFrame');
jhandle=h.getFigurePanelContainer();
s=kcl.waterloo.deploy.pde.PDEGraphics2D.paint(jhandle);
s.write('myFile');

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
  • httpd.py: 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)
Image Analyst
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 ?

2 Comments

Image Analyst on 17 Jan 2014

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

Malcolm Lidierth on 17 Jan 2014

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?)?

Rookshana Trollope

Contact us