4000-520-616
欢迎来到免疫在线!(蚂蚁淘生物旗下平台)  请登录 |  免费注册 |  询价篮
主营:原厂直采,平行进口,授权代理(蚂蚁淘为您服务)
咨询热线电话
4000-520-616
当前位置: 首页 > 新闻动态 >
新闻详情
matlab复杂的科研绘图汇总---总有一款你喜欢(更新中..._CSDN博客
来自 : CSDN技术社区 发布时间:2021-03-25
%----------Rest of document is from quiverc2wcmap---------------% This is Matlab s 6.5.1 quiver. I figure that ensures a fair amouint of backward% compatibility but I needed to hack it to allow a Color property. Obviously% a person could do more.function hh quiver(varargin)%QUIVER Quiver plot.% QUIVER(X,Y,U,V) plots velocity vectors as arrows with components (u,v)% at the points (x,y). The matrices X,Y,U,V must all be the same size% and contain corresponding position and velocity components (X and Y% can also be vectors to specify a uniform grid). QUIVER automatically% scales the arrows to fit within the grid.% QUIVER(U,V) plots velocity vectors at equally spaced points in% the x-y plane.% QUIVER(U,V,S) or QUIVER(X,Y,U,V,S) automatically scales the % arrows to fit within the grid and then stretches them by S. Use% S 0 to plot the arrows without the automatic scaling.% QUIVER(...,LINESPEC) uses the plot linestyle specified for% the velocity vectors. Any marker in LINESPEC is drawn at the base% instead of an arrow on the tip. Use a marker of . to specify% no marker at all. See PLOT for other possibilities.% QUIVER(..., filled ) fills any markers specified.% H QUIVER(...) returns a vector of line handles.% Example:% [x,y] meshgrid(-2:.2:2,-1:.15:1);% z x .* exp(-x.^2 - y.^2); [px,py] gradient(z,.2,.15);% contour(x,y,z), hold on% quiver(x,y,px,py), hold off, axis image% See also FEATHER, QUIVER3, PLOT.% Clay M. Thompson 3-3-94% Copyright 1984-2002 The MathWorks, Inc. % $Revision: 5.21 $ $Date: 2002/06/05 20:05:16 $% Arrow head parametersalpha 0.33; % Size of arrow head relative to the length of the vectorbeta 0.33; % Width of the base of the arrow head relative to the lengthautoscale % Autoscale if ~ 0 then scale by this.plotarrows % Plot arrowsfilled ls - col b nin nargin;ColorSpecInd find(strcmpi(varargin, color if(length(ColorSpecInd) 1 nin ColorSpecInd) col varargin{ColorSpecInd varargin varargin([1:ColorSpecInd-1,ColorSpecInd 2:nin]); nin nin-2;% Parse the string inputswhile isstr(varargin{nin}), vv varargin{nin}; if ~isempty(vv) strcmp(lower(vv(1)), f ) filled nin nin-1; else [l,c,m,msg] colstyle(vv); if ~isempty(msg), error(sprintf( Unknown option %s . ,vv)); if ~isempty(l), ls end if ~isempty(c), col end if ~isempty(m), ms plotarrows end if isequal(m, . ), ms end % Don t plot . nin nin-1;error(nargchk(2,5,nin));% Check numeric input argumentsif nin 4, % quiver(u,v) or quiver(u,v,s) [msg,x,y,u,v] xyzchk(varargin{1:2}); [msg,x,y,u,v] xyzchk(varargin{1:4});if ~isempty(msg), error(msg); endif nin 3 | nin 5, % quiver(u,v,s) or quiver(x,y,u,v,s) autoscale varargin{nin};% Scalar expand u,vif prod(size(u)) 1, u u(ones(size(x))); endif prod(size(v)) 1, v v(ones(size(u))); endif autoscale, % Base autoscale value on average spacing in the x and y % directions. Estimate number of points in each direction as % either the size of the input arrays or the effective square % spacing if x and y are vectors. if min(size(x)) 1, n sqrt(prod(size(x))); m else [m,n] size(x); end delx diff([min(x(:)) max(x(:))])/n; dely diff([min(y(:)) max(y(:))])/m; del delx.^2 dely.^2; if del 0 len sqrt((u.^2 v.^2)/del); maxlen max(len(:)); else maxlen if maxlen 0 autoscale autoscale*0.9 / maxlen; else autoscale autoscale*0.9; u u*autoscale; v v*autoscale;ax newplot;next lower(get(ax, NextPlot hold_state ishold;% Make velocity vectorsx x(:). y y(:). u u(:). v v(:). uu [x;x repmat(NaN,size(u))];vv [y;y repmat(NaN,size(v))];% h1 plot(uu(:),vv(:),[col ls]);h1 plot(uu(:),vv(:),ls, Color ,col);if plotarrows, % Make arrow heads and plot them hu [x u-alpha*(u beta*(v eps));x ... x u-alpha*(u-beta*(v eps));repmat(NaN,size(u))]; hv [y v-alpha*(v-beta*(u eps));y ... y v-alpha*(v beta*(u eps));repmat(NaN,size(v))]; hold on % h2 plot(hu(:),hv(:),[col ls]); h2 plot(hu(:),hv(:),ls, Color ,col); h2 [];if ~isempty(ms), % Plot marker on base hu hv hold on% h3 plot(hu(:),hv(:),[col ms]); h3 plot(hu(:),hv(:),ls, Color ,col); if filled, set(h3, markerfacecolor ,get(h1, color end h3 [];if ~hold_state, hold off, view(2); set(ax, NextPlot ,next); endif nargout 0, hh [h1;h2;h3]; endfunction retval isscalar(m)retval prod(size(m))

 

clear clc;x rand(1,100).*100;y rand(1,100).*100;u rand(1,100) .* 10;v rand(1,100) .* 10;scale figure; quiverwcolorbar(x ,y ,u ,v ,scale); figure; quiverwcolorbar(x ,y ,u ,v ,scale, bounds ,[0 10]);

\"\"

4、精细化作图工具箱 

 

\"\"

\"\"

 

\"\"

\"\"

\"\"

因为是数据文件只能加群 【matlab python资源共享】 获取panel-2.14.rar文件

4、matlab绘制维恩图
function varargout venn (varargin)%VENN Plot 2- or 3- circle area-proportional Venn diagram% venn(A, I)% venn(Z)% venn(..., F)% venn(..., ErrMinMode , MODE)% H venn(...)% [H, S] venn(...)% [H, S] venn(..., Plot , off )% S venn(..., Plot , off )% [...] venn(..., P1, V1, P2, V2, ...) %venn(A, I) by itself plots circles with total areas A, and intersection%area(s) I. For two-circle venn diagrams, A is a two element vector of circle %areas [c1 c2] and I is a scalar specifying the area of intersection between %them. For three-circle venn diagrams, A is a three element vector [c1 c2 c3], %and I is a four element vector [i12 i13 i23 i123], specifiying the %two-circle intersection areas i12, i13, i23, and the three-circle%intersection i123.%venn(Z) plots a Venn diagram with zone areas specified by the vector Z. %For a 2-circle venn diagram, Z is a three element vector [z1 z2 z12]%For a 3-circle venn, Z is a 7 element vector [z1 z2 z3 z12 z13 z23 z123]%venn(..., F) specifies optional optimization options. VENN uses FMINBND to%locate optimum pair-wise circle distances, and FMINSEARCH to optimize%overall three-circle alignment. F is a structure with fields specifying%optimization options for these functions. F may be a two-element array of%structures, in which case the first structure is used for FMINBND%function calls, and the second structure is used for FMINSEARCH function%calls.%venn(..., ErrMinMode , MODE)%Used for 3-circle venn diagrams only. MODE can be TotalError (default), % None , or ChowRodgers . When ErrMinMode is None , the positions and %sizes of the three circles are fixed by their pairwise-intersections, %which means there may be a large amount of error in the area of the three-%circle intersection. Specifying ErrMinMode as TotalError attempts to %minimize the total error in all four intersection zones. The area of the %three circles are kept constant in proportion to their populations. The % ChowRodgers mode uses the the method proposed by Chow and Rodgers %[Ref. 1] to draw nice three-circle venn diagrams which appear more %visually representative of the desired areas, although the actual areas of %the circles are allowed to deviate from requested values.%H venn(...) returns a two- or three- element vector to the patches %representing the circles. %[H, S] venn(...) returns a structure containing descriptive values%computed for the requested venn diagram. S is a structure with the%following fields, where C is the number of circles (N 2 or 3), Z is%the number of zones (Z 3 or 7), and I is the number of intersection %areas (1 or 4)% Radius C-element vector of circle radii% Position C*2 array of circle centers% ZoneCentroid Z*2 array of zone centroids (Can be used for labeling)% CirclePop C-element vector of supplied circle populations. % (I.e., the true circle areas)% CircleArea C-element of actual circle areas% CircleAreaError (CircleArea-CirclePop)/CirclePop% IntersectPop I-element vector of supplied intersection populations% (I.e., the true intersection areas)% IntersectArea I-element vector of actual intersection areas% IntersectError (IntersectArea-IntersectPop)/IntersectPop% ZonePop Z-element vector of supplied zone populations. (I.e.% true zone areas% ZoneArea Z-element vector of actual zone areas.% ZoneAreaError (ZoneArea-ZonePop)/ZonePop%[H, S] venn(..., Plot , off )%S venn(..., Plot , off )%Returns a structure of computed values, without plotting the diagram. This %which can be useful when S is used to draw custom venn diagrams or for %exporting venn diagram data to another application. When Plot is set to off, %the handles vector H is returned as an empty array. Alternatively, the command%S venn(..., Plot , off) will return only the output structure.%[...] venn(..., P1, V1, P2, V2, ...) %Specifies additional patch settings in standard Matlab parameter/value %pair syntax. Parameters can be any valid patch parameter. Values for patch %parameters can either be single values, or a cell array of length LENGTH(A), %in which case each value in the cell array is applied to the corresponding %circle in A.%Examples% %Plot a simple 2-circle venn diagram with custom patch properties% figure, axis equal, axis off% A [300 200]; I 150;% venn(A,I, FaceColor ,{ r , y }, FaceAlpha ,{1,0.6}, EdgeColor , black )% %Compare ErrMinModes% A [350 300 275]; I [100 80 60 40];% figure% subplot(1,3,1), h1 venn(A,I, ErrMinMode , None % axis image, title ( No 3-Circle Error Minimization )% subplot(1,3,2), h2 venn(A,I, ErrMinMode , TotalError % axis image, title ( Total Error Mode )% subplot(1,3,3), h3 venn(A,I, ErrMinMode , ChowRodgers % axis image, title ( Chow-Rodgers Mode )% set([h1 h2], FaceAlpha , 0.6)% %Using the same areas as above, display the error optimization at each % iteration. Get the output structure.% F struct( Display , iter % [H,S] venn(A,I,F, ErrMinMode , ChowRodgers , FaceAlpha , 0.6);% %Now label each zone % for i 1:7% text(S.ZoneCentroid(i,1), S.ZoneCentroid(i,2), [ Zone num2str(i)])% end%See also patch, bar, optimset, fminbdn, fminsearch%Copyright (C) 2008 Darik Gamble, University of Waterloo.%dgamble engmail.uwaterloo.ca%References%1. S Chow and P Rodgers. Extended Abstract: Constructing Area-Proportional% Venn and Euler Diagrams with Three Circles. Presented at Euler Diagrams % Workshop 2005. Paris. Available online: % http://www.cs.kent.ac.uk/pubs/2005/2354/content.pdf%2. S Chow and F Ruskey. Drawing Area-Proportional Venn and Euler Diagrams. % Lecture Notes in Computer Science. 2004. 2912: 466-477. Springer-Verlag. % Available online: http://www.springerlink.com/content/rxhtlmqav45gc84q/%3. MP Fewell. Area of Common Overlap of Three Circles. Australian Government % Department of Defence. Defence Technology and Science Organisation. 2006. % DSTO-TN-0722. Available online:% http://dspace.dsto.defence.gov.au/dspace/bitstream/1947/4551/4/DSTO-TN-0722.PR.pdf

本文链接: http://indspec.immuno-online.com/view-737585.html

发布于 : 2021-03-25 阅读(0)