# MATLAB Spoken Here

## Learn about MATLAB Plots using Trendy

The other day I was looking at questions from our users on MATLAB Answers, the MATLAB Central Newsgroup and also on MATLAB’s Facebook page. I saw quite a few posts asking questions about ways to enhance MATLAB plots. When I am trying to learn something new, I always learn better if I can see how others have done it, so I thought it would be fun to would share some plots from Trendy that show basic things you can do. Remember that Trendy lets you click on the “Show/Hide Code” button to see the code the author used to create the plot.

Let’s take a look at some examples of plots…

### Using Data Markers

In How many MATLAB jobs in South of France, Aurelien is showing a simple chart using Trendy defaults. Notice that data points in the chart are represented by an ‘o’.

In this next trend, Rob Nickerson has created a simple chart with a different look by removing the data point markers from his plot code and making the lines thicker. Also notice that he has added a label on the y-axis using the ylabel command. He has also kept the chart legend from interfering with his chart by relocating it near the y-axis.

### Changing Plot Colors

In Ned Gulley’s trend Temperatures in Anchorage and Honolulu, notice that he has a similar plot charting two different pieces of data. But if you look at his code, you can see how he easily changed the colors in his plot command.

If you’ve been checking out Trendy at all, you’ve probably seen Hugo Carr‘s Hysteriometer which is “a measure of the total expressed fear and outrage from newspaper tabloids in Britain benchmarked against their more moderate counterparts”. (See reference in the British paper, the Independent “Calm down, dears“.) What you might not have noticed in the plot is how Hugo has controlled the colors used in the plots using ColorOrder, which is a pretty handy feature.

### Putting Multiple Plots in One Graphic

One last plot I’d like to share with you is, again, by Aurelien. In MathWorks should have an office in my village, he’s taken the plot we saw in the earlier example. He’s used the subplot command to combine it with a second plot, creating a single graphic. It is a good visual technique to compare data while conserving whitespace on your page.

### One Response to “Learn about MATLAB Plots using Trendy”

1. Aurélien replied on :

Hi Helen,

Thanks for quoting my Trendy.

My favorite Trendy is “Plot for Top Players” in Cody from Ned Gulley : http://www.mathworks.com/matlabcentral/trendy/plots/917. It shows the activity of top 10 players. From this trend, we can guess that some of them are on vacation (like Amitava) , we can see the new players who reach the top Ten (like Jean-Marie) … I love it !

Concerning my “funny” Trendy “MathWorks should have an office in my village”, one of my friends told me that it would be better to make a comparison between the quantity of rain between my village and Paris to convice TMW to come here (lol) … he also suggested to compare the price of the beer (twice cheaper at Corbières) … so new trends are coming soon !

Have a nice day,

Aurélien

 Name (required) E-mail (required, will not be published) Website (optional) Spam protection (required): What is 3 + 6 ?

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>


If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).

News from the intersection of MATLAB, Community, and the web.

These postings are the author's and don't necessarily represent the opinions of MathWorks.