- Undocumented Matlab - https://undocumentedmatlab.com -

Specialized Matlab plots

Posted By Yair Altman On April 11, 2012 | 5 Comments

A few weeks ago, MathWorks has added a new section on its website called the “Plot Gallery [1]“. This section highlights specialized Matlab plots that were posted on the Matlab File Exchange (FEX) and can be used by Matlab users in their GUIs. Unfortunately, for the moment this list only includes some 20 customized plots posted by MathWorks employees, in addition to some 50 examples of using the standard Matlab plots. I have a suspicion that one day, if this proves popular, we will find the gallery integrated in the main Matlab Desktop, possibly next to the current plot selector component [2].
Since the Plot Gallery section is a new effort at reducing plotting complexity to Matlab users, I think that it should be encouraged by user feedback. Please feel free to leave them a comment with your feedback, either on this page [3], or on their semi-official blog announcement page [4].
My personal beef with the new Plot Gallery is the fact that it does not currently include user submissions. FEX actually contains numerous user-submitted specialized plotting utilities, answering a wide variety of needs in multiple discipline fields. These can easily be found using FEX’s search functionality or tags. For example, the FEX “plot” tag [5] currently has 440 separate submissions. Perhaps one day these user submissions will be added to the Plot Gallery in some searchable structured manner.
One set of specialized plots that I’d like to highlight today is based on the open-source JFreeChart, that I have described here [6] last year. Sven Körner has used this to provide [7] a dozen different customized Matlab plots, a few of which can be seen below, showing the power of integrating external code in Matlab GUI. JFreeChart contains many more customizable chart, plot and gauge types so Sven’s examples should merely be considered as appetizers:

MATLAB-integrated dial gauge chart
MATLAB-integrated dial gauge chart

MATLAB-integrated multi-axes chart
MATLAB-integrated multi-axes chart

Categories: GUI, Low risk of breaking in future versions


5 Comments (Open | Close)

5 Comments To "Specialized Matlab plots"

#1 Comment By Malcolm Lidierth On April 13, 2012 @ 12:26

As well as JFreeChart, JavaFX 2.0 Charts can also be added to MATLAB figures using a JFXPanel. Those can be added to MATLAB containers in the same way as a JPanel using the undocumented javacomponent function (or derivatives like [14] and [15] from the FEX – see this blog for details from Yair ( [16])
You will of course need to put the JavaFX runtime from Oracle on the MATLAB javaclasspath ( [17]).

#2 Comment By Patrick On April 16, 2012 @ 13:13

Hey Yair,

Amazing blog I read it all the time; I have a quick question about using the jzy3d library (Supposedly a good library for charts that are bit more complicated than those in JFreeChart, which I have gotten working with no problems). I have just been testing it and I am having difficulty getting a piece of code working. I added the following files to the static path:

org.jzy3d-0.9.jar
org.jzy3d-0.9-dependencies.zip

And ran the following code:

size = 100000;
points(size,1) = org.jzy3d.maths.Coord3d;
for k=1:size
    x = rand(1) * 1000;
    y = rand(1) * 1000;
    z = rand(1) * 1000;
    points(k) = org.jzy3d.maths.Coord3d(x,y,z);
end
colormapper = org.jzy3d.colors.ColorMapper(org.jzy3d.colors.colormaps.ColorMapRainbow(),0,100);
scatter = org.jzy3d.plot3d.primitives.MultiColorScatter(points,colormapper);
chart = org.jzy3d.chart.Chart;

When I create the ‘chart’ object I get the following error:

Undefined variable “org” or function “org.jzy3d.chart.Chart”.

I have checked to ensure that the fully qualified name is correct and the constructor accepts no arguments.

Any help will be appreciated.

Thanks,

#3 Comment By Yair Altman On April 16, 2012 @ 14:59

@Patrick – I’m not exactly sure, but you can look at Malcolm Lidierth’s recent [18] that demonstrates using jzy3d in Matlab. If you drill down in this submission’s internal m-code (which shouldn’t be too difficult), I’m pretty sure you’ll find the answer.

#4 Comment By Malcolm Lidierth On April 16, 2012 @ 17:57

@Patrick
Some of the jzy3d dependencies (e.g. JOGL) are part of the standard MATLAB distribution and on the static javaclasspath – but not in the right version for jzy3d 0.9. Try using jzy3d 0.8.4 which worked for me – or update the dependent jars loaded by MATLAB.

#5 Comment By Patrick On April 17, 2012 @ 07:25

@Malcolm

I tired using your submission on the FEX and I am able to create my example above, I’ll see what I can do about using 0.8.4. Thanks for your suggestions.


Article printed from Undocumented Matlab: https://undocumentedmatlab.com

URL to article: https://undocumentedmatlab.com/articles/specialized-matlab-plots

URLs in this post:

[1] Plot Gallery: http://www.mathworks.com/discovery/gallery.html

[2] plot selector component: http://undocumentedmatlab.com/blog/plot-type-selection-components/

[3] on this page: http://undocumentedmatlab.com/blog/specialized-matlab-plots/#respond

[4] announcement page: http://blogs.mathworks.com/pick/2012/03/23/matlab-plot-gallery/

[5] the FEX “plot” tag: http://www.mathworks.com/matlabcentral/fileexchange/?term=tag%3A%22plot%22

[6] described here: http://undocumentedmatlab.com/blog/jfreechart-graphs-and-gauges/

[7] provide: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A92825+JFreeChart

[8] Customizing contour plots : https://undocumentedmatlab.com/articles/customizing-contour-plots

[9] Customizing histogram plots : https://undocumentedmatlab.com/articles/customizing-histogram-plots

[10] Customizing contour plots part 2 : https://undocumentedmatlab.com/articles/customizing-contour-plots-part2

[11] Customizing contour plots part 2 : https://undocumentedmatlab.com/articles/customizing-contour-plots-part-2

[12] Customizing axes tick labels : https://undocumentedmatlab.com/articles/customizing-axes-tick-labels

[13] Waterloo graphics examples : https://undocumentedmatlab.com/articles/waterloo-graphics-examples

[14] : http://www.mathworks.com/matlabcentral/fileexchange/14583-UIComponent

[15] : http://www.mathworks.com/matlabcentral/fileexchange/15580-JControl

[16] : https://undocumentedmatlab.com/blog/javacomponent/

[17] : http://javafx.com/

[18] : http://www.mathworks.com/matlabcentral/fileexchange/35026

Copyright © Yair Altman - Undocumented Matlab. All rights reserved.