1. 参考 www.52ocean.cn. C: i$ S8 _, H. S8 o+ ~9 U# w# k
dc=hsv(18); % 18 colours are generated
* x: E. X: T# @ {! cx = 0:pi/100:2*pi;
% x2 m0 i Z7 rhold on % you much write this before the plot
6 O( F% H E' Q) z6 {i=1;
' O/ _+ E& M, r2 q: d( t; xfor d=0:0.2:2, % 11 lines in plot are taken& Q% k, C9 L8 g- C- t, h( U
plot(x,sin(x-d),'color',dc(i, ,'linewidth',2)
" c. U' [" E2 d# p$ ` i=i+1;
, Q/ n5 M: c6 j) m# X5 \: x% Oend9 d' Z+ I: O' {+ ~3 F8 v
8 j7 C2 f% L5 t w" e$ Y6 o
0 _* o; q- G# o' ^9 g- @% c" H
9 Z% T( p" l0 {5 }8 P0 Z0 @2.参考http://stackoverflow.com/questions/37111362/matlab-plot-and-color-samples-based-on-data
: q( e# K# n# \6 b9 i1 k) N: r: H5 X
nlines=length(concentrations);cmap=hsv(nlines)
6 H4 Y' j% a9 u- R7 F# D6 ac=concentrations-min(concentrations);
& A) R/ l: M8 J( [- Z8 Zc=ceil(c/max(c)*nlines);; ]# Y' Y9 j! O2 b6 v
for ii=1:nlines5 y( j7 {2 e3 F) t' w' v0 _
plot(wavelength,dataMatrix(ii,:),'Color',cmap(c(ii),:)) e, O; y/ y7 J* f \1 {/ V
hold on;
, p0 T. w7 a8 n8 mend
5 H1 G7 x( j6 L$ O: fhold off;
6 T9 o A, @8 V2 _% {
( w" g0 \# x* I6 h; W9 H& }& B- Y$ K u- @& j( w8 M
! I! b$ x" P7 d& \
/ M# Y7 r7 E7 d
; {" A" e& |8 b1 _* N( j+ P0 @! X' V: \8 Y2 u* ~1 V- ]
转载本文请联系原作者获取授权,同时请注明本文来自叶瑞杰科学网博客。 |