Changeset 839


Ignore:
Timestamp:
06/08/09 11:16:18 (16 years ago)
Author:
Mathieu Morlighem
Message:

Added default values of latlon tickes

Location:
issm/trunk/src/m/classes/public/plot
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/public/plot/applyoptions.m

    r826 r839  
    155155%latlon
    156156if (iscell(options_structure.latlon) | ~isnan(options_structure.latlon)),
    157         latlonoverlay(options_structure.latlon,options_structure.latlonnumbering);
     157        latlonoverlay(options_structure);
    158158end
    159159
  • issm/trunk/src/m/classes/public/plot/latlonoverlay.m

    r826 r839  
    1 function latlonoverlay(latlon,numbering)
     1function latlonoverlay(options_structure)
    22%LATLONOVERLAY - overlay latitude and longitude lines on current figure
    33%
     
    88%
    99%   Usage:
    10 %      latlonoverlay(latlon,numbering)
     10%      latlonoverlay(options_structure)
     11
     12%get options
     13latlon=options_structure.latlon;
     14numbering=options_structure.latlonnumbering;
     15if ~isnan(options_structure.latlonclick),
     16        latlonclick=1;
     17else
     18        latlonclick=0;
     19end
     20if ~isnan(options_structure.fontsize),
     21        fontsize=options_structure.fontsize;
     22else
     23        fontsize=16;
     24end
    1125
    1226%recover arguments (set default parameters if needed)
     
    8498                l=line(x,y,'Color',color);
    8599                if numbering,
    86                         disp(['Specifiy where to put number for longitude ' num2str(lon(i))]);
    87                         [xcorner,ycorner]=ginput(1);
     100                        if latlonclick
     101                                disp(['Specifiy where to put number for longitude ' num2str(lon(i))]);
     102                                [xcorner,ycorner]=ginput(1);
    88103
    89                         %Find nearest point on this profile corresponding to (xcorner,ycorner):
    90                         ind=find_point(x,y,xcorner,ycorner); xcorner=x(ind); ycorner=y(ind);
     104                                %Find nearest point on this profile corresponding to (xcorner,ycorner):
     105                                ind=find_point(x,y,xcorner,ycorner); xcorner=x(ind); ycorner=y(ind);
     106                        else
     107                                ind=round(9*length(x)/10); xcorner=x(ind); ycorner=y(ind);
     108                        end
    91109                        if length(x(1:ind))>10,
    92110                                xcorner2=x(ind-10); ycorner2=y(ind-10);
     
    97115                       
    98116                        if (xcorner>xlimits(1) & xcorner<xlimits(2) & ycorner>ylimits(1) & ycorner<ylimits(2)),
    99                                 th=text(xcorner,ycorner,[num2str(lon(i)) '^{\circ}']);set(th,'Color',colornumber,'Rotation',angle,'FontSize',16,'HorizontalAlignment','center','VerticalAlignment','middle');
     117                                th=text(xcorner,ycorner,[num2str(lon(i)) '^{\circ}']);set(th,'Color',colornumber,'Rotation',angle,'FontSize',fontsize,'HorizontalAlignment','center','VerticalAlignment','middle');
    100118                               
    101119                                %erase line and redraw it in two parts, to leave space for latitude number
     
    123141               
    124142                if numbering,
    125                         disp(['Specifiy where to put number for latitude ' num2str(lat(i))]);
    126                         [xcorner,ycorner]=ginput(1);
     143                        if latlonclick
     144                                disp(['Specifiy where to put number for latitude ' num2str(lat(i))]);
     145                                [xcorner,ycorner]=ginput(1);
    127146
    128                         %Find nearest point on this profile corresponding to (xcorner,ycorner):
    129                         ind=find_point(x,y,xcorner,ycorner); xcorner=x(ind); ycorner=y(ind);
     147                                %Find nearest point on this profile corresponding to (xcorner,ycorner):
     148                                ind=find_point(x,y,xcorner,ycorner); xcorner=x(ind); ycorner=y(ind);
     149                        else
     150                                ind=round(9*length(x)/10); xcorner=x(ind); ycorner=y(ind);
     151                        end
    130152                        if length(x(1:ind))>10,
    131153                                xcorner2=x(ind-10); ycorner2=y(ind-10);
     
    136158                       
    137159                        if (xcorner>xlimits(1) & xcorner<xlimits(2) & ycorner>ylimits(1) & ycorner<ylimits(2)),
    138                                 th=text(xcorner,ycorner,[num2str(lat(i)) '^{\circ}']);set(th,'Color',colornumber,'Rotation',angle,'FontSize',16,'HorizontalAlignment','center','VerticalAlignment','middle');
     160                                th=text(xcorner,ycorner,[num2str(lat(i)) '^{\circ}']);set(th,'Color',colornumber,'Rotation',angle,'FontSize',fontsize,'HorizontalAlignment','center','VerticalAlignment','middle');
    139161                               
    140162                                %erase line and redraw it in two parts, to leave space for latitude number
  • issm/trunk/src/m/classes/public/plot/parse_options.m

    r838 r839  
    559559end
    560560
     561%latlonnumbering
     562latlonclickvalues=findarg(optionstring,'latlonclick');
     563if ~isempty(latlonclickvalues),
     564        if  strcmpi(latlonclickvalues.value,'on'),
     565                options_struct.latlonclick=1;
     566        else
     567                options_struct.latlonclick=NaN;
     568        end
     569else
     570        options_struct.latlonclick=NaN;
     571end
     572
    561573%north arrow
    562574northarrowvalues=findarg(optionstring,'northarrow');
  • issm/trunk/src/m/classes/public/plot/plotdoc.m

    r826 r839  
    9595disp('       ''latlon'': ''on'' or {latstep lonstep [resolution [color]]} where latstep,longstep and resolution are in degrees, color is a [r g b] array');
    9696disp('       ''latlonnumbering'': ''on'' or {latgap longap colornumber latangle lonangle} where latgap and longap are pixel gaps for the numbers,');
     97disp('       ''latlonclick'': ''on'' to click on latlon ticks positions');
    9798disp('                   colornumber is a [r g b] array and latangle and lonangle are angles to flip the numbers');
    9899disp('       ''northarrow'': add an arrow pointing north, ''on'' for default value or [x0 y0 length [ratio [width]]] where (x0,y0) are the coordinates of the base, and ratio=headlength/length');
Note: See TracChangeset for help on using the changeset viewer.