import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
font = FontProperties(fname="../../simhei.ttf")
%matplotlib inline
x = np.linspace(0,100,1000)
x
array([ 0. , 0.1001001 , 0.2002002 , 0.3003003 , 0.4004004 , 0.5005005 , 0.6006006 , 0.7007007 , 0.8008008 , 0.9009009 , 1.001001 , 1.1011011 , 1.2012012 , 1.3013013 , 1.4014014 , 1.5015015 , 1.6016016 , 1.7017017 , 1.8018018 , 1.9019019 , 2.002002 , 2.1021021 , 2.2022022 , 2.3023023 , 2.4024024 , 2.5025025 , 2.6026026 , 2.7027027 , 2.8028028 , 2.9029029 , 3.003003 , 3.1031031 , 3.2032032 , 3.3033033 , 3.4034034 , 3.5035035 , 3.6036036 , 3.7037037 , 3.8038038 , 3.9039039 , 4.004004 , 4.1041041 , 4.2042042 , 4.3043043 , 4.4044044 , 4.5045045 , 4.6046046 , 4.7047047 , 4.8048048 , 4.9049049 , 5.00500501, 5.10510511, 5.20520521, 5.30530531, 5.40540541, 5.50550551, 5.60560561, 5.70570571, 5.80580581, 5.90590591, 6.00600601, 6.10610611, 6.20620621, 6.30630631, 6.40640641, 6.50650651, 6.60660661, 6.70670671, 6.80680681, 6.90690691, 7.00700701, 7.10710711, 7.20720721, 7.30730731, 7.40740741, 7.50750751, 7.60760761, 7.70770771, 7.80780781, 7.90790791, 8.00800801, 8.10810811, 8.20820821, 8.30830831, 8.40840841, 8.50850851, 8.60860861, 8.70870871, 8.80880881, 8.90890891, 9.00900901, 9.10910911, 9.20920921, 9.30930931, 9.40940941, 9.50950951, 9.60960961, 9.70970971, 9.80980981, 9.90990991, 10.01001001, 10.11011011, 10.21021021, 10.31031031, 10.41041041, 10.51051051, 10.61061061, 10.71071071, 10.81081081, 10.91091091, 11.01101101, 11.11111111, 11.21121121, 11.31131131, 11.41141141, 11.51151151, 11.61161161, 11.71171171, 11.81181181, 11.91191191, 12.01201201, 12.11211211, 12.21221221, 12.31231231, 12.41241241, 12.51251251, 12.61261261, 12.71271271, 12.81281281, 12.91291291, 13.01301301, 13.11311311, 13.21321321, 13.31331331, 13.41341341, 13.51351351, 13.61361361, 13.71371371, 13.81381381, 13.91391391, 14.01401401, 14.11411411, 14.21421421, 14.31431431, 14.41441441, 14.51451451, 14.61461461, 14.71471471, 14.81481481, 14.91491491, 15.01501502, 15.11511512, 15.21521522, 15.31531532, 15.41541542, 15.51551552, 15.61561562, 15.71571572, 15.81581582, 15.91591592, 16.01601602, 16.11611612, 16.21621622, 16.31631632, 16.41641642, 16.51651652, 16.61661662, 16.71671672, 16.81681682, 16.91691692, 17.01701702, 17.11711712, 17.21721722, 17.31731732, 17.41741742, 17.51751752, 17.61761762, 17.71771772, 17.81781782, 17.91791792, 18.01801802, 18.11811812, 18.21821822, 18.31831832, 18.41841842, 18.51851852, 18.61861862, 18.71871872, 18.81881882, 18.91891892, 19.01901902, 19.11911912, 19.21921922, 19.31931932, 19.41941942, 19.51951952, 19.61961962, 19.71971972, 19.81981982, 19.91991992, 20.02002002, 20.12012012, 20.22022022, 20.32032032, 20.42042042, 20.52052052, 20.62062062, 20.72072072, 20.82082082, 20.92092092, 21.02102102, 21.12112112, 21.22122122, 21.32132132, 21.42142142, 21.52152152, 21.62162162, 21.72172172, 21.82182182, 21.92192192, 22.02202202, 22.12212212, 22.22222222, 22.32232232, 22.42242242, 22.52252252, 22.62262262, 22.72272272, 22.82282282, 22.92292292, 23.02302302, 23.12312312, 23.22322322, 23.32332332, 23.42342342, 23.52352352, 23.62362362, 23.72372372, 23.82382382, 23.92392392, 24.02402402, 24.12412412, 24.22422422, 24.32432432, 24.42442442, 24.52452452, 24.62462462, 24.72472472, 24.82482482, 24.92492492, 25.02502503, 25.12512513, 25.22522523, 25.32532533, 25.42542543, 25.52552553, 25.62562563, 25.72572573, 25.82582583, 25.92592593, 26.02602603, 26.12612613, 26.22622623, 26.32632633, 26.42642643, 26.52652653, 26.62662663, 26.72672673, 26.82682683, 26.92692693, 27.02702703, 27.12712713, 27.22722723, 27.32732733, 27.42742743, 27.52752753, 27.62762763, 27.72772773, 27.82782783, 27.92792793, 28.02802803, 28.12812813, 28.22822823, 28.32832833, 28.42842843, 28.52852853, 28.62862863, 28.72872873, 28.82882883, 28.92892893, 29.02902903, 29.12912913, 29.22922923, 29.32932933, 29.42942943, 29.52952953, 29.62962963, 29.72972973, 29.82982983, 29.92992993, 30.03003003, 30.13013013, 30.23023023, 30.33033033, 30.43043043, 30.53053053, 30.63063063, 30.73073073, 30.83083083, 30.93093093, 31.03103103, 31.13113113, 31.23123123, 31.33133133, 31.43143143, 31.53153153, 31.63163163, 31.73173173, 31.83183183, 31.93193193, 32.03203203, 32.13213213, 32.23223223, 32.33233233, 32.43243243, 32.53253253, 32.63263263, 32.73273273, 32.83283283, 32.93293293, 33.03303303, 33.13313313, 33.23323323, 33.33333333, 33.43343343, 33.53353353, 33.63363363, 33.73373373, 33.83383383, 33.93393393, 34.03403403, 34.13413413, 34.23423423, 34.33433433, 34.43443443, 34.53453453, 34.63463463, 34.73473473, 34.83483483, 34.93493493, 35.03503504, 35.13513514, 35.23523524, 35.33533534, 35.43543544, 35.53553554, 35.63563564, 35.73573574, 35.83583584, 35.93593594, 36.03603604, 36.13613614, 36.23623624, 36.33633634, 36.43643644, 36.53653654, 36.63663664, 36.73673674, 36.83683684, 36.93693694, 37.03703704, 37.13713714, 37.23723724, 37.33733734, 37.43743744, 37.53753754, 37.63763764, 37.73773774, 37.83783784, 37.93793794, 38.03803804, 38.13813814, 38.23823824, 38.33833834, 38.43843844, 38.53853854, 38.63863864, 38.73873874, 38.83883884, 38.93893894, 39.03903904, 39.13913914, 39.23923924, 39.33933934, 39.43943944, 39.53953954, 39.63963964, 39.73973974, 39.83983984, 39.93993994, 40.04004004, 40.14014014, 40.24024024, 40.34034034, 40.44044044, 40.54054054, 40.64064064, 40.74074074, 40.84084084, 40.94094094, 41.04104104, 41.14114114, 41.24124124, 41.34134134, 41.44144144, 41.54154154, 41.64164164, 41.74174174, 41.84184184, 41.94194194, 42.04204204, 42.14214214, 42.24224224, 42.34234234, 42.44244244, 42.54254254, 42.64264264, 42.74274274, 42.84284284, 42.94294294, 43.04304304, 43.14314314, 43.24324324, 43.34334334, 43.44344344, 43.54354354, 43.64364364, 43.74374374, 43.84384384, 43.94394394, 44.04404404, 44.14414414, 44.24424424, 44.34434434, 44.44444444, 44.54454454, 44.64464464, 44.74474474, 44.84484484, 44.94494494, 45.04504505, 45.14514515, 45.24524525, 45.34534535, 45.44544545, 45.54554555, 45.64564565, 45.74574575, 45.84584585, 45.94594595, 46.04604605, 46.14614615, 46.24624625, 46.34634635, 46.44644645, 46.54654655, 46.64664665, 46.74674675, 46.84684685, 46.94694695, 47.04704705, 47.14714715, 47.24724725, 47.34734735, 47.44744745, 47.54754755, 47.64764765, 47.74774775, 47.84784785, 47.94794795, 48.04804805, 48.14814815, 48.24824825, 48.34834835, 48.44844845, 48.54854855, 48.64864865, 48.74874875, 48.84884885, 48.94894895, 49.04904905, 49.14914915, 49.24924925, 49.34934935, 49.44944945, 49.54954955, 49.64964965, 49.74974975, 49.84984985, 49.94994995, 50.05005005, 50.15015015, 50.25025025, 50.35035035, 50.45045045, 50.55055055, 50.65065065, 50.75075075, 50.85085085, 50.95095095, 51.05105105, 51.15115115, 51.25125125, 51.35135135, 51.45145145, 51.55155155, 51.65165165, 51.75175175, 51.85185185, 51.95195195, 52.05205205, 52.15215215, 52.25225225, 52.35235235, 52.45245245, 52.55255255, 52.65265265, 52.75275275, 52.85285285, 52.95295295, 53.05305305, 53.15315315, 53.25325325, 53.35335335, 53.45345345, 53.55355355, 53.65365365, 53.75375375, 53.85385385, 53.95395395, 54.05405405, 54.15415415, 54.25425425, 54.35435435, 54.45445445, 54.55455455, 54.65465465, 54.75475475, 54.85485485, 54.95495495, 55.05505506, 55.15515516, 55.25525526, 55.35535536, 55.45545546, 55.55555556, 55.65565566, 55.75575576, 55.85585586, 55.95595596, 56.05605606, 56.15615616, 56.25625626, 56.35635636, 56.45645646, 56.55655656, 56.65665666, 56.75675676, 56.85685686, 56.95695696, 57.05705706, 57.15715716, 57.25725726, 57.35735736, 57.45745746, 57.55755756, 57.65765766, 57.75775776, 57.85785786, 57.95795796, 58.05805806, 58.15815816, 58.25825826, 58.35835836, 58.45845846, 58.55855856, 58.65865866, 58.75875876, 58.85885886, 58.95895896, 59.05905906, 59.15915916, 59.25925926, 59.35935936, 59.45945946, 59.55955956, 59.65965966, 59.75975976, 59.85985986, 59.95995996, 60.06006006, 60.16016016, 60.26026026, 60.36036036, 60.46046046, 60.56056056, 60.66066066, 60.76076076, 60.86086086, 60.96096096, 61.06106106, 61.16116116, 61.26126126, 61.36136136, 61.46146146, 61.56156156, 61.66166166, 61.76176176, 61.86186186, 61.96196196, 62.06206206, 62.16216216, 62.26226226, 62.36236236, 62.46246246, 62.56256256, 62.66266266, 62.76276276, 62.86286286, 62.96296296, 63.06306306, 63.16316316, 63.26326326, 63.36336336, 63.46346346, 63.56356356, 63.66366366, 63.76376376, 63.86386386, 63.96396396, 64.06406406, 64.16416416, 64.26426426, 64.36436436, 64.46446446, 64.56456456, 64.66466466, 64.76476476, 64.86486486, 64.96496496, 65.06506507, 65.16516517, 65.26526527, 65.36536537, 65.46546547, 65.56556557, 65.66566567, 65.76576577, 65.86586587, 65.96596597, 66.06606607, 66.16616617, 66.26626627, 66.36636637, 66.46646647, 66.56656657, 66.66666667, 66.76676677, 66.86686687, 66.96696697, 67.06706707, 67.16716717, 67.26726727, 67.36736737, 67.46746747, 67.56756757, 67.66766767, 67.76776777, 67.86786787, 67.96796797, 68.06806807, 68.16816817, 68.26826827, 68.36836837, 68.46846847, 68.56856857, 68.66866867, 68.76876877, 68.86886887, 68.96896897, 69.06906907, 69.16916917, 69.26926927, 69.36936937, 69.46946947, 69.56956957, 69.66966967, 69.76976977, 69.86986987, 69.96996997, 70.07007007, 70.17017017, 70.27027027, 70.37037037, 70.47047047, 70.57057057, 70.67067067, 70.77077077, 70.87087087, 70.97097097, 71.07107107, 71.17117117, 71.27127127, 71.37137137, 71.47147147, 71.57157157, 71.67167167, 71.77177177, 71.87187187, 71.97197197, 72.07207207, 72.17217217, 72.27227227, 72.37237237, 72.47247247, 72.57257257, 72.67267267, 72.77277277, 72.87287287, 72.97297297, 73.07307307, 73.17317317, 73.27327327, 73.37337337, 73.47347347, 73.57357357, 73.67367367, 73.77377377, 73.87387387, 73.97397397, 74.07407407, 74.17417417, 74.27427427, 74.37437437, 74.47447447, 74.57457457, 74.67467467, 74.77477477, 74.87487487, 74.97497497, 75.07507508, 75.17517518, 75.27527528, 75.37537538, 75.47547548, 75.57557558, 75.67567568, 75.77577578, 75.87587588, 75.97597598, 76.07607608, 76.17617618, 76.27627628, 76.37637638, 76.47647648, 76.57657658, 76.67667668, 76.77677678, 76.87687688, 76.97697698, 77.07707708, 77.17717718, 77.27727728, 77.37737738, 77.47747748, 77.57757758, 77.67767768, 77.77777778, 77.87787788, 77.97797798, 78.07807808, 78.17817818, 78.27827828, 78.37837838, 78.47847848, 78.57857858, 78.67867868, 78.77877878, 78.87887888, 78.97897898, 79.07907908, 79.17917918, 79.27927928, 79.37937938, 79.47947948, 79.57957958, 79.67967968, 79.77977978, 79.87987988, 79.97997998, 80.08008008, 80.18018018, 80.28028028, 80.38038038, 80.48048048, 80.58058058, 80.68068068, 80.78078078, 80.88088088, 80.98098098, 81.08108108, 81.18118118, 81.28128128, 81.38138138, 81.48148148, 81.58158158, 81.68168168, 81.78178178, 81.88188188, 81.98198198, 82.08208208, 82.18218218, 82.28228228, 82.38238238, 82.48248248, 82.58258258, 82.68268268, 82.78278278, 82.88288288, 82.98298298, 83.08308308, 83.18318318, 83.28328328, 83.38338338, 83.48348348, 83.58358358, 83.68368368, 83.78378378, 83.88388388, 83.98398398, 84.08408408, 84.18418418, 84.28428428, 84.38438438, 84.48448448, 84.58458458, 84.68468468, 84.78478478, 84.88488488, 84.98498498, 85.08508509, 85.18518519, 85.28528529, 85.38538539, 85.48548549, 85.58558559, 85.68568569, 85.78578579, 85.88588589, 85.98598599, 86.08608609, 86.18618619, 86.28628629, 86.38638639, 86.48648649, 86.58658659, 86.68668669, 86.78678679, 86.88688689, 86.98698699, 87.08708709, 87.18718719, 87.28728729, 87.38738739, 87.48748749, 87.58758759, 87.68768769, 87.78778779, 87.88788789, 87.98798799, 88.08808809, 88.18818819, 88.28828829, 88.38838839, 88.48848849, 88.58858859, 88.68868869, 88.78878879, 88.88888889, 88.98898899, 89.08908909, 89.18918919, 89.28928929, 89.38938939, 89.48948949, 89.58958959, 89.68968969, 89.78978979, 89.88988989, 89.98998999, 90.09009009, 90.19019019, 90.29029029, 90.39039039, 90.49049049, 90.59059059, 90.69069069, 90.79079079, 90.89089089, 90.99099099, 91.09109109, 91.19119119, 91.29129129, 91.39139139, 91.49149149, 91.59159159, 91.69169169, 91.79179179, 91.89189189, 91.99199199, 92.09209209, 92.19219219, 92.29229229, 92.39239239, 92.49249249, 92.59259259, 92.69269269, 92.79279279, 92.89289289, 92.99299299, 93.09309309, 93.19319319, 93.29329329, 93.39339339, 93.49349349, 93.59359359, 93.69369369, 93.79379379, 93.89389389, 93.99399399, 94.09409409, 94.19419419, 94.29429429, 94.39439439, 94.49449449, 94.59459459, 94.69469469, 94.79479479, 94.89489489, 94.99499499, 95.0950951 , 95.1951952 , 95.2952953 , 95.3953954 , 95.4954955 , 95.5955956 , 95.6956957 , 95.7957958 , 95.8958959 , 95.995996 , 96.0960961 , 96.1961962 , 96.2962963 , 96.3963964 , 96.4964965 , 96.5965966 , 96.6966967 , 96.7967968 , 96.8968969 , 96.996997 , 97.0970971 , 97.1971972 , 97.2972973 , 97.3973974 , 97.4974975 , 97.5975976 , 97.6976977 , 97.7977978 , 97.8978979 , 97.997998 , 98.0980981 , 98.1981982 , 98.2982983 , 98.3983984 , 98.4984985 , 98.5985986 , 98.6986987 , 98.7987988 , 98.8988989 , 98.998999 , 99.0990991 , 99.1991992 , 99.2992993 , 99.3993994 , 99.4994995 , 99.5995996 , 99.6996997 , 99.7997998 , 99.8998999 , 100. ])
y = np.sin(x)
y
array([ 0.00000000e+00, 9.99330162e-02, 1.98865536e-01, 2.95807081e-01, 3.89787104e-01, 4.79864709e-01, 5.65138069e-01, 6.44753455e-01, 7.17913784e-01, 7.83886601e-01, 8.42011406e-01, 8.91706275e-01, 9.32473678e-01, 9.63905466e-01, 9.85686954e-01, 9.97600074e-01, 9.99525555e-01, 9.91444120e-01, 9.73436677e-01, 9.45683512e-01, 9.08462478e-01, 8.62146222e-01, 8.07198446e-01, 7.44169268e-01, 6.73689717e-01, 5.96465408e-01, 5.13269488e-01, 4.24934884e-01, 3.32345974e-01, 2.36429728e-01, 1.38146426e-01, 3.84800478e-02, -6.15715795e-02, -1.61006773e-01, -2.58830020e-01, -3.54061947e-01, -4.45749125e-01, -5.32973611e-01, -6.14862143e-01, -6.90594881e-01, -7.59413613e-01, -8.20629350e-01, -8.73629220e-01, -9.17882606e-01, -9.52946458e-01, -9.78469728e-01, -9.94196886e-01, -9.99970476e-01, -9.95732696e-01, -9.81525973e-01, -9.57492539e-01, -9.23873010e-01, -8.81003973e-01, -8.29314618e-01, -7.69322443e-01, -7.01628067e-01, -6.26909226e-01, -5.45913979e-01, -4.59453224e-01, -3.68392576e-01, -2.73643705e-01, -1.76155204e-01, -7.69030966e-02, 2.31189392e-02, 1.22909516e-01, 2.21469563e-01, 3.17812332e-01, 4.10973269e-01, 5.00019679e-01, 5.84060060e-01, 6.62253026e-01, 7.33815735e-01, 7.98031727e-01, 8.54258091e-01, 9.01931909e-01, 9.40575886e-01, 9.69803131e-01, 9.89321030e-01, 9.98934178e-01, 9.98546331e-01, 9.88161371e-01, 9.67883269e-01, 9.37915044e-01, 8.98556726e-01, 8.50202358e-01, 7.93336048e-01, 7.28527123e-01, 6.56424427e-01, 5.77749829e-01, 4.93290992e-01, 4.03893491e-01, 3.10452344e-01, 2.13903051e-01, 1.15212232e-01, 1.53679464e-02, -8.46301977e-02, -1.83781052e-01, -2.81091953e-01, -3.75588654e-01, -4.66325087e-01, -5.52392830e-01, -6.32930199e-01, -7.07130883e-01, -7.74252009e-01, -8.33621582e-01, -8.84645214e-01, -9.26812074e-01, -9.59700000e-01, -9.82979731e-01, -9.96418197e-01, -9.99880856e-01, -9.93333042e-01, -9.76840310e-01, -9.50567779e-01, -9.14778480e-01, -8.69830725e-01, -8.16174515e-01, -7.54347038e-01, -6.84967290e-01, -6.08729879e-01, -5.26398068e-01, -4.38796135e-01, -3.46801121e-01, -2.51334050e-01, -1.53350707e-01, -5.38320680e-02, 4.62255200e-02, 1.45820313e-01, 2.43955203e-01, 3.39647694e-01, 4.31939746e-01, 5.19907361e-01, 6.02669837e-01, 6.79398585e-01, 7.49325420e-01, 8.11750260e-01, 8.66048127e-01, 9.11675409e-01, 9.48175302e-01, 9.75182380e-01, 9.92426258e-01, 9.99734295e-01, 9.97033327e-01, 9.84350394e-01, 9.61812473e-01, 9.29645207e-01, 8.88170644e-01, 8.37804012e-01, 7.79049567e-01, 7.12495538e-01, 6.38808241e-01, 5.58725409e-01, 4.73048805e-01, 3.82636195e-01, 2.88392758e-01, 1.91262030e-01, 9.22164501e-02, -7.75237011e-03, -1.07643576e-01, -2.06457091e-01, -3.03203626e-01, -3.96914588e-01, -4.86651773e-01, -5.71516763e-01, -6.50659918e-01, -7.23288884e-01, -7.88676523e-01, -8.46168195e-01, -8.95188314e-01, -9.35246107e-01, -9.65940528e-01, -9.86964275e-01, -9.98106866e-01, -9.99256743e-01, -9.90402396e-01, -9.71632471e-01, -9.43134885e-01, -9.05194949e-01, -8.58192502e-01, -8.02598119e-01, -7.38968392e-01, -6.67940360e-01, -5.90225132e-01, -5.06600767e-01, -4.17904484e-01, -3.25024281e-01, -2.28890044e-01, -1.30464236e-01, -3.07322630e-02, 6.93073906e-02, 1.68653162e-01, 2.66310434e-01, 3.61301495e-01, 4.52675326e-01, 5.39517122e-01, 6.20957454e-01, 6.96180967e-01, 7.64434548e-01, 8.25034866e-01, 8.77375211e-01, 9.20931567e-01, 9.55267865e-01, 9.80040339e-01, 9.95000977e-01, 9.99999998e-01, 9.94987352e-01, 9.80013225e-01, 9.55227533e-01, 9.20878422e-01, 8.77309784e-01, 8.24957813e-01, 7.64346640e-01, 6.96083083e-01, 6.20850576e-01, 5.39402319e-01, 4.52553747e-01, 3.61174357e-01, 2.66179011e-01, 1.68518769e-01, 6.91713736e-02, -3.08685425e-02, -1.30599413e-01, -2.29022766e-01, -3.25153219e-01, -4.18028347e-01, -5.06718315e-01, -5.90335188e-01, -6.68041823e-01, -7.39060246e-01, -8.02679444e-01, -8.58262484e-01, -9.05252886e-01, -9.43180199e-01, -9.71664706e-01, -9.90421231e-01, -9.99261990e-01, -9.98098471e-01, -9.86942323e-01, -9.65905238e-01, -9.35197833e-01, -8.95127539e-01, -8.46095527e-01, -7.88592690e-01, -7.23194725e-01, -6.50556377e-01, -5.71404875e-01, -4.86532659e-01, -3.96789440e-01, -3.03073697e-01, -2.06323682e-01, -1.07508023e-01, -7.61602996e-03, 9.23522125e-02, 1.91395855e-01, 2.88523307e-01, 3.82762159e-01, 4.73168925e-01, 5.58838481e-01, 6.38913133e-01, 7.12591201e-01, 7.79135042e-01, 8.37878445e-01, 8.88233287e-01, 9.29695435e-01, 9.61849783e-01, 9.84374411e-01, 9.97043812e-01, 9.99731143e-01, 9.92409500e-01, 9.75152184e-01, 9.48131970e-01, 9.11619376e-01, 8.65979952e-01, 8.11670627e-01, 7.49235126e-01, 6.79298533e-01, 6.02561030e-01, 5.19790888e-01, 4.31816772e-01, 3.39519452e-01, 2.43822976e-01, 1.45685425e-01, 4.60893211e-02, -5.39682139e-02, -1.53485437e-01, -2.51466016e-01, -3.46929000e-01, -4.38918647e-01, -5.26513988e-01, -6.08838046e-01, -6.85066621e-01, -7.54436537e-01, -8.16253287e-01, -8.69897982e-01, -9.14833549e-01, -9.50610107e-01, -9.76869474e-01, -9.93348751e-01, -9.99882951e-01, -9.96406658e-01, -9.82954673e-01, -9.59661675e-01, -9.26760864e-01, -8.84581633e-01, -8.33546266e-01, -7.74165712e-01, -7.07034470e-01, -6.32824635e-01, -5.52279170e-01, -4.66204471e-01, -3.75462289e-01, -2.80961103e-01, -1.83647029e-01, -8.44943419e-02, 1.55042743e-02, 1.15347667e-01, 2.14036237e-01, 3.10581948e-01, 4.04018216e-01, 4.93409589e-01, 5.77861109e-01, 6.56527278e-01, 7.28620514e-01, 7.93419045e-01, 8.50274129e-01, 8.98616553e-01, 9.37962328e-01, 9.67917537e-01, 9.88182279e-01, 9.98553671e-01, 9.98927876e-01, 9.89301149e-01, 9.69769869e-01, 9.40529577e-01, 9.01873017e-01, 8.54187205e-01, 7.97949556e-01, 7.33723103e-01, 6.62150859e-01, 5.83949382e-01, 4.99901599e-01, 4.10848968e-01, 3.17683054e-01, 2.21336603e-01, 1.22774204e-01, 2.29826312e-02, -7.70390363e-02, -1.76289415e-01, -2.73774842e-01, -3.68519328e-01, -4.59574321e-01, -5.46028209e-01, -6.27015445e-01, -7.01725212e-01, -7.69409540e-01, -8.29390797e-01, -8.81068471e-01, -9.23925181e-01, -9.57531860e-01, -9.81552050e-01, -9.95745269e-01, -9.99969419e-01, -9.94182209e-01, -9.78441579e-01, -9.52905118e-01, -9.17828489e-01, -8.73562868e-01, -8.20551427e-01, -7.59324900e-01, -6.90496265e-01, -6.14754612e-01, -5.32858241e-01, -4.45627071e-01, -3.53934432e-01, -2.58698320e-01, -1.60872206e-01, -6.14354935e-02, 3.86162907e-02, 1.38281461e-01, 2.36562204e-01, 3.32474565e-01, 4.25058302e-01, 5.13386497e-01, 5.96574838e-01, 6.73790471e-01, 7.44260338e-01, 8.07278920e-01, 8.62215294e-01, 9.08519457e-01, 9.45727827e-01, 9.73467885e-01, 9.91461908e-01, 9.99529745e-01, 9.97590624e-01, 9.85663960e-01, 9.63869156e-01, 9.32424417e-01, 8.91644555e-01, 8.41937846e-01, 7.83801937e-01, 7.17818864e-01, 6.44649228e-01, 5.65025580e-01, 4.79745084e-01, 3.89661541e-01, 2.95676836e-01, 1.98731914e-01, 9.97973536e-02, -1.36344173e-04, -1.00068677e-01, -1.98999155e-01, -2.95937321e-01, -3.89912661e-01, -4.79984325e-01, -5.65250547e-01, -6.44857669e-01, -7.18008691e-01, -7.83971250e-01, -8.42084951e-01, -8.91767978e-01, -9.32522922e-01, -9.63941758e-01, -9.85709931e-01, -9.97609505e-01, -9.99521346e-01, -9.91426313e-01, -9.73405451e-01, -9.45639179e-01, -9.08405483e-01, -8.62077134e-01, -8.07117957e-01, -7.44078185e-01, -6.73588950e-01, -5.96355968e-01, -5.13152468e-01, -4.24811458e-01, -3.32217377e-01, -2.36297247e-01, -1.38011388e-01, -3.83438043e-02, 6.17076644e-02, 1.61141337e-01, 2.58961716e-01, 3.54189456e-01, 4.45871170e-01, 5.33088971e-01, 6.14969663e-01, 6.90693484e-01, 7.59502313e-01, 8.20707258e-01, 8.73695556e-01, 9.17936706e-01, 9.52987780e-01, 9.78497859e-01, 9.94211544e-01, 9.99971515e-01, 9.95720104e-01, 9.81499877e-01, 9.57453201e-01, 9.23820823e-01, 8.80939459e-01, 8.29238424e-01, 7.69235330e-01, 7.01530910e-01, 6.26802996e-01, 5.45799739e-01, 4.59332118e-01, 3.68265817e-01, 2.73512562e-01, 1.76020991e-01, 7.67671555e-02, -2.32552467e-02, -1.23044825e-01, -2.21602520e-01, -3.17941604e-01, -4.11097563e-01, -5.00137751e-01, -5.84170726e-01, -6.62355179e-01, -7.33908354e-01, -7.98113883e-01, -8.54328962e-01, -9.01990785e-01, -9.40622177e-01, -9.69836374e-01, -9.89340894e-01, -9.98940462e-01, -9.98538973e-01, -9.88140444e-01, -9.67848983e-01, -9.37867742e-01, -8.98496882e-01, -8.50130571e-01, -7.93253037e-01, -7.28433718e-01, -6.56321564e-01, -5.77638537e-01, -4.93172387e-01, -4.03768759e-01, -3.10322733e-01, -2.13769860e-01, -1.15076794e-01, -1.52316182e-02, 8.47660519e-02, 1.83915073e-01, 2.81222797e-01, 3.75715013e-01, 4.66445695e-01, 5.52506479e-01, 6.33035752e-01, 7.07227283e-01, 7.74338291e-01, 8.33696882e-01, 8.84708778e-01, 9.26863266e-01, 9.59738308e-01, 9.83004770e-01, 9.96429717e-01, 9.99878742e-01, 9.93317315e-01, 9.76811127e-01, 9.50525433e-01, 9.14723394e-01, 8.69763451e-01, 8.16095727e-01, 7.54257524e-01, 6.84867947e-01, 6.08621701e-01, 5.26282138e-01, 4.38673613e-01, 3.46673235e-01, 2.51202080e-01, 1.53215974e-01, 5.36959210e-02, -4.63617180e-02, -1.45955199e-01, -2.44087425e-01, -3.39775929e-01, -4.32062711e-01, -5.20023824e-01, -6.02778633e-01, -6.79498624e-01, -7.49415701e-01, -8.11829878e-01, -8.66116286e-01, -9.11731426e-01, -9.48218616e-01, -9.75212558e-01, -9.92442997e-01, -9.99737429e-01, -9.97022823e-01, -9.84326358e-01, -9.61775145e-01, -9.29594962e-01, -8.88107983e-01, -8.37729565e-01, -7.78964077e-01, -7.12399861e-01, -6.38703336e-01, -5.58612327e-01, -4.72928677e-01, -3.82510223e-01, -2.88262205e-01, -1.91128201e-01, -9.20806861e-02, 7.88871012e-03, 1.07779127e-01, 2.06590496e-01, 3.03333549e-01, 3.97039728e-01, 4.86770878e-01, 5.71628641e-01, 6.50763448e-01, 7.23383029e-01, 7.88760341e-01, 8.46240847e-01, 8.95249073e-01, 9.35294364e-01, 9.65975800e-01, 9.86986209e-01, 9.98115242e-01, 9.99251478e-01, 9.90383542e-01, 9.71600217e-01, 9.43089554e-01, 9.05136994e-01, 8.58122505e-01, 8.02516780e-01, 7.38876524e-01, 6.67838884e-01, 5.90115064e-01, 5.06483209e-01, 4.17780613e-01, 3.24895337e-01, 2.28757317e-01, 1.30329055e-01, 3.05959830e-02, -6.94434063e-02, -1.68787551e-01, -2.66441852e-01, -3.61428625e-01, -4.52796896e-01, -5.39631916e-01, -6.21064321e-01, -6.96278837e-01, -7.64522442e-01, -8.25111904e-01, -8.77440621e-01, -9.20984695e-01, -9.55308179e-01, -9.80067435e-01, -9.95014584e-01, -9.99999979e-01, -9.94973708e-01, -9.79986093e-01, -9.55187184e-01, -9.20825260e-01, -8.77244341e-01, -8.24880744e-01, -7.64258717e-01, -6.95985187e-01, -6.20743686e-01, -5.39287506e-01, -4.52432159e-01, -3.61047213e-01, -2.66047583e-01, -1.68384373e-01, -6.90353554e-02, 3.10048214e-02, 1.30734588e-01, 2.29155484e-01, 3.25282152e-01, 4.18152203e-01, 5.06835854e-01, 5.90445234e-01, 6.68143274e-01, 7.39152085e-01, 8.02760754e-01, 8.58332449e-01, 9.05310807e-01, 9.43225495e-01, 9.71696924e-01, 9.90440048e-01, 9.99267218e-01, 9.98090057e-01, 9.86920352e-01, 9.65869930e-01, 9.35149541e-01, 8.95066747e-01, 8.46022844e-01, 7.88508842e-01, 7.23100553e-01, 6.50452823e-01, 5.71292976e-01, 4.86413535e-01, 3.96664284e-01, 3.02943763e-01, 2.06190270e-01, 1.07372468e-01, 7.47968968e-03, -9.24879731e-02, -1.91529677e-01, -2.88653850e-01, -3.82888117e-01, -4.73289036e-01, -5.58951543e-01, -6.39018014e-01, -7.12686850e-01, -7.79220503e-01, -8.37952861e-01, -8.88295915e-01, -9.29745646e-01, -9.61887075e-01, -9.84398411e-01, -9.97054279e-01, -9.99727973e-01, -9.92392723e-01, -9.75121970e-01, -9.48088621e-01, -9.11563325e-01, -8.65911761e-01, -8.11590978e-01, -7.49144818e-01, -6.79198469e-01, -6.02452212e-01, -5.19674405e-01, -4.31693791e-01, -3.39391203e-01, -2.43690744e-01, -1.45550534e-01, -4.59531214e-02, 5.41043589e-02, 1.53620164e-01, 2.51597976e-01, 3.47056873e-01, 4.39041152e-01, 5.26629898e-01, 6.08946201e-01, 6.85165939e-01, 7.54526023e-01, 8.16332045e-01, 8.69965223e-01, 9.14888600e-01, 9.50652418e-01, 9.76898621e-01, 9.93364441e-01, 9.99885028e-01, 9.96395100e-01, 9.82929598e-01, 9.59623332e-01, 9.26709638e-01, 8.84518036e-01, 8.33470935e-01, 7.74079402e-01, 7.06938044e-01, 6.32719058e-01, 5.52165501e-01, 4.66083846e-01, 3.75335916e-01, 2.80830248e-01, 1.83513002e-01, 8.43584845e-02, -1.56406019e-02, -1.15483100e-01, -2.14169420e-01, -3.10711547e-01, -4.04142933e-01, -4.93528176e-01, -5.77972379e-01, -6.56630116e-01, -7.28713892e-01, -7.93502027e-01, -8.50345885e-01, -8.98676364e-01, -9.38009595e-01, -9.67951787e-01, -9.88203170e-01, -9.98560992e-01, -9.98921555e-01, -9.89281248e-01, -9.69736589e-01, -9.40483250e-01, -9.01814107e-01, -8.54116303e-01, -7.97867371e-01, -7.33630458e-01, -6.62048681e-01, -5.83838694e-01, -4.99783509e-01, -4.10724658e-01, -3.17553770e-01, -2.21203639e-01, -1.22638890e-01, -2.28463229e-02, 7.71749745e-02, 1.76423622e-01, 2.73905975e-01, 3.68646073e-01, 4.59695409e-01, 5.46142428e-01, 6.27121652e-01, 7.01822343e-01, 7.69496624e-01, 8.29466961e-01, 8.81132952e-01, 9.23977334e-01, 9.57571163e-01, 9.81578110e-01, 9.95757824e-01, 9.99968344e-01, 9.94167514e-01, 9.78413411e-01, 9.52863760e-01, 9.17774355e-01, 8.73496500e-01, 8.20473489e-01, 7.59236172e-01, 6.90397636e-01, 6.14647069e-01, 5.32742861e-01, 4.45505009e-01, 3.53806910e-01, 2.58566614e-01, 1.60737636e-01, 6.12994063e-02, -3.87525328e-02, -1.38416494e-01, -2.36694676e-01, -3.32603150e-01, -4.25181712e-01, -5.13503497e-01, -5.96684256e-01, -6.73891212e-01, -7.44351394e-01, -8.07359378e-01, -8.62284350e-01, -9.08576419e-01, -9.45772124e-01, -9.73499075e-01, -9.91479677e-01, -9.99533917e-01, -9.97581156e-01, -9.85640946e-01, -9.63832828e-01, -9.32375138e-01, -8.91582819e-01, -8.41864271e-01, -7.83717258e-01, -7.17723930e-01, -6.44544990e-01, -5.64913081e-01, -4.79625450e-01, -3.89535970e-01, -2.95546585e-01, -1.98598287e-01, -9.96616891e-02, 2.72688344e-04, 1.00204336e-01, 1.99132771e-01, 2.96067555e-01, 3.90038210e-01, 4.80103932e-01, 5.65363014e-01, 6.44961871e-01, 7.18103585e-01, 7.84055885e-01, 8.42158479e-01, 8.91829664e-01, 9.32572149e-01, 9.63978032e-01, 9.85732889e-01, 9.97618918e-01, 9.99517119e-01, 9.91408488e-01, 9.73374207e-01, 9.45594828e-01, 9.08348470e-01, 8.62008030e-01, 8.07037453e-01, 7.43987087e-01, 6.73488171e-01, 5.96246516e-01, 5.13035440e-01, 4.24688024e-01, 3.32088774e-01, 2.36164762e-01, 1.37876347e-01, 3.82075600e-02, -6.18437482e-02, -1.61275897e-01, -2.59093406e-01, -3.54316958e-01, -4.45993207e-01, -5.33204321e-01, -6.15077172e-01, -6.90792075e-01, -7.59590998e-01, -8.20785151e-01, -8.73761876e-01, -9.17990789e-01, -9.53029085e-01, -9.78525972e-01, -9.94226183e-01, -9.99972534e-01, -9.95707494e-01, -9.81473763e-01, -9.57413845e-01, -9.23768618e-01, -8.80874929e-01, -8.29162214e-01, -7.69148204e-01, -7.01433739e-01, -6.26696753e-01, -5.45685489e-01, -4.59211004e-01, -3.68139052e-01, -2.73381415e-01, -1.75886774e-01, -7.66312129e-02, 2.33915538e-02, 1.23180132e-01, 2.21735472e-01, 3.18070870e-01, 4.11221850e-01, 5.00255813e-01, 5.84281382e-01, 6.62457321e-01, 7.34000958e-01, 7.98196023e-01, 8.54399816e-01, 9.02049644e-01, 9.40668451e-01, 9.69869600e-01, 9.89360739e-01, 9.98946728e-01, 9.98531596e-01, 9.88119499e-01, 9.67814680e-01, 9.37820423e-01, 8.98437021e-01, 8.50058768e-01, 7.93170010e-01, 7.28340299e-01, 6.56218689e-01, 5.77527235e-01, 4.93053772e-01, 4.03644019e-01, 3.10193118e-01, 2.13636666e-01, 1.14941355e-01, 1.50952897e-02, -8.49019046e-02, -1.84049089e-01, -2.81353636e-01, -3.75841364e-01, -4.66566294e-01, -5.52620118e-01, -6.33141294e-01, -7.07323670e-01, -7.74424558e-01, -8.33772166e-01, -8.84772326e-01, -9.26914440e-01, -9.59776597e-01, -9.83029791e-01, -9.96441219e-01, -9.99876610e-01, -9.93301570e-01, -9.76781927e-01, -9.50483069e-01, -9.14668292e-01, -8.69696161e-01, -8.16016923e-01, -7.54167996e-01, -6.84768591e-01, -6.08513512e-01, -5.26166198e-01, -4.38551084e-01, -3.46545343e-01, -2.51070106e-01, -1.53081239e-01, -5.35597730e-02, 4.64979151e-02, 1.46090082e-01, 2.44219643e-01, 3.39904159e-01, 4.32185668e-01, 5.20140278e-01, 6.02887418e-01, 6.79598650e-01, 7.49505967e-01, 8.11909481e-01, 8.66184428e-01, 9.11787426e-01, 9.48261913e-01, 9.75242718e-01, 9.92459719e-01, 9.99740544e-01, 9.97012301e-01, 9.84302303e-01, 9.61737800e-01, 9.29544699e-01, 8.88045307e-01, 8.37655101e-01, 7.78878573e-01, 7.12304172e-01, 6.38598420e-01, 5.58499234e-01, 4.72808539e-01, 3.82384244e-01, 2.88131645e-01, 1.90994369e-01, 9.19449203e-02, -8.02504997e-03, -1.07914676e-01, -2.06723897e-01, -3.03463466e-01, -3.97164861e-01, -4.86889974e-01, -5.71740507e-01, -6.50866965e-01, -7.23477161e-01, -7.88844144e-01, -8.46313484e-01, -8.95309815e-01, -9.35342604e-01, -9.66011054e-01, -9.87008125e-01, -9.98123600e-01, -9.99246194e-01, -9.90364670e-01, -9.71567945e-01, -9.43044206e-01, -9.05079023e-01, -8.58052492e-01, -8.02435425e-01, -7.38784643e-01, -6.67737396e-01, -5.90004985e-01, -5.06365641e-01])
plt.plot(y)
[<matplotlib.lines.Line2D at 0x1b360fe3208>]
help(plt.plot)
Help on function plot in module matplotlib.pyplot: plot(*args, scalex=True, scaley=True, data=None, **kwargs) Plot y versus x as lines and/or markers. Call signatures:: plot([x], y, [fmt], *, data=None, **kwargs) plot([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs) The coordinates of the points or line nodes are given by *x*, *y*. The optional parameter *fmt* is a convenient way for defining basic formatting like color, marker and linestyle. It's a shortcut string notation described in the *Notes* section below. >>> plot(x, y) # plot x and y using default line style and color >>> plot(x, y, 'bo') # plot x and y using blue circle markers >>> plot(y) # plot y using x as index array 0..N-1 >>> plot(y, 'r+') # ditto, but with red plusses You can use `.Line2D` properties as keyword arguments for more control on the appearance. Line properties and *fmt* can be mixed. The following two calls yield identical results: >>> plot(x, y, 'go--', linewidth=2, markersize=12) >>> plot(x, y, color='green', marker='o', linestyle='dashed', ... linewidth=2, markersize=12) When conflicting with *fmt*, keyword arguments take precedence. **Plotting labelled data** There's a convenient way for plotting objects with labelled data (i.e. data that can be accessed by index ``obj['y']``). Instead of giving the data in *x* and *y*, you can provide the object in the *data* parameter and just give the labels for *x* and *y*:: >>> plot('xlabel', 'ylabel', data=obj) All indexable objects are supported. This could e.g. be a `dict`, a `pandas.DataFrame` or a structured numpy array. **Plotting multiple sets of data** There are various ways to plot multiple sets of data. - The most straight forward way is just to call `plot` multiple times. Example: >>> plot(x1, y1, 'bo') >>> plot(x2, y2, 'go') - Alternatively, if your data is already a 2d array, you can pass it directly to *x*, *y*. A separate data set will be drawn for every column. Example: an array ``a`` where the first column represents the *x* values and the other columns are the *y* columns:: >>> plot(a[0], a[1:]) - The third way is to specify multiple sets of *[x]*, *y*, *[fmt]* groups:: >>> plot(x1, y1, 'g^', x2, y2, 'g-') In this case, any additional keyword argument applies to all datasets. Also this syntax cannot be combined with the *data* parameter. By default, each line is assigned a different style specified by a 'style cycle'. The *fmt* and line property parameters are only necessary if you want explicit deviations from these defaults. Alternatively, you can also change the style cycle using :rc:`axes.prop_cycle`. Parameters ---------- x, y : array-like or scalar The horizontal / vertical coordinates of the data points. *x* values are optional and default to ``range(len(y))``. Commonly, these parameters are 1D arrays. They can also be scalars, or two-dimensional (in that case, the columns represent separate data sets). These arguments cannot be passed as keywords. fmt : str, optional A format string, e.g. 'ro' for red circles. See the *Notes* section for a full description of the format strings. Format strings are just an abbreviation for quickly setting basic line properties. All of these and more can also be controlled by keyword arguments. This argument cannot be passed as keyword. data : indexable object, optional An object with labelled data. If given, provide the label names to plot in *x* and *y*. .. note:: Technically there's a slight ambiguity in calls where the second label is a valid *fmt*. ``plot('n', 'o', data=obj)`` could be ``plt(x, y)`` or ``plt(y, fmt)``. In such cases, the former interpretation is chosen, but a warning is issued. You may suppress the warning by adding an empty format string ``plot('n', 'o', '', data=obj)``. Returns ------- list of `.Line2D` A list of lines representing the plotted data. Other Parameters ---------------- scalex, scaley : bool, default: True These parameters determine if the view limits are adapted to the data limits. The values are passed on to `autoscale_view`. **kwargs : `.Line2D` properties, optional *kwargs* are used to specify properties like a line label (for auto legends), linewidth, antialiasing, marker face color. Example:: >>> plot([1, 2, 3], [1, 2, 3], 'go-', label='line 1', linewidth=2) >>> plot([1, 2, 3], [1, 4, 9], 'rs', label='line 2') If you make multiple lines with one plot call, the kwargs apply to all those lines. Here is a list of available `.Line2D` properties: Properties: agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array alpha: float or None animated: bool antialiased or aa: bool clip_box: `.Bbox` clip_on: bool clip_path: Patch or (Path, Transform) or None color or c: color contains: unknown dash_capstyle: {'butt', 'round', 'projecting'} dash_joinstyle: {'miter', 'round', 'bevel'} dashes: sequence of floats (on/off ink in points) or (None, None) data: (2, N) array or two 1D arrays drawstyle or ds: {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default' figure: `.Figure` fillstyle: {'full', 'left', 'right', 'bottom', 'top', 'none'} gid: str in_layout: bool label: object linestyle or ls: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} linewidth or lw: float marker: marker style string, `~.path.Path` or `~.markers.MarkerStyle` markeredgecolor or mec: color markeredgewidth or mew: float markerfacecolor or mfc: color markerfacecoloralt or mfcalt: color markersize or ms: float markevery: None or int or (int, int) or slice or List[int] or float or (float, float) or List[bool] path_effects: `.AbstractPathEffect` picker: unknown pickradius: float rasterized: bool or None sketch_params: (scale: float, length: float, randomness: float) snap: bool or None solid_capstyle: {'butt', 'round', 'projecting'} solid_joinstyle: {'miter', 'round', 'bevel'} transform: `matplotlib.transforms.Transform` url: str visible: bool xdata: 1D array ydata: 1D array zorder: float See Also -------- scatter : XY scatter plot with markers of varying size and/or color ( sometimes also called bubble chart). Notes ----- **Format Strings** A format string consists of a part for color, marker and line:: fmt = '[marker][line][color]' Each of them is optional. If not provided, the value from the style cycle is used. Exception: If ``line`` is given, but no ``marker``, the data will be a line without markers. Other combinations such as ``[color][marker][line]`` are also supported, but note that their parsing may be ambiguous. **Markers** ============= =============================== character description ============= =============================== ``'.'`` point marker ``','`` pixel marker ``'o'`` circle marker ``'v'`` triangle_down marker ``'^'`` triangle_up marker ``'<'`` triangle_left marker ``'>'`` triangle_right marker ``'1'`` tri_down marker ``'2'`` tri_up marker ``'3'`` tri_left marker ``'4'`` tri_right marker ``'s'`` square marker ``'p'`` pentagon marker ``'*'`` star marker ``'h'`` hexagon1 marker ``'H'`` hexagon2 marker ``'+'`` plus marker ``'x'`` x marker ``'D'`` diamond marker ``'d'`` thin_diamond marker ``'|'`` vline marker ``'_'`` hline marker ============= =============================== **Line Styles** ============= =============================== character description ============= =============================== ``'-'`` solid line style ``'--'`` dashed line style ``'-.'`` dash-dot line style ``':'`` dotted line style ============= =============================== Example format strings:: 'b' # blue markers with default shape 'or' # red circles '-g' # green solid line '--' # dashed line with default color '^k:' # black triangle_up markers connected by a dotted line **Colors** The supported color abbreviations are the single letter codes ============= =============================== character color ============= =============================== ``'b'`` blue ``'g'`` green ``'r'`` red ``'c'`` cyan ``'m'`` magenta ``'y'`` yellow ``'k'`` black ``'w'`` white ============= =============================== and the ``'CN'`` colors that index into the default property cycle. If the color is the only part of the format string, you can additionally use any `matplotlib.colors` spec, e.g. full names (``'green'``) or hex strings (``'#008000'``).
x= np.linspace(0,10,100)
y=np.sin(x)
plt.plot(x,y,ls="-.",label='y=sin(x)')
plt.legend(loc='center')
<matplotlib.legend.Legend at 0x1b3610bea58>
x= np.arange(0,1.1,0.01)
x
array([0. , 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1 , 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.2 , 0.21, 0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.3 , 0.31, 0.32, 0.33, 0.34, 0.35, 0.36, 0.37, 0.38, 0.39, 0.4 , 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5 , 0.51, 0.52, 0.53, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.6 , 0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67, 0.68, 0.69, 0.7 , 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 0.8 , 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 0.9 , 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 1. , 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09])
y = x ** 2
y
array([0.0000e+00, 1.0000e-04, 4.0000e-04, 9.0000e-04, 1.6000e-03, 2.5000e-03, 3.6000e-03, 4.9000e-03, 6.4000e-03, 8.1000e-03, 1.0000e-02, 1.2100e-02, 1.4400e-02, 1.6900e-02, 1.9600e-02, 2.2500e-02, 2.5600e-02, 2.8900e-02, 3.2400e-02, 3.6100e-02, 4.0000e-02, 4.4100e-02, 4.8400e-02, 5.2900e-02, 5.7600e-02, 6.2500e-02, 6.7600e-02, 7.2900e-02, 7.8400e-02, 8.4100e-02, 9.0000e-02, 9.6100e-02, 1.0240e-01, 1.0890e-01, 1.1560e-01, 1.2250e-01, 1.2960e-01, 1.3690e-01, 1.4440e-01, 1.5210e-01, 1.6000e-01, 1.6810e-01, 1.7640e-01, 1.8490e-01, 1.9360e-01, 2.0250e-01, 2.1160e-01, 2.2090e-01, 2.3040e-01, 2.4010e-01, 2.5000e-01, 2.6010e-01, 2.7040e-01, 2.8090e-01, 2.9160e-01, 3.0250e-01, 3.1360e-01, 3.2490e-01, 3.3640e-01, 3.4810e-01, 3.6000e-01, 3.7210e-01, 3.8440e-01, 3.9690e-01, 4.0960e-01, 4.2250e-01, 4.3560e-01, 4.4890e-01, 4.6240e-01, 4.7610e-01, 4.9000e-01, 5.0410e-01, 5.1840e-01, 5.3290e-01, 5.4760e-01, 5.6250e-01, 5.7760e-01, 5.9290e-01, 6.0840e-01, 6.2410e-01, 6.4000e-01, 6.5610e-01, 6.7240e-01, 6.8890e-01, 7.0560e-01, 7.2250e-01, 7.3960e-01, 7.5690e-01, 7.7440e-01, 7.9210e-01, 8.1000e-01, 8.2810e-01, 8.4640e-01, 8.6490e-01, 8.8360e-01, 9.0250e-01, 9.2160e-01, 9.4090e-01, 9.6040e-01, 9.8010e-01, 1.0000e+00, 1.0201e+00, 1.0404e+00, 1.0609e+00, 1.0816e+00, 1.1025e+00, 1.1236e+00, 1.1449e+00, 1.1664e+00, 1.1881e+00])
plt.figure(figsize=(6.4,4.84),dpi=100, facecolor="white")
plt.title("这是一副图",font=font)
plt.xlabel("x")
plt.ylabel("y")
plt.xlim([0,1])
plt.ylim([0,1])
plt.xticks([0,0.2,0.4,0.6,0.8,1])
plt.xticks([0,0.2,0.4,0.6,0.8,1])
plt.plot(x,y,label="y=x^2")
plt.legend(loc="best")
<matplotlib.legend.Legend at 0x1b3620ff7f0>