Changeset 16052


Ignore:
Timestamp:
09/03/13 08:56:16 (12 years ago)
Author:
Mathieu Morlighem
Message:

NEW: scaleruler now takes into account units

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/scaleruler.m

    r14488 r16052  
    1010fontweight = getfieldvalue(options,'fontweight','n');
    1111fontsize   = getfieldvalue(options,'scaleruler_fontsize',16);
     12unitscale  = getfieldvalue(options,'unit',1.);
    1213
    1314%Go through structure and fill missing arguments
     
    1718
    1819%retrieve scale parameters
    19 x0            = structure(1);
    20 y0            = structure(2);
    21 lengthscale   = structure(3);
    22 widthscale    = structure(4);
    23 numberofticks = structure(5);
     20x0            = double(structure(1))/unitscale;
     21y0            = double(structure(2))/unitscale;
     22lengthscale   = double(structure(3))/unitscale;
     23widthscale    = double(structure(4))/unitscale;
     24numberofticks = double(structure(5));
    2425
    2526%If only one tick, just draw a rectangle
    2627if numberofticks==1,
    27         text(x0+lengthscale/2,y0+2*widthscale,2,[num2str(lengthscale/1000) 'km'],...
     28        text(x0+lengthscale/2,y0+2*widthscale,2,[num2str(lengthscale*unitscale/1000) ' km'],...
    2829                'FontSize',fontsize,'FontWeight',fontweight,'Color',fontcolor,'HorizontalAlignment','center','VerticalAlignment','baseline');
    2930        patch([x0 x0+lengthscale x0+lengthscale x0],[y0 y0 y0+widthscale y0+widthscale],2*ones(1,4),fontcolor,'Edgecolor',fontcolor);
     
    4849                Bu=[Au(1)+unitlength Ad(2)+widthscale];
    4950                Bd=[Ad(1)+unitlength Ad(2)];
    50                 Tick=Tick+unitlength;
     51                Tick=(Tick+unitlength)*unitscale;
    5152
    5253                %pathes
Note: See TracChangeset for help on using the changeset viewer.