WAFOSTAMP Prints a caption "made by WAFO" in current figure. CALL: [h,ax] = wafostamp(stamp); [h,ax] = wafostamp(caption,flag); h,ax = handles to the lines of text and the axes, respectively. stamp = 0, do not print the text, (Default if nargin==0) 1, print the text (Default if nargin > 0) caption = string caption before 'made by WAFO' (default []) flag = string following 'made by WAFO' (default []) otherwise it is customary to give one of the following flags: '(ER)' - figure is Easily Reproducible ( < 10min to make) '(CR)' - figure is Conditionally Reproducible ( > 10min to make) '(NR)' - figure is Non Reproducible WAFOSTAMP creates new axes and prints the following text near bottom of figure: "caption" made by WAFO "date" "flag" NOTE: - wafostamp also install point-and-click editing of all the text objects (title, xlabel, ylabel, etc) of the current figure - The handles to the lines of text and the axes may also be found by h = findobj(gcf,'tag','wafostmptxt','type','text'); ax = findobj(gcf,'tag','wafostmptxt','type','axes'); Edit wafostamp.m to change default values. Example: plot(sin(0:.1:3)), wafostamp('Sinus plot','(ER)'), hold on plot(sin((0:.1:3)+pi/2)),hold off See also figtext
Places text in figure window. | |
Create axes in arbitrary positions. | |
Current date as date string. | |
Delete file or graphics object. | |
Create figure window. | |
find all objects. | |
Find objects with specified property values. | |
Get handle to current axis. | |
Get handle to current figure. | |
Get object properties. | |
True for numeric arrays. | |
Set object properties. | |
Text annotation. |
% CHAPTER1 demonstrates some applications of WAFO | |
% CHAPTER2 Modelling random loads and stochastic waves | |
% CHAPTER3 Demonstrates distributions of wave characteristics | |
% CHAPTER4 contains the commands used in Chapter 4 of the tutorial | |
% CHAPTER5 contains the commands used in Chapter 5 of the tutorial | |
Plot contents of pdf structures | |
Location of Gullfaks C and Statfjord A platforms in The North Sea | |
Joint distribution of V and H: | |
Probability of exceeding H: Model (dash); data (dots) | |
Probability of exceeding V: Model (dash); data (dots) | |
The conditional probability of exceeding V given H: Model (dash); data (dots) | |
10 minutes mean values of wind (dash) and direction (solid) | |
Example of the reconstructed (solid) and original data set (pluses) | |
Estimated spectral density (solid) and 95% confidence intervals (dots) | |
Transfer function, g, versus the crossing level u | |
Variability of simulated e(g(u)-u) (circles) | |
Estimated Weibull scale parameter versus h=H/Hrms (circles) | |
Estimated Weibull shape parameter versus h=H/Hrms (circles) | |
Conditional mean (solid, circle) and standard deviation (dash,cross) of V given H: | |
Linear simulation from a Torsethaugen spectrum. | |
Intensity of trough-crest cycles computed from St | |
Spectral densities: | |
Probability density distributions (pdf) of wave period, Tt, | |
Directional spectra using Thorsethaugen and cos2s spreading | |
Joint distribution (pdf) of crest front velocity and wave height: | |
Joint distribution (pdf) of crest front period, Tcf, and crest amplitude, Ac | |
Joint distribution (pdf) of crest wavelength, Lc, and crest amplitude, Ac | |
Joint distribution (pdf) of crest wavelength, Lc, and crest amplitude, Ac for extremal waves | |
Intensity of rainflow cycles computed from St |
001 function [H,ax]=wafostamp(varargin) 002 %WAFOSTAMP Prints a caption "made by WAFO" in current figure. 003 % 004 % CALL: [h,ax] = wafostamp(stamp); 005 % [h,ax] = wafostamp(caption,flag); 006 % 007 % h,ax = handles to the lines of text and the axes, respectively. 008 % stamp = 0, do not print the text, (Default if nargin==0) 009 % 1, print the text (Default if nargin > 0) 010 % caption = string caption before 'made by WAFO' (default []) 011 % flag = string following 'made by WAFO' (default []) 012 % otherwise it is customary to give one of the following flags: 013 % '(ER)' - figure is Easily Reproducible ( < 10min to make) 014 % '(CR)' - figure is Conditionally Reproducible ( > 10min to make) 015 % '(NR)' - figure is Non Reproducible 016 % 017 % WAFOSTAMP creates new axes and prints the following text near bottom of figure: 018 % "caption" made by WAFO "date" "flag" 019 % 020 % NOTE: - wafostamp also install point-and-click editing of 021 % all the text objects (title, xlabel, ylabel, etc) of the current figure 022 % - The handles to the lines of text and the axes may also be found by 023 % h = findobj(gcf,'tag','wafostmptxt','type','text'); 024 % ax = findobj(gcf,'tag','wafostmptxt','type','axes'); 025 % Edit wafostamp.m to change default values. 026 % 027 % Example: 028 % plot(sin(0:.1:3)), wafostamp('Sinus plot','(ER)'), hold on 029 % plot(sin((0:.1:3)+pi/2)),hold off 030 % 031 % See also figtext 032 033 % TODO % may be further improoved by making it work like legend without the box 034 035 % Tested on matlab 5.2 036 % history: 037 % revised pab 22.05.2000 minor changes 038 % revised pab 05.02.2000 039 % -added deleteproxy 040 % revised pab 28.01.2000 041 % - updated help header 042 % - Now writes the text in a separate axes in order to make the printed 043 % text independent of the scaling of the figure etc. 044 % - added tag to the wafostamp axes 045 % - added point-and-click editing of all the text objects (title, xlabel, ylabel) of the current figure: 046 % revised pab 21.12.1999 047 % - added an extra plot(sin...) in example 048 % revised pab 20.12.1999 049 % -added varargin (caption flag), axes, date 050 % -returns matlab to the same state as it was before wafostamp was called 051 % adopted from watstamp by ??? 052 053 054 [stamp,caption,flag]=stmpchk(varargin); 055 056 057 if stamp 058 % remember old axes and state 059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 060 %hold_state=ishold; 061 cax=gca; % get current axes 062 cfig=get(cax,'Parent'); 063 figold=gcf; 064 if figold~=cfig, figure(cfig); end 065 if 1 066 % create new axes for caption and delete old caption if it exists 067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 068 ax = findobj(cfig,'tag','wafostmptxt'); 069 if ~isempty(ax), delete(ax), end % delete old wafostamp if it exists 070 ax = axes('Position',[.01 .01 .99 .05],'Visible','off','tag','wafostmptxt'); 071 end 072 if isempty(caption) 073 h1=[]; 074 else 075 h1=figtext(0,0,caption,'norm','norm','left','bottom'); 076 set(h1,'FontSize',10,'Tag','wafostmptxt') 077 end 078 h2=figtext(1,0,['made by WAFO ' date,' ',flag,' '],'norm','norm','right','bottom'); 079 % old call 080 %h=figtext(0,-0.1,'made by WAFO','norm','norm','left'); 081 set(h2,'FontSize',10,'FontAngle','Italic','Tag','wafostmptxt') 082 083 084 % The following two commands install point-and-click editing of 085 % all the text objects (title, xlabel, ylabel) of the current figure: 086 087 set(findall(cfig,'type','text'),'buttondownfcn','edtext') 088 set(cfig,'windowbuttondownfcn','edtext(''hide'')') 089 090 % create DeleteProxy objects (an invisible text object in 091 % the first axes) so that the other axes will be deleted 092 % properly. 093 %'tag','wafostmptxt',... 094 DeleteProxy(1) = text('parent',cax,'visible','off',... 095 'handlevisibility','off',... 096 'deletefcn','eval(''delete(get(gcbo,''''userdata''''))'','''')'); 097 DeleteProxy(2) = text('parent',ax,'visible','off',... 098 'tag','wafostmptxt',... 099 'handlevisibility','off',... 100 'deletefcn','eval(''delete(get(gcbo,''''userdata''''))'','''')'); 101 set(DeleteProxy(1),'userdata',ax);%get(cfig,'children'));%[ax); 102 set(DeleteProxy(2),'userdata',DeleteProxy(1)); 103 104 if nargout>0 105 H=[h1 h2]; 106 end 107 108 % reset to the old state 109 %%%%%%%%%%%%%%%%%%%%%%%%%% 110 %set(cfig,'currentaxes',cax) % reset to old axes 111 axes(cax) 112 if (figold~=cfig), figure(figold); end 113 114 end 115 116 117 function [stamp,caption,flag]=stmpchk(P); 118 % gives the correct input values 119 N=length(P); 120 121 caption=[];flag=[]; 122 if N==0 123 stamp=0; %EDIT HERE to change default value 124 elseif (N == 1 & isnumeric( P{1})) 125 stamp=P{1}; 126 else 127 stamp=1; 128 caption=P{1}; 129 if N>1 130 flag=P{2}; 131 end 132 end 133 134 135
Comments or corrections to the WAFO group