Skip to Main Content Skip to Search
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Doug’s Pick of the Week

March 3rd, 2008

Advanced MATLAB: Subplots

The distinction between MATLAB Basics and Advanced MATLAB is a somewhat arbitrary distinction. The heuristic I use is “If I knew it before I came to The MathWorks, it is basic.” It is as good of a rule as any.

Some might argue this is a more basic post, but the inclusion of the gotcha and the use of property value pairs made this an advanced topic in my mind.

This short video shows how to put multiple subplots on a figure. Axes of different sizes can be laid out. The use of the position property is covered. A common gotcha is shown also where one axis overlapping another will delete the first.

Video Content

iconFiles.jpgiconPod.jpglazy.jpg

10 Responses to “Advanced MATLAB: Subplots”

  1. Doug replied on :

    It was just pointed out that there is a typo at two minutes into the video. The title of the subplot on the right should be:

    h=subplot(‘position’, [0.6 0.1 0.3 0.8])

    Sorry!
    Doug

  2. Antunes replied on :

    Hi,

    Could you please give code to plot say 2 subplots side-by-side with the axes obeying the golden ratio?

    thanks
    a.

  3. Doug replied on :

    Antunes,

    You should be able to do that with the ‘position’ property value pair. Just get the length and width in ratio and then position appropriately.

    Doug

  4. Bassam Awad replied on :

    Hello,

    I am trying to plot data in 393 plots with each figure include 25 plots. Any help is really appreciated.

  5. Doug replied on :

    Bassam,

    That seems a little extreme to have 393 plot windows open. Having more than a dozen windows open in a Windows OS seems difficult to manage. I would try to think of a more effective way to display your data.

    Maybe a GUI that allows you to select the graph you are interested in would be better. Maybe an animation is more what you need.

    Doug

  6. Dimitrij replied on :

    thanks for the hint: I finally understood the “position” command applied to subplot, and that dimensions are given in percentage of figure width and height.

  7. Fikri replied on :

    Hi Doug,

    got a simple question here, I’m making an interface for an image compression project. I needed to generate several subplots for the histogram, but here lies the problem. After generating all the subplots (which I put inside a panel, not axes) I simply can’t remove/clear/reset those subplots, which I need to do to make my ‘Clear’ pushbutton works as it is assigned to do.

    a quick reply would be nice..

    regards

    Fikri

  8. Bob replied on :

    Fikri, see CLA.

  9. jitendra replied on :

    Hai Doug

    I need your help in plotting a time-series data set and in the form of sub-plots.My domain size is 362 X 181 and like that there are 12 data sets.I need to plot all these 12 data sets of same dimension and animate later.
    I need to make a script so that,it is operational.

    I strucked from last four days to do this.
    Thanking you in advance

    regards
    jitendra

  10. Doug replied on :

    jitendra,

    I am not sure I understand your question. Please contact support for help.

    Doug

Leave a Reply


Doug Hull is an Application Engineer at The MathWorks. A MATLAB user since 1994, he gets paid to live, eat, and breathe MATLAB! This blog is dedicated to promoting the File Exchange by highlighting files and original video content.



  • Moran: Hi Chris, I tried everything I could think of, and have sent several observations about this bug to support,...
  • odessit: Hello, I have compiled standalone application with deploytool. It would work fine, but the error is in...
  • Duane Hanselman: FYI… % strmatch replacements % strmatch is obsolete, strncmp and strcmp are built in % case...
  • Doug: Duane, I just looked, I did not see an m-lint warning against STRMATCH in 2008a. However, I seem to recall what...
  • hashem: Hi Doug, I built a GUI and write a help for it in “chm” (compiled HTML file) format, and I...
  • Tim Davis: I left out the comments in the code, above. Most of the functions should be familiar to most MATLAB users....
  • Tim Davis: I was a little confused by all the back-and-forth discussion of zero blocks. Is a block of zeros to be...
  • Tim Davis: Try this one. It doesn’t require any toolboxes, just “sparse” and “dmperm” ....
  • Duane Hanselman: Did anyone ever try replacing strmatch with strcmp (or its siblings as needed)? I recall mlint...
  • jiro: @Daniel, We do use the hardware, but we don’t expose the supersampling feature through that path, so if...

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

Related Topics