File Exchange

image thumbnail


version 1.0 (30.6 KB) by

axshift() -funtion to manually resize and rescale subplots/axis within a figure

1 Download


No License

  a] resize of subplots/axes manully in a wysiwyg fashion
  b] multiple subplots with different sizes,
  c] overlapping supplots (transparent or not), graphical overlay
  d] create a layout with subplot locations for other figures/data
  1] plot figure with subplots
  2] type 'axshift'
  3] an icon appears in the toolbar
  4] if this icon is selected (colored)
      -selected axes/subplots of the figure can be moved
  5] via contextmenu (right mouse click in the figure,but not within a subplot)
      the following functions are available
     - BG-original: backgroundcolor of each subplot set to orig. color
     - BG-none: transparent background
     - position-original: original positions of the subplots
     - position-last one: previous positions
     - positions to workspace: parse new positions of all subplots to the workspace. This might
       be usefull for creating template layout for other data, The order of positions equals the order of the
       originally plotted subplots
      - resize all: resize all subplots by means of the mouse wheel (backwards: larger; forward: smaller)
        note: a size of 100% refers to the size when the 'resize all'-function is executed.
      - resize indiv: if selected an axes, drag the corner-and midpoints of the subplot to resize the axes
      - shift axes: selected axes/subplots of the figure can be moved
   6] additionally there are 3 shortkeys for fast switching between
     shifting and rescaling functions
      (press key if the figure is active)
      [a]: activate the 'resize all' function
      [d]: activate the 'resize indiv' function
      [s]: activate the 'shift axes' function
 example: you can use this example to play around
  figure('color',[1 1 1]);
  for i=1:9;
      plot(1:40, rand(40,1),'color',[rand(1) rand(1) rand(1)],'linewidth',2);
  subplot(4,3,i+1);image,axis tight;colorbar;
  subplot(4,3,i+2);image,axis tight;colorbar
  subplot(4,3,i+3);image,axis tight;

Comments and Ratings (3)


Sam (view profile)

Very handy, but a few things:
1) if the axes ij instead of xy the resizing goes a little confusing - check for "if isequal(get(gca,'YDir'),'reverse')"
2) black is not always the most visible colour for the resizing boxes to click and drag; black boxes with a 1px thick white border would be visible on any back ground
3) I occasionally get the following:
uitools.uimodemanager.uimodemanager>localModeWarn at 66
  In uitools.uimodemanager.uimodemanager>@(obj,evd)(localModeWarn(obj,evd,hThis)) at 47
  In axshift>iconON at 134
4) it seems to be possible to run the script several times simultaneously.


Sam (view profile)


MATLAB Release
MATLAB 7.4 (R2007a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video