This week, it's an early post because of Thanksgiving holiday here in the U.S.
Hello MATLAB fans! My name is Ameya and I'm a colleague of Jiro and Brett at MathWorks. I primarily support MATLAB users in financial services but I'm personally very interested in tool building, visualization and GUIs. This is my first pick as a guest on this blog so I hope you enjoy it.
If you are familiar with any of my submissions, you might know that I'm a big fan of generalizing built-in MATLAB functions with wrappers to offer more control or expanded functionality. My pick this week does exactly that. It extends the subplot command to create an infinite canvas of plots with a scroll bar. This can be very useful if you have many visualizations to display in a single figure window or GUI but a limited amount of screen real estate. Best of all, because it works just like subplot, you don't need to learn new syntax or modify a lot of existing code. Reviewer Telmo Amaral perhaps says it best: "This function did precisely what I needed in the easiest possible way: just had to replace all the calls to subplot with calls to scrollsubplot."
For example, suppose we need to display 3 rows of plots on a figure but really only have enough room for 2 rows on screen at one time. We can set up just such a canvas with scrollsubplot:
% Create a standard 2-row view, similar to _subplot_ scrollsubplot(2,1,1); plot(cumsum(randn(200,10))); scrollsubplot(2,2,3); plot(rand(10,1), rand(10,1), '^'); scrollsubplot(2,2,4); hist(randn(100,1)); % Create axes outside the visible area and generate a scroll bar to bring % these axes into view scrollsubplot(2,2,5); imagesc(magic(16)); scrollsubplot(2,2,6); pie(rand(10,1));
The figure can be scrolled interactively or with the supporting scroll function. The final result looks something like the following:
Bjorn adds the convenience of using the arrow and the page up/down keys to scroll through the canvas of axes. I also like how he sets up all of the position offset constants at the beginning of his function so that one can easily customize the spacing between subplots.
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.