<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JFreeChart &#8211; Undocumented Matlab</title>
	<atom:link href="https://undocumentedmatlab.com/articles/tag/jfreechart/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Wed, 11 Apr 2012 17:25:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.3</generator>
	<item>
		<title>Specialized Matlab plots</title>
		<link>https://undocumentedmatlab.com/articles/specialized-matlab-plots?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=specialized-matlab-plots</link>
					<comments>https://undocumentedmatlab.com/articles/specialized-matlab-plots#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 11 Apr 2012 17:25:15 +0000</pubDate>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[Low risk of breaking in future versions]]></category>
		<category><![CDATA[File Exchange]]></category>
		<category><![CDATA[JFreeChart]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2849</guid>

					<description><![CDATA[<p>The new MathWorks Plot Gallery provides access to some plotting examples on the File Exchange. Numerous others are available, extending the customizability of Matlab graphics. </p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/specialized-matlab-plots">Specialized Matlab plots</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/customizing-contour-plots" rel="bookmark" title="Customizing contour plots">Customizing contour plots </a> <small>Contour labels, lines and fill patches can easily be customized in Matlab HG2. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-histogram-plots" rel="bookmark" title="Customizing histogram plots">Customizing histogram plots </a> <small>Basic bar charts and histogram plots can be customized in important aspects. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-contour-plots-part2" rel="bookmark" title="Customizing contour plots part 2">Customizing contour plots part 2 </a> <small>Matlab contour labels' color and font can easily be customized. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-contour-plots-part-2" rel="bookmark" title="Customizing contour plots part 2">Customizing contour plots part 2 </a> <small>The contour lines of 3D Matlab plot can be customized in many different ways. This is the 2nd article on this issue. ...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>A few weeks ago, MathWorks has added a new section on its website called the &#8220;<a target="_blank" rel="nofollow" href="http://www.mathworks.com/discovery/gallery.html">Plot Gallery</a>&#8220;. 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 <a target="_blank" href="/articles/plot-type-selection-components/">plot selector component</a>.<br />
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 <a href="/articles/specialized-matlab-plots/#respond">on this page</a>, or on their semi-official blog <a target="_blank" rel="nofollow" href="http://blogs.mathworks.com/pick/2012/03/23/matlab-plot-gallery/">announcement page</a>.<br />
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&#8217;s search functionality or tags. For example, <a target="_blank" rel="nofollow" href="http://www.mathworks.com/matlabcentral/fileexchange/?term=tag%3A%22plot%22">the FEX &#8220;plot&#8221; tag</a> currently has 440 separate submissions. Perhaps one day these user submissions will be added to the Plot Gallery in some searchable structured manner.<br />
One set of specialized plots that I&#8217;d like to highlight today is based on the open-source JFreeChart, that I have <a target="_blank" href="/articles/jfreechart-graphs-and-gauges/">described here</a> last year. Sven Körner has used this to <a target="_blank" rel="nofollow" href="http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A92825+JFreeChart">provide</a> 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&#8217;s examples should merely be considered as appetizers:<br />
<center><figure style="width: 300px" class="wp-caption aligncenter"><img fetchpriority="high" decoding="async" alt="MATLAB-integrated dial gauge chart" src="https://undocumentedmatlab.com/images/dialdemo4_300.jpg" title="MATLAB-integrated dial gauge chart" width="300" height="407"/><figcaption class="wp-caption-text">MATLAB-integrated dial gauge chart</figcaption></figure><br />
<figure style="width: 400px" class="wp-caption aligncenter"><img decoding="async" alt="MATLAB-integrated multi-axes chart" src="https://undocumentedmatlab.com/images/multipleAxis_400.jpg" title="MATLAB-integrated multi-axes chart" width="400" height="406"/><figcaption class="wp-caption-text">MATLAB-integrated multi-axes chart</figcaption></figure><br />
</center></p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/specialized-matlab-plots">Specialized Matlab plots</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/customizing-contour-plots" rel="bookmark" title="Customizing contour plots">Customizing contour plots </a> <small>Contour labels, lines and fill patches can easily be customized in Matlab HG2. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-histogram-plots" rel="bookmark" title="Customizing histogram plots">Customizing histogram plots </a> <small>Basic bar charts and histogram plots can be customized in important aspects. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-contour-plots-part2" rel="bookmark" title="Customizing contour plots part 2">Customizing contour plots part 2 </a> <small>Matlab contour labels' color and font can easily be customized. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-contour-plots-part-2" rel="bookmark" title="Customizing contour plots part 2">Customizing contour plots part 2 </a> <small>The contour lines of 3D Matlab plot can be customized in many different ways. This is the 2nd article on this issue. ...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/specialized-matlab-plots/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>JFreeChart graphs and gauges</title>
		<link>https://undocumentedmatlab.com/articles/jfreechart-graphs-and-gauges?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jfreechart-graphs-and-gauges</link>
					<comments>https://undocumentedmatlab.com/articles/jfreechart-graphs-and-gauges#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Mon, 17 Jan 2011 18:00:16 +0000</pubDate>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Low risk of breaking in future versions]]></category>
		<category><![CDATA[JFreeChart]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2053</guid>

					<description><![CDATA[<p>JFreeChart is an open-source charting library that can easily be integrated in Matlab</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/jfreechart-graphs-and-gauges">JFreeChart graphs and gauges</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/plotly-graphs" rel="bookmark" title="Plotly graphs">Plotly graphs </a> <small>Plotly charts can be created and customized in Matlab. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/plotly-graphs-in-ipython-notebook" rel="bookmark" title="Plotly graphs in IPython Notebook">Plotly graphs in IPython Notebook </a> <small>Plotly graphs can be embedded in an IPython Notebook directly from Matlab. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/pinning-annotations-to-graphs" rel="bookmark" title="Pinning annotations to graphs">Pinning annotations to graphs </a> <small>Annotation object can be programmatically set at, and pinned-to, plot axes data points. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/specialized-matlab-plots" rel="bookmark" title="Specialized Matlab plots">Specialized Matlab plots </a> <small>The new MathWorks Plot Gallery provides access to some plotting examples on the File Exchange. Numerous others are available, extending the customizability of Matlab graphics. ...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>The other day I wanted to present a graphic presentation of Matlab&#8217;s position in the computer programming world. Naturally, my first attempt, being an addict of infographics (IG), was to search for an IG about computer programs. One of my favorite IG sites is <a target="_blank" rel="nofollow" href="http://www.coolinfographics.com/">CoolInfographics</a>. Unfortunately, it&#8217;s not technology-oriented. I am not aware of technology-related IG sites, although <a target="_blank" rel="nofollow" href="http://www.onlineschools.org/">Online Schools</a> has a technology section with some cool IGs (including one about the <a target="_blank" rel="nofollow" href="http://www.onlineschools.org/blog/programming/">evolution of computer programming</a> that I found interesting). Unfortunately again, none of the IGs I found online discuss Matlab.<br />
So I resorted to preparing my own graphic presentation. I wanted the graphics to appear special &#8211; not an ordinary Matlab or Excel charts. For the fun of it, I wanted to prepare this report in Matlab (call me a Matlab addict if you will&#8230;).<br />
Luckily, Java has some extremely cool open-source charting and reporting tools, that can easily be integrated in Matlab.</p>
<h3 id="JFreeChart">JFreeChart</h3>
<p>An extremely powerful and widely-used Java-based charting library is <a target="_blank" rel="nofollow" href="http://www.jfree.org">JFreeChart</a>, which includes classes for displaying charts, graphs and gauges in Java panels. JFreeChart solves Matlab&#8217;s limitation that plot axes cannot be added to Java containers. JFreeChart is free open-source. Used by over 40,000 Java developers worldwide (as well as <a target="_blank" rel="nofollow" href="https://www.mathworks.com/matlabcentral/newsreader/search_results?search_string=jfreechart&#038;dur=all">some Matlab developers</a>), it is in constant development and improvement.<br />
Let us now integrate a JFreeChart pie-chart within a Matlab figure, as a means of illustrating how to integrate third-party Swing-derived components into Matlab.<br />
First, <a target="_blank" rel="nofollow" href="http://sourceforge.net/projects/jfreechart/files/">download</a> the latest JFreeChart version. Next, unzip the downloaded file into some new folder. Now, edit classpath.txt (or use <i><b>javaaddpath</b></i>) to load jfreechart-1.0.13.jar and jcommon-1.0.16.jar (which are located in the /lib/ sub-folder) to Matlab&#8217;s Java classpath (replace the version numbers as appropriate):</p>
<pre lang="matlab">
javaaddpath C:/Yair/Utils/JFreeChart/lib/jcommon-1.0.16.jar
javaaddpath C:/Yair/Utils/JFreeChart/lib/jfreechart-1.0.13.jar
</pre>
<p>Within the Matlab code, load the data into an object that implements the org.jfree.data.Dataset interface. There are separate such objects for each specific chart type. For example, in order to display a pie-chart we would use org.jfree.data.general.DefaultPieDataset:</p>
<pre lang="matlab">
% Prepare a data-set with some unrealistic numbers...
dataset = org.jfree.data.general.DefaultPieDataset;
dataset.setValue(java.lang.String('C'),       4);
dataset.setValue(java.lang.String('C++'),     7);
dataset.setValue(java.lang.String('Matlab'), 52);
dataset.setValue(java.lang.String('Java'),   23);
dataset.setValue(java.lang.String('Other'),  14);
% Now prepare an org.jfree.chart.JFreeChart object
% Arguments = title string, data set, display legend flag, display tooltips flag, generate URLs flag
chart3D = org.jfree.chart.ChartFactory.createPieChart3D('Programming languages', dataset, true, true, false);
% Update some chart properties
plot3D = chart3D.getPlot;	% an org.jfree.chart.plot.PiePlot3D obj
plot3D.setForegroundAlpha(0.7);	% set transparency level
% Finally, place the chart in a Swing-compliant panel and display using javacomponent
jPanel = org.jfree.chart.ChartPanel(chart3D);
[jp,hp] = javacomponent(jPanel,[20,20,300,300],gcf);
</pre>
<p><center><figure style="width: 362px" class="wp-caption aligncenter"><img decoding="async" alt="JFreeChart 3D pie chart" src="https://undocumentedmatlab.com/images/JFreeChart_Matlab1.png" title="JFreeChart 3D pie chart" width="362" height="409" /><figcaption class="wp-caption-text">JFreeChart 3D pie chart</figcaption></figure></center><br />
…and similarly for a 2D exploding pie-chart (no need to recreate the panel – simply point it to the new chart using jPanel.setChart and the entire figure is automatically redrawn):</p>
<pre lang="matlab">
chart2D = org.jfree.chart.ChartFactory.createPieChart('Programming languages', dataset, true, true, false);
plot2D = chart2D.getPlot;  % an org.jfree.chart.plot.PiePlot obj
plot2D.setExplodePercent(0,0.6);  % 1st value, 60% outward
plot2D.setExplodePercent(3,0.30); % 4th value, 30% outward
jPanel.setChart(chart2D);
</pre>
<p><center><figure style="width: 362px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" alt="JFreeChart 2D pie chart" src="https://undocumentedmatlab.com/images/JFreeChart_Matlab2.png" title="JFreeChart 2D pie chart" width="362" height="409" /><figcaption class="wp-caption-text">JFreeChart 2D pie chart</figcaption></figure></center><br />
JFreeChart has some limitations compared to Matlab plots, but it can do things that are extremely difficult to achieve in Matlab, as shown in the following screenshots:<br />
<center><figure style="width: 450px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" alt="JFreeChart Gantt Charts" src="https://undocumentedmatlab.com/images/JFreeChart_GanttDemo1.png" title="JFreeChart Gantt Charts" width="450" height="300" /></p>
<p/><img loading="lazy" decoding="async" alt="JFreeChart Dial Gauges" src="https://undocumentedmatlab.com/images/JFreeChart_DialPlotDemo2a_254.jpg" title="JFreeChart Dial Gauges" width="400" height="235" /></p>
<p/><img loading="lazy" decoding="async" alt="JFreeChart Custom Gauges" src="https://undocumentedmatlab.com/images/JFreeChart_ThermometerDemo1.png" title="JFreeChart Custom Gauges" width="400" height="295" /></p>
<p/><img decoding="async" alt="JFreeChart Ring Charts" src="https://undocumentedmatlab.com/images/JFreeChart_RingChartDemo1.png" title="JFreeChart Ring Charts"400" height="270" /><figcaption class="wp-caption-text">Few of the many JFreeChart charts and gauges</figcaption></figure></center><br />
Just in case you were wondering &#8211; these charts and gauges can easily be made interactive and animated. Adding them within a Matlab figure panel provides a wonderful GUI interaction experience.<br />
Bottom line: I started out looking for a simple infographic for work, and ended up wasting hours playing around with JFreeeChart&#8230; Another day&#8217;s work down the drain. 🙂<br />
Have you used JFreeChart (or any other 3rd-party charting library) in your code? If you have (or if you find some interesting Matlab-related infographic), please tell us about it in a <a href="/articles/jfreechart-graphs-and-gauges/#respond">comment</a>.</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/jfreechart-graphs-and-gauges">JFreeChart graphs and gauges</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/plotly-graphs" rel="bookmark" title="Plotly graphs">Plotly graphs </a> <small>Plotly charts can be created and customized in Matlab. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/plotly-graphs-in-ipython-notebook" rel="bookmark" title="Plotly graphs in IPython Notebook">Plotly graphs in IPython Notebook </a> <small>Plotly graphs can be embedded in an IPython Notebook directly from Matlab. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/pinning-annotations-to-graphs" rel="bookmark" title="Pinning annotations to graphs">Pinning annotations to graphs </a> <small>Annotation object can be programmatically set at, and pinned-to, plot axes data points. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/specialized-matlab-plots" rel="bookmark" title="Specialized Matlab plots">Specialized Matlab plots </a> <small>The new MathWorks Plot Gallery provides access to some plotting examples on the File Exchange. Numerous others are available, extending the customizability of Matlab graphics. ...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/jfreechart-graphs-and-gauges/feed</wfw:commentRss>
			<slash:comments>32</slash:comments>
		
		
			</item>
	</channel>
</rss>
