> t <- seq(from=0,to=1,length=100)*2*pi
> t
Result:
[1] 0.00000000 0.06346652 0.12693304 0.19039955 0.25386607 0.31733259
[7] 0.38079911 0.44426563 0.50773215 0.57119866 0.63466518 0.69813170
[13] 0.76159822 0.82506474 0.88853126 0.95199777 1.01546429 1.07893081
[19] 1.14239733 1.20586385 1.26933037 1.33279688 1.39626340 1.45972992
[25] 1.52319644 1.58666296 1.65012947 1.71359599 1.77706251 1.84052903
[31] 1.90399555 1.96746207 2.03092858 2.09439510 2.15786162 2.22132814
[37] 2.28479466 2.34826118 2.41172769 2.47519421 2.53866073 2.60212725
[43] 2.66559377 2.72906028 2.79252680 2.85599332 2.91945984 2.98292636
[49] 3.04639288 3.10985939 3.17332591 3.23679243 3.30025895 3.36372547
[55] 3.42719199 3.49065850 3.55412502 3.61759154 3.68105806 3.74452458
[61] 3.80799110 3.87145761 3.93492413 3.99839065 4.06185717 4.12532369
[67] 4.18879020 4.25225672 4.31572324 4.37918976 4.44265628 4.50612280
[73] 4.56958931 4.63305583 4.69652235 4.75998887 4.82345539 4.88692191
[79] 4.95038842 5.01385494 5.07732146 5.14078798 5.20425450 5.26772102
[85] 5.33118753 5.39465405 5.45812057 5.52158709 5.58505361 5.64852012
[91] 5.71198664 5.77545316 5.83891968 5.90238620 5.96585272 6.02931923
[97] 6.09278575 6.15625227 6.21971879 6.28318531
Command:
> x <- cbind(sin(t),cos(t))
> x
Result:
[,1] [,2]
[1,] 0.000000e+00 1.00000000
[2,] 6.342392e-02 0.99798668
[3,] 1.265925e-01 0.99195481
[4,] 1.892512e-01 0.98192870
[5,] 2.511480e-01 0.96794870
[6,] 3.120334e-01 0.95007112
[7,] 3.716625e-01 0.92836793
[8,] 4.297949e-01 0.90292654
[9,] 4.861967e-01 0.87384938
[10,] 5.406408e-01 0.84125353
[11,] 5.929079e-01 0.80527026
[12,] 6.427876e-01 0.76604444
[13,] 6.900790e-01 0.72373404
[14,] 7.345917e-01 0.67850941
[15,] 7.761465e-01 0.63055267
[16,] 8.145760e-01 0.58005691
[17,] 8.497254e-01 0.52722547
[18,] 8.814534e-01 0.47227107
[19,] 9.096320e-01 0.41541501
[20,] 9.341479e-01 0.35688622
[21,] 9.549022e-01 0.29692038
[22,] 9.718116e-01 0.23575894
[23,] 9.848078e-01 0.17364818
[24,] 9.938385e-01 0.11083820
[25,] 9.988673e-01 0.04758192
[26,] 9.998741e-01 -0.01586596
[27,] 9.968548e-01 -0.07924996
[28,] 9.898214e-01 -0.14231484
[29,] 9.788024e-01 -0.20480667
[30,] 9.638422e-01 -0.26647381
[31,] 9.450008e-01 -0.32706796
[32,] 9.223543e-01 -0.38634513
[33,] 8.959938e-01 -0.44406661
[34,] 8.660254e-01 -0.50000000
[35,] 8.325699e-01 -0.55392006
[36,] 7.957618e-01 -0.60560969
[37,] 7.557496e-01 -0.65486073
[38,] 7.126942e-01 -0.70147489
[39,] 6.667690e-01 -0.74526445
[40,] 6.181590e-01 -0.78605309
[41,] 5.670599e-01 -0.82367658
[42,] 5.136774e-01 -0.85798341
[43,] 4.582265e-01 -0.88883545
[44,] 4.009305e-01 -0.91610846
[45,] 3.420201e-01 -0.93969262
[46,] 2.817326e-01 -0.95949297
[47,] 2.203105e-01 -0.97542979
[48,] 1.580014e-01 -0.98743889
[49,] 9.505604e-02 -0.99547192
[50,] 3.172793e-02 -0.99949654
[51,] -3.172793e-02 -0.99949654
[52,] -9.505604e-02 -0.99547192
[53,] -1.580014e-01 -0.98743889
[54,] -2.203105e-01 -0.97542979
[55,] -2.817326e-01 -0.95949297
[56,] -3.420201e-01 -0.93969262
[57,] -4.009305e-01 -0.91610846
[58,] -4.582265e-01 -0.88883545
[59,] -5.136774e-01 -0.85798341
[60,] -5.670599e-01 -0.82367658
[61,] -6.181590e-01 -0.78605309
[62,] -6.667690e-01 -0.74526445
[63,] -7.126942e-01 -0.70147489
[64,] -7.557496e-01 -0.65486073
[65,] -7.957618e-01 -0.60560969
[66,] -8.325699e-01 -0.55392006
[67,] -8.660254e-01 -0.50000000
[68,] -8.959938e-01 -0.44406661
[69,] -9.223543e-01 -0.38634513
[70,] -9.450008e-01 -0.32706796
[71,] -9.638422e-01 -0.26647381
[72,] -9.788024e-01 -0.20480667
[73,] -9.898214e-01 -0.14231484
[74,] -9.968548e-01 -0.07924996
[75,] -9.998741e-01 -0.01586596
[76,] -9.988673e-01 0.04758192
[77,] -9.938385e-01 0.11083820
[78,] -9.848078e-01 0.17364818
[79,] -9.718116e-01 0.23575894
[80,] -9.549022e-01 0.29692038
[81,] -9.341479e-01 0.35688622
[82,] -9.096320e-01 0.41541501
[83,] -8.814534e-01 0.47227107
[84,] -8.497254e-01 0.52722547
[85,] -8.145760e-01 0.58005691
[86,] -7.761465e-01 0.63055267
[87,] -7.345917e-01 0.67850941
[88,] -6.900790e-01 0.72373404
[89,] -6.427876e-01 0.76604444
[90,] -5.929079e-01 0.80527026
[91,] -5.406408e-01 0.84125353
[92,] -4.861967e-01 0.87384938
[93,] -4.297949e-01 0.90292654
[94,] -3.716625e-01 0.92836793
[95,] -3.120334e-01 0.95007112
[96,] -2.511480e-01 0.96794870
[97,] -1.892512e-01 0.98192870
[98,] -1.265925e-01 0.99195481
[99,] -6.342392e-02 0.99798668
[100,] -2.449294e-16 1.00000000
Command:
> library(viridis)
> viridis(length(t))
Result:
[1] "#440154FF" "#450558FF" "#46085CFF" "#470D60FF" "#471063FF" "#481467FF"
[7] "#481769FF" "#481B6DFF" "#481E70FF" "#482173FF" "#482576FF" "#482878FF"
[13] "#472C7AFF" "#472F7CFF" "#46327EFF" "#453581FF" "#453882FF" "#443B84FF"
[19] "#433E85FF" "#424186FF" "#404587FF" "#3F4788FF" "#3E4A89FF" "#3D4D8AFF"
[25] "#3C508BFF" "#3B528BFF" "#39558CFF" "#38598CFF" "#375B8DFF" "#355E8DFF"
[31] "#34608DFF" "#33638DFF" "#32658EFF" "#31688EFF" "#2F6B8EFF" "#2E6D8EFF"
[37] "#2D708EFF" "#2C718EFF" "#2B748EFF" "#2A768EFF" "#29798EFF" "#287C8EFF"
[43] "#277E8EFF" "#26818EFF" "#26828EFF" "#25858EFF" "#24878EFF" "#238A8DFF"
[49] "#228D8DFF" "#218F8DFF" "#20928CFF" "#20938CFF" "#1F968BFF" "#1F998AFF"
[55] "#1E9B8AFF" "#1F9E89FF" "#1FA088FF" "#1FA287FF" "#20A486FF" "#22A785FF"
[61] "#24AA83FF" "#25AC82FF" "#28AE80FF" "#2BB07FFF" "#2EB37CFF" "#31B67BFF"
[67] "#35B779FF" "#39BA76FF" "#3DBC74FF" "#41BE71FF" "#47C06FFF" "#4CC26CFF"
[73] "#51C56AFF" "#56C667FF" "#5BC863FF" "#61CA60FF" "#67CC5CFF" "#6DCD59FF"
[79] "#73D056FF" "#78D152FF" "#7FD34EFF" "#85D54AFF" "#8CD646FF" "#92D741FF"
[85] "#99D83DFF" "#A0DA39FF" "#A7DB35FF" "#ADDC30FF" "#B4DE2CFF" "#BBDE28FF"
[91] "#C2DF23FF" "#C9E020FF" "#D0E11CFF" "#D7E219FF" "#DDE318FF" "#E4E419FF"
[97] "#EBE51AFF" "#F1E51DFF" "#F7E620FF" "#FDE725FF"
> plot(x,col=viridis(length(t)),pch=20)
Result:
R (programming language) Viridis Color Map Example |