1. 参考 www.52ocean.cn" ^8 Y+ a) l! C+ M# w
dc=hsv(18); % 18 colours are generated# |% y0 r6 l! \
x = 0:pi/100:2*pi;
6 B {' S5 ~, h7 U* Q5 _( ghold on % you much write this before the plot
1 o( [4 E1 }/ C% Ri=1;
4 ^- N: d8 {. ?4 f; H0 `! C2 @for d=0:0.2:2, % 11 lines in plot are taken: l$ \+ }/ y/ ]% m) ]5 y. p
plot(x,sin(x-d),'color',dc(i, ,'linewidth',2)% f* `$ F4 n! _& \! p+ ^' N
i=i+1;
e3 h0 W, f3 Q; I0 s9 J2 \' Tend
, o i$ e$ T4 m7 I1 z! m. D5 P
( D2 l3 Q& D2 j# b
' f/ N- C# Q- C9 ]* d4 `! X6 ~$ F
- {1 t& y' B E/ ^5 J2.参考http://stackoverflow.com/questions/37111362/matlab-plot-and-color-samples-based-on-data! O. S4 s# r1 L. I; h! V
- r3 Y2 H# N2 ^% U3 j' D; F, Anlines=length(concentrations);cmap=hsv(nlines)
! ~" I" e \/ T1 D. a, qc=concentrations-min(concentrations);
. z# y( F8 A9 e! Ac=ceil(c/max(c)*nlines);# i" Y- p6 H% X' s& V( N: L# x$ B
for ii=1:nlines6 Y0 I, {: d" p$ W# Y8 O
plot(wavelength,dataMatrix(ii,:),'Color',cmap(c(ii),:))( S3 c8 y3 A" X) ?' N- |
hold on;
, u; b/ \4 L9 u( yend
# A+ B% J5 H5 v% v Fhold off; Q. o, Y3 g4 v/ E
5 T/ t+ q+ j9 o3 `! Y/ m
& u3 M3 I: I; K! x7 X2 s% M8 C! k1 J. U. `, G2 b& m; s2 w" |1 {+ `
! I1 E* I: y8 T+ e* Z" Y$ z
8 l6 w) V1 k4 d K
$ O+ O2 P8 X& ` 转载本文请联系原作者获取授权,同时请注明本文来自叶瑞杰科学网博客。 |