我正在尝试使用matplotlib
在python上绘制相同图中的boxplot和散点图。
这是我的代码:
# plotting results
plt.figure(figsize = (10,8))
plt.scatter(dfplot['Date'].tolist(), dfplot['Zplume_obv'].tolist(), color = 'red')
plt.boxplot(l2, patch_artist = True)
plt.xticks(range(7), [0]+df2['Date'].tolist())
# format the plot
plt.ylabel('Plume Height')
plt.title('Observed vs Test Plume Heights')
plt.gcf().autofmt_xdate()
obser = mpatches.Patch(color = 'red', label = 'Measured Data')
test = mpatches.Patch(color = 'blue', label = 'test Data')
plt.legend(handles = [obser, test])
plt.show()
plt.close()
我的代码很好但结果只是像这样的箱形图:
正如您所见,散点图无处可寻。任何修复?
样本数据(Boxplot)
Date Plume
24/07/2014 [2122, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382]
02/08/2014 [2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 1966, 1966, 2202, 2202, 2352, 2352, 2461, 2461, 2547, 2547, 3114, 3114, 3133, 3133, 3148, 3148, 3162, 3162, 3162, 3162, 3174, 3174, 3174, 3174, 3185, 3185, 3185, 3185, 3193, 3193, 3193, 3193, 1394, 1394, 1394, 1394, 1674, 1674, 1674, 1674, 1856, 1856, 1856, 1856, 1992, 1992, 1992, 1992, 2100, 2100, 2100, 2100, 2191, 2191, 2191, 2191, 2268, 2268, 2268, 2268, 2334, 2334, 2334, 2334, 2124, 2124, 2384, 2384, 2552, 2552, 2672, 2672, 2768, 2768, 3378, 3378, 3400, 3400, 3418, 3418, 3435, 3435, 3435, 3435, 3450, 3450, 3450, 3450, 3463, 3463, 3463, 3463, 3472, 3472, 3472, 3472, 1493, 1493, 1493, 1493, 1800, 1800, 1800, 1800, 2000, 2000, 2000, 2000, 2149, 2149, 2149, 2149, 2269, 2269, 2269, 2269, 2369, 2369, 2369, 2369, 2454, 2454, 2454, 2454, 2527, 2527, 2527, 2527, 1964, 1964, 2199, 2199, 2349, 2349, 2458, 2458, 2544, 2544, 3128, 3128, 3146, 3146, 3160, 3160, 3173, 3173, 3173, 3173, 3185, 3185, 3185, 3185, 3195, 3195, 3195, 3195, 3202, 3202, 3202, 3202, 1384, 1384, 1384, 1384, 1664, 1664, 1664, 1664, 1845, 1845, 1845, 1845, 1981, 1981, 1981, 1981, 2089, 2089, 2089, 2089, 2179, 2179, 2179, 2179, 2256, 2256, 2256, 2256, 2323, 2323, 2323, 2323, 1290, 1290, 1401, 1401, 1470, 1470, 1518, 1518, 1555, 1555, 1870, 1870, 1871, 1871, 1870, 1870, 1869, 1869, 1869, 1869, 1868, 1868, 1868, 1868, 1866, 1866, 1866, 1866, 1863, 1863, 1863, 1863, 779, 779, 779, 779, 942, 942, 942, 942, 1048, 1048, 1048, 1048, 1126, 1126, 1126, 1126, 1187, 1187, 1187, 1187, 1238, 1238, 1238, 1238, 1281, 1281, 1281, 1281, 1317, 1317, 1317, 1317, 1220, 1220, 1318, 1318, 1379, 1379, 1421, 1421, 1453, 1453, 1755, 1755, 1754, 1754, 1752, 1752, 1749, 1749, 1749, 1749, 1747, 1747, 1747, 1747, 1744, 1744, 1744, 1744, 1739, 1739, 1739, 1739, 721, 721, 721, 721, 873, 873, 873, 873, 971, 971, 971, 971, 1043, 1043, 1043, 1043, 1100, 1100, 1100, 1100, 1147, 1147, 1147, 1147, 1186, 1186, 1186, 1186, 1219, 1219, 1219, 1219, 1311, 1311, 1426, 1426, 1498, 1498, 1548, 1548, 1586, 1586, 1904, 1904, 1906, 1906, 1906, 1906, 1906, 1906, 1906, 1906, 1905, 1905, 1905, 1905, 1904, 1904, 1904, 1904, 1901, 1901, 1901, 1901, 797, 797, 797, 797, 964, 964, 964, 964, 1072, 1072, 1072, 1072, 1151, 1151, 1151, 1151, 1215, 1215, 1215, 1215, 1266, 1266, 1266, 1266, 1310, 1310, 1310, 1310, 1347, 1347, 1347, 1347, 1218, 1218, 1315, 1315, 1376, 1376, 1418, 1418, 1449, 1449, 1751, 1751, 1750, 1750, 1748, 1748, 1745, 1745, 1745, 1745, 1743, 1743, 1743, 1743, 1740, 1740, 1740, 1740, 1735, 1735, 1735, 1735, 719, 719, 719, 719, 871, 871, 871, 871, 968, 968, 968, 968, 1040, 1040, 1040, 1040, 1097, 1097, 1097, 1097, 1144, 1144, 1144, 1144, 1183, 1183, 1183, 1183, 1216, 1216, 1216, 1216, 1967, 1967, 2202, 2202, 2353, 2353, 2461, 2461, 2547, 2547, 3114, 3114, 3133, 3133, 3148, 3148, 3162, 3162, 3162, 3162, 3174, 3174, 3174, 3174, 3185, 3185, 3185, 3185, 3193, 3193, 3193, 3193, 1394, 1394, 1394, 1394, 1674, 1674, 1674, 1674, 1856, 1856, 1856, 1856, 1992, 1992, 1992, 1992, 2100, 2100, 2100, 2100, 2191, 2191, 2191, 2191, 2268, 2268, 2268, 2268, 2334, 2334, 2334, 2334, 2010, 2010, 2010, 2010, 2245, 2245, 2245, 2245, 2391, 2391, 2391, 2391, 2495, 2495, 2495, 2495, 1783, 1783, 1783, 1783, 2066, 2066, 2066, 2066, 2242, 2242, 2242, 2242, 2369, 2369, 2369, 2369, 2469, 2469, 2469, 2469, 2551, 2551, 2551, 2551, 2620, 2620, 2620, 2620, 2678, 2678, 2678, 2678, 2123, 2123, 2383, 2383, 2551, 2551, 2672, 2672, 2768, 2768, 2848, 2848, 3403, 3403, 3421, 3421, 3438, 3438, 3438, 3438, 3452, 3452, 3452, 3452, 3465, 3465, 3465, 3465, 3475, 3475, 3475, 3475, 1495, 1495, 1495, 1495, 1802, 1802, 1802, 1802, 2002, 2002, 2002, 2002, 2151, 2151, 2151, 2151, 2271, 2271, 2271, 2271, 2371, 2371, 2371, 2371, 2456, 2456, 2456, 2456, 2530, 2530, 2530, 2530, 1514, 1514, 1514, 1514, 1659, 1659, 1659, 1659, 1746, 1746, 1746, 1746, 1807, 1807, 1807, 1807, 1278, 1278, 1278, 1278, 1476, 1476, 1476, 1476, 1597, 1597, 1597, 1597, 1681, 1681, 1681, 1681, 1746, 1746, 1746, 1746, 1798, 1798, 1798, 1798, 1841, 1841, 1841, 1841, 1877, 1877, 1877, 1877, 2125, 2125, 2384, 2384, 2551, 2551, 2672, 2672, 2768, 2768, 3397, 3397, 3418, 3418, 3434, 3434, 3451, 3451, 3451, 3451, 3465, 3465, 3465, 3465, 3477, 3477, 3477, 3477, 3486, 3486, 3486, 3486, 1484, 1484, 1484, 1484, 1790, 1790, 1790, 1790, 1990, 1990, 1990, 1990, 2139, 2139, 2139, 2139, 2258, 2258, 2258, 2258, 2358, 2358, 2358, 2358, 2443, 2443, 2443, 2443, 2517, 2517, 2517, 2517, 1472, 1472, 1616, 1616, 1707, 1707, 1770, 1770, 1819, 1819, 1859, 1859, 2193, 2193, 2196, 2196, 2199, 2199, 2199, 2199, 2201, 2201, 2201, 2201, 2203, 2203, 2203, 2203, 2202, 2202, 2202, 2202, 925, 925, 925, 925, 1119, 1119, 1119, 1119, 1244, 1244, 1244, 1244, 1337, 1337, 1337, 1337, 1411, 1411, 1411, 1411, 1472, 1472, 1472, 1472, 1523, 1523, 1523, 1523, 1567, 1567, 1567, 1567, 2125, 2125, 2384, 2384, 2552, 2552, 2672, 2672, 2768, 2768, 3383, 3383, 3405, 3405, 3422, 3422, 3439, 3439, 3439, 3439, 3453, 3453, 3453, 3453, 3466, 3466, 3466, 3466, 3476, 3476, 3476, 3476, 1491, 1491, 1491, 1491, 1797, 1797, 1797, 1797, 1997, 1997, 1997, 1997, 2146, 2146, 2146, 2146, 2266, 2266, 2266, 2266, 2366, 2366, 2366, 2366, 2451, 2451, 2451, 2451, 2525, 2525, 2525, 2525, 1290, 1290, 1401, 1401, 1470, 1470, 1518, 1518, 1555, 1555, 1870, 1870, 1871, 1871, 1870, 1870, 1869, 1869, 1869, 1869, 1868, 1868, 1868, 1868, 1866, 1866, 1866, 1866, 1863, 1863, 1863, 1863, 779, 779, 779, 779, 942, 942, 942, 942, 1048, 1048, 1048, 1048, 1126, 1126, 1126, 1126, 1187, 1187, 1187, 1187, 1238, 1238, 1238, 1238, 1281, 1281, 1281, 1281, 1317, 1317, 1317, 1317, 1314, 1314, 1429, 1429, 1501, 1501, 1551, 1551, 1589, 1589, 1908, 1908, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1909, 1909, 1909, 1909, 1908, 1908, 1908, 1908, 1905, 1905, 1905, 1905, 799, 799, 799, 799, 966, 966, 966, 966, 1074, 1074, 1074, 1074, 1154, 1154, 1154, 1154, 1217, 1217, 1217, 1217, 1269, 1269, 1269, 1269, 1313, 1313, 1313, 1313, 1350, 1350, 1350, 1350, 1314, 1314, 1429, 1429, 1501, 1501, 1551, 1551, 1589, 1589, 1908, 1908, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1910, 1909, 1909, 1909, 1909, 1908, 1908, 1908, 1908, 1905, 1905, 1905, 1905, 799, 799, 799, 799, 966, 966, 966, 966, 1074, 1074, 1074, 1074, 1154, 1154, 1154, 1154, 1217, 1217, 1217, 1217, 1269, 1269, 1269, 1269, 1313, 1313, 1313, 1313, 1350, 1350, 1350, 1350, 1472, 1472, 1616, 1616, 1707, 1707, 1770, 1770, 1819, 1819, 1859, 1859, 2193, 2193, 2196, 2196, 2199, 2199, 2199, 2199, 2201, 2201, 2201, 2201, 2203, 2203, 2203, 2203, 2202, 2202, 2202, 2202, 925, 925, 925, 925, 1119, 1119, 1119, 1119, 1244, 1244, 1244, 1244, 1337, 1337, 1337, 1337, 1411, 1411, 1411, 1411, 1472, 1472, 1472, 1472, 1523, 1523, 1523, 1523, 1567, 1567, 1567, 1567, 2008, 2008, 2008, 2008, 2243, 2243, 2243, 2243, 2388, 2388, 2388, 2388, 2492, 2492, 2492, 2492, 1781, 1781, 1781, 1781, 2063, 2063, 2063, 2063, 2239, 2239, 2239, 2239, 2366, 2366, 2366, 2366, 2466, 2466, 2466, 2466, 2548, 2548, 2548, 2548, 2617, 2617, 2617, 2617, 2675, 2675, 2675, 2675, 1288, 1288, 1398, 1398, 1467, 1467, 1515, 1515, 1551, 1551, 1865, 1865, 1867, 1867, 1866, 1866, 1865, 1865, 1865, 1865, 1864, 1864, 1864, 1864, 1862, 1862, 1862, 1862, 1859, 1859, 1859, 1859, 777, 777, 777, 777, 940, 940, 940, 940, 1045, 1045, 1045, 1045, 1123, 1123, 1123, 1123, 1185, 1185, 1185, 1185, 1235, 1235, 1235, 1235, 1278, 1278, 1278, 1278, 1314, 1314, 1314, 1314]
03/08/2014 [2411, 2411, 2411, 4022, 4022, 4022, 4022, 4064, 4064, 4064, 4064]
07/08/2014 [4101, 4101, 4134, 4134, 4134, 4163, 4163, 4163, 4186, 4186, 4186, 4203, 4203, 4203, 2060, 2060, 2060, 2437, 2437, 2437, 2680, 2680, 2680, 2863, 2863, 2863, 3012, 3012, 3012, 3135, 3135, 3135, 3241, 3241, 3241, 2504, 2504, 2504, 2504, 2844, 2844, 2844, 2844, 3062, 3062, 3062, 3062, 4143, 4143, 4143, 4143, 4180, 4180, 4180, 4180, 4213, 4213, 4213, 4243, 4243, 4243, 4270, 4270, 4270, 4291, 4291, 4291, 4306, 4306, 4306, 2053, 2053, 2053, 2435, 2435, 2435, 2682, 2682, 2682, 2869, 2869, 2869, 3019, 3019, 3019, 3145, 3145, 3145, 3252, 3252, 3252, 2488, 2488, 2488, 4088, 4088, 4088, 4124, 4124, 4124, 4153, 4153, 4153, 4176, 4176, 4176, 2122, 2122, 2122, 2507, 2507, 2507, 2755, 2755, 2755, 2941, 2941, 2941, 3092, 3092, 3092, 3218, 3218, 3218, 3324, 3324, 3324, 2488, 2488, 2488, 4088, 4088, 4088, 4124, 4124, 4124, 4153, 4153, 4153, 4176, 4176, 4176, 2122, 2122, 2122, 2507, 2507, 2507, 2755, 2755, 2755, 2941, 2941, 2941, 3092, 3092, 3092, 3218, 3218, 3218, 3324, 3324, 3324, 2502, 2502, 2502, 2502, 2842, 2842, 2842, 2842, 3060, 3060, 3060, 3060, 4162, 4162, 4162, 4162, 4196, 4196, 4196, 4227, 4227, 4227, 4255, 4255, 4255, 4276, 4276, 4276, 4292, 4292, 4292, 2061, 2061, 2061, 2444, 2444, 2444, 2691, 2691, 2691, 2877, 2877, 2877, 3028, 3028, 3028, 3153, 3153, 3153, 3260, 3260, 3260, 2503, 2503, 2503, 2503, 2843, 2843, 2843, 2843, 3062, 3062, 3062, 3062, 4135, 4135, 4135, 4135, 4172, 4172, 4172, 4172, 4206, 4206, 4206, 4236, 4236, 4236, 4263, 4263, 4263, 4284, 4284, 4284, 4300, 4300, 4300, 2056, 2056, 2056, 2438, 2438, 2438, 2685, 2685, 2685, 2871, 2871, 2871, 3022, 3022, 3022, 3148, 3148, 3148, 3254, 3254, 3254, 2503, 2503, 2503, 2503, 2843, 2843, 2843, 2843, 3062, 3062, 3062, 3062, 4135, 4135, 4135, 4135, 4172, 4172, 4172, 4172, 4206, 4206, 4206, 4236, 4236, 4236, 4263, 4263, 4263, 4284, 4284, 4284, 4300, 4300, 4300, 2056, 2056, 2056, 2438, 2438, 2438, 2685, 2685, 2685, 2871, 2871, 2871, 3022, 3022, 3022, 3148, 3148, 3148, 3254, 3254, 3254, 2503, 2503, 2503, 2503, 2843, 2843, 2843, 2843, 3062, 3062, 3062, 3062, 4135, 4135, 4135, 4135, 4172, 4172, 4172, 4172, 4206, 4206, 4206, 4236, 4236, 4236, 4263, 4263, 4263, 4284, 4284, 4284, 4300, 4300, 4300, 2056, 2056, 2056, 2438, 2438, 2438, 2685, 2685, 2685, 2871, 2871, 2871, 3022, 3022, 3022, 3148, 3148, 3148, 3254, 3254, 3254, 2488, 2488, 2488, 4088, 4088, 4088, 4124, 4124, 4124, 4153, 4153, 4153, 4176, 4176, 4176, 2122, 2122, 2122, 2507, 2507, 2507, 2755, 2755, 2755, 2941, 2941, 2941, 3092, 3092, 3092, 3218, 3218, 3218, 3324, 3324, 3324, 2440, 2440, 2440, 4165, 4165, 4165, 4203, 4203, 4203, 4234, 4234, 4234, 4258, 4258, 4258, 2177, 2177, 2177, 2569, 2569, 2569, 2824, 2824, 2824, 3015, 3015, 3015, 3169, 3169, 3169, 3297, 3297, 3297, 3406, 3406, 3406, 2838, 4572, 4621, 4664, 4664, 4664, 4703, 4703, 4703, 4737, 4737, 4737, 4764, 4764, 4764, 2266, 2266, 2266, 2707, 2707, 2707, 2994, 2994, 2994, 3211, 3211, 3211, 3385, 3385, 3385, 3531, 3531, 3531, 3655, 3655, 3655, 3762, 3762, 3762, 2959, 2959, 2959, 4922, 4922, 4922, 4967, 4967, 4967, 5004, 5004, 5004, 2483, 2483, 2483, 2956, 2956, 2956, 3264, 3264, 3264, 3496, 3496, 3496, 3683, 3683, 3683, 3839, 3839, 3839, 3972, 3972, 3972, 4088, 4088, 4088, 2907, 2907, 2907, 4620, 4620, 4620, 4659, 4659, 4659, 4690, 4690, 4690, 2316, 2316, 2316, 2758, 2758, 2758, 3045, 3045, 3045, 3261, 3261, 3261, 3435, 3435, 3435, 3579, 3579, 3579, 3701, 3701, 3701, 3807, 3807, 3807, 2854, 3236, 3481, 3664, 3811, 3933, 4754, 4788, 4819, 4819, 4819, 4847, 4847, 4847, 4870, 4870, 4870, 4886, 4886, 4886, 2152, 2152, 2152, 2582, 2582, 2582, 2863, 2863, 2863, 3077, 3077, 3077, 3248, 3248, 3248, 3392, 3392, 3392, 3514, 3514, 3514, 3620, 3620, 3620, 2832, 3225, 4629, 4675, 4715, 4715, 4715, 4752, 4752, 4752, 4783, 4783, 4783, 4807, 4807, 4807, 2247, 2247, 2247, 2687, 2687, 2687, 2974, 2974, 2974, 3191, 3191, 3191, 3366, 3366, 3366, 3511, 3511, 3511, 3635, 3635, 3635, 3743, 3743, 3743, 2834, 3227, 4636, 4684, 4727, 4764, 4764, 4764, 4799, 4799, 4799, 4828, 4828, 4828, 4850, 4850, 4850, 2230, 2230, 2230, 2669, 2669, 2669, 2956, 2956, 2956, 3173, 3173, 3173, 3348, 3348, 3348, 3494, 3494, 3494, 3619, 3619, 3619, 3727, 3727, 3727, 2590, 2936, 3158, 3323, 3456, 4291, 4326, 4356, 4383, 4383, 4383, 4408, 4408, 4408, 4428, 4428, 4428, 4442, 4442, 4442, 1976, 1976, 1976, 2365, 2365, 2365, 2620, 2620, 2620, 2812, 2812, 2812, 2967, 2967, 2967, 3096, 3096, 3096, 3206, 3206, 3206, 3302, 3302, 3302, 2838, 4572, 4621, 4664, 4664, 4664, 4703, 4703, 4703, 4737, 4737, 4737, 4764, 4764, 4764, 2266, 2266, 2266, 2707, 2707, 2707, 2994, 2994, 2994, 3211, 3211, 3211, 3385, 3385, 3385, 3531, 3531, 3531, 3655, 3655, 3655, 3762, 3762, 3762, 2959, 2959, 2959, 4922, 4922, 4922, 4967, 4967, 4967, 5004, 5004, 5004, 2483, 2483, 2483, 2956, 2956, 2956, 3264, 3264, 3264, 3496, 3496, 3496, 3683, 3683, 3683, 3839, 3839, 3839, 3972, 3972, 3972, 4088, 4088, 4088, 2590, 2936, 3159, 3324, 3457, 3568, 4318, 4349, 4377, 4377, 4377, 4401, 4401, 4401, 4422, 4422, 4422, 4437, 4437, 4437, 1982, 1982, 1982, 2372, 2372, 2372, 2626, 2626, 2626, 2819, 2819, 2819, 2974, 2974, 2974, 3103, 3103, 3103, 3213, 3213, 3213, 3308, 3308, 3308, 2649, 2649, 2649, 4211, 4211, 4211, 4246, 4246, 4246, 4274, 4274, 4274, 2129, 2129, 2129, 2529, 2529, 2529, 2788, 2788, 2788, 2983, 2983, 2983, 3140, 3140, 3140, 3270, 3270, 3270, 3380, 3380, 3380, 3476, 3476, 3476, 2907, 2907, 2907, 4620, 4620, 4620, 4659, 4659, 4659, 4691, 4691, 4691, 2316, 2316, 2316, 2758, 2758, 2758, 3045, 3045, 3045, 3261, 3261, 3261, 3435, 3435, 3435, 3579, 3579, 3579, 3702, 3702, 3702, 3808, 3808, 3808, 2907, 2907, 2907, 4620, 4620, 4620, 4659, 4659, 4659, 4691, 4691, 4691, 2316, 2316, 2316, 2758, 2758, 2758, 3045, 3045, 3045, 3261, 3261, 3261, 3435, 3435, 3435, 3579, 3579, 3579, 3702, 3702, 3702, 3808, 3808, 3808]
13/08/2014 [1939, 1939, 1939, 1939, 1939, 2161, 2161, 2161, 2161, 2161, 2161, 2297, 2297, 2297, 2297, 2297, 2297, 2393, 2393, 2393, 2393, 2393, 2393, 1692, 1692, 1692, 1692, 1692, 1692, 1968, 1968, 1968, 1968, 1968, 1968, 2138, 2138, 2138, 2138, 2138, 2138, 2262, 2262, 2262, 2262, 2262, 2262, 2360, 2360, 2360, 2360, 2360, 2360, 2440, 2440, 2440, 2440, 2440, 2440, 2504, 2504, 2504, 2504, 2504, 2504, 2559, 2559, 2559, 2559, 2559, 2559, 1913, 1913, 1913, 1913, 1913, 1913, 1816, 1816, 1816, 1816, 1816, 1816, 2068, 2068, 2068, 2068, 2068, 2068, 2228, 2228, 2228, 2228, 2228, 2228, 2341, 2341, 2341, 2341, 2341, 2341, 2430, 2430, 2430, 2430, 2430, 2430, 2502, 2502, 2502, 2502, 2502, 2502, 2562, 2562, 2562, 2562, 2562, 2562, 2616, 2616, 2616, 2616, 2616, 2616, 1899, 1899, 1899, 1899, 1899, 1899, 1822, 1822, 1822, 1822, 1822, 1822, 2074, 2074, 2074, 2074, 2074, 2074, 2228, 2228, 2228, 2228, 2228, 2228, 2341, 2341, 2341, 2341, 2341, 2341, 2430, 2430, 2430, 2430, 2430, 2430, 2503, 2503, 2503, 2503, 2503, 2503, 2562, 2562, 2562, 2562, 2562, 2562, 2612, 2612, 2612, 2612, 2612, 2612, 724, 724, 724, 724, 724, 724, 812, 812, 812, 812, 812, 812, 846, 846, 846, 846, 846, 846, 866, 866, 866, 866, 866, 866, 654, 654, 654, 654, 654, 654, 740, 740, 740, 740, 740, 740, 788, 788, 788, 788, 788, 788, 780, 780, 780, 780, 780, 780, 774, 774, 774, 774, 774, 774, 769, 769, 769, 769, 769, 769, 739, 739, 739, 739, 739, 739, 713, 713, 713, 713, 713, 713, 1935, 1935, 1935, 1935, 1935, 1935, 2157, 2157, 2157, 2157, 2157, 2157, 2292, 2292, 2292, 2292, 2292, 2292, 2388, 2388, 2388, 2388, 2388, 2388, 2463, 2463, 2463, 2463, 2463, 2463, 1657, 1657, 1657, 1657, 1657, 1657, 1934, 1934, 1934, 1934, 1934, 1934, 2106, 2106, 2106, 2106, 2106, 2106, 2232, 2232, 2232, 2232, 2232, 2232, 2330, 2330, 2330, 2330, 2330, 2330, 2408, 2408, 2408, 2408, 2408, 2408, 2472, 2472, 2472, 2472, 2472, 2472, 1535, 1535, 1535, 1535, 1535, 1535, 2530, 2530, 2530, 2530, 2530, 2530, 1293, 1293, 1293, 1293, 1293, 1293, 1527, 1527, 1527, 1527, 1527, 1527, 1674, 1674, 1674, 1674, 1674, 1674, 1781, 1781, 1781, 1781, 1781, 1781, 1866, 1866, 1866, 1866, 1866, 1866, 1936, 1936, 1936, 1936, 1936, 1936, 1997, 1997, 1997, 1997, 1997, 1997, 1535, 1535, 1535, 1535, 1535, 1535, 2530, 2530, 2530, 2530, 2530, 2530, 1293, 1293, 1293, 1293, 1293, 1293, 1527, 1527, 1527, 1527, 1527, 1527, 1674, 1674, 1674, 1674, 1674, 1674, 1781, 1781, 1781, 1781, 1781, 1781, 1866, 1866, 1866, 1866, 1866, 1866, 1936, 1936, 1936, 1936, 1936, 1936, 1997, 1997, 1997, 1997, 1997, 1997, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1528, 1729, 1729, 1729, 1729, 1729, 1729, 1857, 1857, 1857, 1857, 1857, 1857, 1952, 1952, 1952, 1952, 1952, 1952, 2026, 2026, 2026, 2026, 2026, 2026, 2086, 2086, 2086, 2086, 2086, 2086, 2134, 2134, 2134, 2134, 2134, 2134, 1893, 1893, 1893, 1893, 1893, 1893, 1834, 1834, 1834, 1834, 1834, 1834, 2086, 2086, 2086, 2086, 2086, 2086, 2240, 2240, 2240, 2240, 2240, 2240, 2353, 2353, 2353, 2353, 2353, 2353, 2442, 2442, 2442, 2442, 2442, 2442, 2514, 2514, 2514, 2514, 2514, 2514, 2573, 2573, 2573, 2573, 2573, 2573, 2622, 2622, 2622, 2622, 2622, 2622, 1897, 1897, 1897, 1897, 1897, 1897, 1823, 1823, 1823, 1823, 1823, 1823, 2076, 2076, 2076, 2076, 2076, 2076, 2230, 2230, 2230, 2230, 2230, 2230, 2343, 2343, 2343, 2343, 2343, 2343, 2433, 2433, 2433, 2433, 2433, 2433, 2507, 2507, 2507, 2507, 2507, 2507, 2567, 2567, 2567, 2567, 2567, 2567, 2617, 2617, 2617, 2617, 2617, 2617, 1897, 1897, 1897, 1897, 1897, 1897, 1834, 1834, 1834, 1834, 1834, 1834, 2087, 2087, 2087, 2087, 2087, 2087, 2241, 2241, 2241, 2241, 2241, 2241, 2354, 2354, 2354, 2354, 2354, 2354, 2444, 2444, 2444, 2444, 2444, 2444, 2517, 2517, 2517, 2517, 2517, 2517, 2577, 2577, 2577, 2577, 2577, 2577, 2626, 2626, 2626, 2626, 2626, 2626, 1939, 1939, 1939, 1939, 1939, 1939, 2161, 2161, 2161, 2161, 2161, 2161, 2297, 2297, 2297, 2297, 2297, 2297, 2393, 2393, 2393, 2393, 2393, 2393, 1692, 1692, 1692, 1692, 1692, 1692, 1968, 1968, 1968, 1968, 1968, 1968, 2139, 2139, 2139, 2139, 2139, 2139, 2262, 2262, 2262, 2262, 2262, 2262, 2360, 2360, 2360, 2360, 2360, 2360, 2440, 2440, 2440, 2440, 2440, 2440, 2505, 2505, 2505, 2505, 2505, 2505, 2559, 2559, 2559, 2559, 2559, 2559, 1719, 1719, 1719, 1719, 1719, 1719, 1906, 1906, 1906, 1906, 1906, 1906, 2020, 2020, 2020, 2020, 2020, 2020, 2099, 2099, 2099, 2099, 2099, 2099, 1486, 1486, 1486, 1486, 1486, 1486, 1726, 1726, 1726, 1726, 1726, 1726, 1874, 1874, 1874, 1874, 1874, 1874, 1980, 1980, 1980, 1980, 1980, 1980, 2063, 2063, 2063, 2063, 2063, 2063, 2131, 2131, 2131, 2131, 2131, 2131, 2186, 2186, 2186, 2186, 2186, 2186, 2232, 2232, 2232, 2232, 2232, 2232, 1748, 1748, 1748, 1748, 1748, 1748, 1933, 1933, 1933, 1933, 1933, 1933, 2043, 2043, 2043, 2043, 2043, 2043, 2120, 2120, 2120, 2120, 2120, 2120, 1487, 1487, 1487, 1487, 1487, 1487, 1728, 1728, 1728, 1728, 1728, 1728, 1875, 1875, 1875, 1875, 1875, 1875, 1980, 1980, 1980, 1980, 1980, 1980, 2063, 2063, 2063, 2063, 2063, 2063, 2130, 2130, 2130, 2130, 2130, 2130, 2183, 2183, 2183, 2183, 2183, 2183, 2228, 2228, 2228, 2228, 2228, 2228, 1913, 1913, 1913, 1913, 1913, 1913, 1816, 1816, 1816, 1816, 1816, 1816, 2068, 2068, 2068, 2068, 2068, 2068, 2228, 2228, 2228, 2228, 2228, 2228, 2341, 2341, 2341, 2341, 2341, 2341, 2430, 2430, 2430, 2430, 2430, 2430, 2502, 2502, 2502, 2502, 2502, 2502, 2562, 2562, 2562, 2562, 2562, 2562, 2616, 2616, 2616, 2616, 2616, 2616, 1899, 1899, 1899, 1899, 1899, 1899, 1822, 1822, 1822, 1822, 1822, 1822, 2074, 2074, 2074, 2074, 2074, 2074, 2228, 2228, 2228, 2228, 2228, 2228, 2341, 2341, 2341, 2341, 2341, 2341, 2430, 2430, 2430, 2430, 2430, 2430, 2503, 2503, 2503, 2503, 2503, 2503, 2562, 2562, 2562, 2562, 2562, 2562, 2612, 2612, 2612, 2612, 2612, 2612, 1748, 1748, 1748, 1748, 1748, 1748, 1933, 1933, 1933, 1933, 1933, 1933, 2044, 2044, 2044, 2044, 2044, 2044, 2121, 2121, 2121, 2121, 2121, 2121, 1488, 1488, 1488, 1488, 1488, 1488, 1729, 1729, 1729, 1729, 1729, 1729, 1876, 1876, 1876, 1876, 1876, 1876, 1982, 1982, 1982, 1982, 1982, 1982, 2065, 2065, 2065, 2065, 2065, 2065, 2132, 2132, 2132, 2132, 2132, 2132, 2186, 2186, 2186, 2186, 2186, 2186, 2230, 2230, 2230, 2230, 2230, 2230, 1748, 1748, 1748, 1748, 1748, 1748, 1933, 1933, 1933, 1933, 1933, 1933, 2043, 2043, 2043, 2043, 2043, 2043, 2120, 2120, 2120, 2120, 2120, 2120, 1487, 1487, 1487, 1487, 1487, 1487, 1728, 1728, 1728, 1728, 1728, 1728, 1875, 1875, 1875, 1875, 1875, 1875, 1980, 1980, 1980, 1980, 1980, 1980, 2063, 2063, 2063, 2063, 2063, 2063, 2130, 2130, 2130, 2130, 2130, 2130, 2183, 2183, 2183, 2183, 2183, 2183, 2228, 2228, 2228, 2228, 2228, 2228, 1748, 1748, 1748, 1748, 1748, 1748, 1933, 1933, 1933, 1933, 1933, 1933, 2043, 2043, 2043, 2043, 2043, 2043, 2120, 2120, 2120, 2120, 2120, 2120, 1487, 1487, 1487, 1487, 1487, 1487, 1728, 1728, 1728, 1728, 1728, 1728, 1875, 1875, 1875, 1875, 1875, 1875, 1980, 1980, 1980, 1980, 1980, 1980, 2063, 2063, 2063, 2063, 2063, 2063, 2130, 2130, 2130, 2130, 2130, 2130, 2184, 2184, 2184, 2184, 2184, 2184, 2228, 2228, 2228, 2228, 2228, 2228, 1893, 1893, 1893, 1893, 1893, 1893, 1824, 1824, 1824, 1824, 1824, 1824, 2077, 2077, 2077, 2077, 2077, 2077, 2231, 2231, 2231, 2231, 2231, 2231, 2344, 2344, 2344, 2344, 2344, 2344, 2434, 2434, 2434, 2434, 2434, 2434, 2508, 2508, 2508, 2508, 2508, 2508, 2567, 2567, 2567, 2567, 2567, 2567, 2618, 2618, 2618, 2618, 2618, 2618, 1744, 1744, 1744, 1744, 1744, 1744, 1929, 1929, 1929, 1929, 1929, 1929, 2039, 2039, 2039, 2039, 2039, 2039, 2117, 2117, 2117, 2117, 2117, 2117, 1485, 1485, 1485, 1485, 1485, 1485, 1725, 1725, 1725, 1725, 1725, 1725, 1872, 1872, 1872, 1872, 1872, 1872, 1977, 1977, 1977, 1977, 1977, 1977, 2060, 2060, 2060, 2060, 2060, 2060, 2126, 2126, 2126, 2126, 2126, 2126, 2179, 2179, 2179, 2179, 2179, 2179, 2223, 2223, 2223, 2223, 2223, 2223, 1897, 1897, 1897, 1897, 1897, 1897, 1823, 1823, 1823, 1823, 1823, 1823, 2076, 2076, 2076, 2076, 2076, 2076, 2230, 2230, 2230, 2230, 2230, 2230, 2343, 2343, 2343, 2343, 2343, 2343, 2433, 2433, 2433, 2433, 2433, 2433, 2507, 2507, 2507, 2507, 2507, 2507, 2567, 2567, 2567, 2567, 2567, 2567, 2617, 2617, 2617, 2617, 2617, 2617, 1719, 1719, 1719, 1719, 1719, 1719, 1906, 1906, 1906, 1906, 1906, 1906, 2020, 2020, 2020, 2020, 2020, 2020, 2099, 2099, 2099, 2099, 2099, 2099, 1486, 1486, 1486, 1486, 1486, 1486, 1726, 1726, 1726, 1726, 1726, 1726, 1874, 1874, 1874, 1874, 1874, 1874, 1980, 1980, 1980, 1980, 1980, 1980, 2063, 2063, 2063, 2063, 2063, 2063, 2131, 2131, 2131, 2131, 2131, 2131, 2186, 2186, 2186, 2186, 2186, 2186, 2232, 2232, 2232, 2232, 2232, 2232, 1892, 1892, 1892, 1892, 1892, 1892, 1824, 1824, 1824, 1824, 1824, 1824, 2077, 2077, 2077, 2077, 2077, 2077, 2231, 2231, 2231, 2231, 2231, 2231, 2344, 2344, 2344, 2344, 2344, 2344, 2434, 2434, 2434, 2434, 2434, 2434, 2508, 2508, 2508, 2508, 2508, 2508, 2568, 2568, 2568, 2568, 2568, 2568, 2618, 2618, 2618, 2618, 2618, 2618, 1935, 1935, 1935, 1935, 1935, 1935, 2157, 2157, 2157, 2157, 2157, 2157, 2292, 2292, 2292, 2292, 2292, 2292, 2388, 2388, 2388, 2388, 2388, 2388, 2463, 2463, 2463, 2463, 2463, 2463, 1657, 1657, 1657, 1657, 1657, 1657, 1934, 1934, 1934, 1934, 1934, 1934, 2106, 2106, 2106, 2106, 2106, 2106, 2232, 2232, 2232, 2232, 2232, 2232, 2330, 2330, 2330, 2330, 2330, 2330, 2408, 2408, 2408, 2408, 2408, 2408, 2472, 2472, 2472, 2472, 2472, 2472, 1417, 1417, 1417, 1417, 1417, 1417, 1548, 1548, 1548, 1548, 1548, 1548, 1625, 1625, 1625, 1625, 1625, 1625, 1678, 1678, 1678, 1678, 1678, 1678, 1189, 1189, 1189, 1189, 1189, 1189, 1374, 1374, 1374, 1374, 1374, 1374, 1485, 1485, 1485, 1485, 1485, 1485, 1564, 1564, 1564, 1564, 1564, 1564, 1624, 1624, 1624, 1624, 1624, 1624, 1673, 1673, 1673, 1673, 1673, 1673, 1712, 1712, 1712, 1712, 1712, 1712, 1744, 1744, 1744, 1744, 1744, 1744, 1606, 1606, 1606, 1606, 1606, 1606, 1768, 1768, 1768, 1768, 1768, 1768, 1865, 1865, 1865, 1865, 1865, 1865, 1933, 1933, 1933, 1933, 1933, 1933, 1365, 1365, 1365, 1365, 1365, 1365, 1581, 1581, 1581, 1581, 1581, 1581, 1712, 1712, 1712, 1712, 1712, 1712, 1806, 1806, 1806, 1806, 1806, 1806, 1879, 1879, 1879, 1879, 1879, 1879, 1938, 1938, 1938, 1938, 1938, 1938, 1986, 1986, 1986, 1986, 1986, 1986, 2026, 2026, 2026, 2026, 2026, 2026]
15/08/2014 [2608, 2946, 2946, 2473, 2473, 2848, 2848, 3082, 3082, 3256, 3256, 3394, 3394, 3508, 3508, 3606, 3606, 3690, 3690]
示例数据分散
Date Zplume_obv
23/07/2014 16:00 1392.952149
23/07/2014 16:00 2031.681512
24/07/2014 0:00 116.0714527
02/08/2014 21:00 2017.420095
02/08/2014 21:00 2404.661725
02/08/2014 21:00 6689.448138
02/08/2014 21:00 7479.815744
03/08/2014 0:00 1630.46137
03/08/2014 0:00 1243.726363
03/08/2014 0:00 2015.098972
07/08/2014 0:00 559.3343779
07/08/2014 0:00 904.3397206
13/08/2014 2:00 754.4479055
答案 0 :(得分:0)
不知道数据很难准确理解发生了什么。
我的猜测是:matplotlib根据您给出的顺序绘制艺术家,以便在boxplot
之上获得scatter
。如果你的大多数圈子都在盒子图下面,你就看不到了。外面的圆圈,如第一和第五个元素,是可见的。
您有两种选择:
zorder
关键字作为例如在此example 修改强>
我很想知道为什么我的答案被低估了,因为它是正确的。
使用python 3.5下的matplotlib v 2.0.2,下面的示例将散点图放在boxplot的顶部:(部分从here复制):
import matplotlib.pyplot as plt
import numpy as np
spread = np.random.rand(50) * 100
center = np.ones(25) * 50
flier_high = np.random.rand(10) * 100 + 100
flier_low = np.random.rand(10) * -100
data = np.concatenate((spread, center, flier_high, flier_low), 0)
plt.scatter([0.9, 1], [0, 50], c='r', zorder=10)
plt.boxplot(data, patch_artist = True)
如果我将zorder=11
添加到boxplot调用或将其从plt.scatter
中移除,则[1, 50]
中的红点会正确显示在框后面。