创建子图,或在保留原始大小的同时合并图形

时间:2019-05-24 07:00:17

标签: python matplotlib histogram subplot

假设我有以下数据:
simulations = [[27267.130859375, 27331.00668846435, 27597.986059411312, 27180.44375907077, 26829.412595057693, 27167.731093559323, 26556.90612812799, 26122.71038039928, 25543.220341812765, 25123.87968836483, 25277.911731421882, 25102.98106334218, 24805.693913480667], [27267.130859375, 27019.444250572345, 26529.912550263627, 26572.16868488334, 26592.542898027685, 25641.930009410316, 24663.55977841594, 24795.291521692317, 24908.994416967293, 24386.397363350403, 24063.386346808682, 23556.76793353066, 23715.030082008383], [27267.130859375, 28227.310627887142, 28909.446722910572, 28139.076655231747, 27548.374541261393, 28247.729058470348, 27830.124112015194, 27512.560217750248, 27565.08865622723, 27133.82296934645, 26678.617889033052, 26788.722609025077, 26893.136539404575], [27267.130859375, 26531.371663865724, 26717.69320226651, 26505.768003796456, 29335.17433063164, 27778.14503380179, 27187.514114438152, 27607.420455176907, 27943.06022406791, 28044.747407169572, 27341.21235387755, 28073.27564881572, 27695.188210124663], [27267.130859375, 27727.67055018843, 27636.288812957493, 27661.01614302658, 27986.698457965093, 28490.703984635184, 28476.077509161176, 28275.201605127215, 28031.107612767217, 27956.353927193675, 27392.95650829455, 27197.039461536096, 26963.66468936416], [27267.130859375, 27823.771790518123, 27442.706420466006, 26908.08863475161, 26523.819367242453, 25831.690942765847, 25750.957030655143, 25915.99538288321, 25969.517833005037, 25700.671829484592, 25929.46029292608, 26271.353832358396, 26220.673229349428], [27267.130859375, 27097.699256398635, 27202.122987356666, 27218.456973917666, 28241.520601451495, 28176.792213972087, 28183.565469533776, 28133.44471838637, 28737.95089455793, 28425.55883657568, 28580.68259268799, 27899.66932222768, 27795.92756453234], [27267.130859375, 26936.460418733706, 27860.74251952626, 27286.74877948139, 27692.183840993002, 27952.005733604867, 27863.3819082217, 27727.291908557738, 27852.83597365266, 27548.442227873576, 27798.046522269753, 28607.773820364207, 28374.91305279458], [27267.130859375, 27529.795976861045, 27101.50949669024, 27688.208528162228, 29037.36910025952, 28312.46322811291, 28152.236432688533, 27815.780083640635, 27691.330186328087, 27882.36888551168, 28328.48179151336, 27706.655305918193, 27863.41803326141], [27267.130859375, 27603.640385290073, 28096.86934899982, 28150.838898827406, 27669.363588455883, 28178.465803326388, 28577.641141279848, 28984.08621177433, 28998.37286432834, 29208.279312604634, 28254.61387972376, 28067.745036952027, 27441.691545496724], [27267.130859375, 27470.618797735722, 27233.17759710203, 26867.330106077818, 26463.579240126117, 26849.504479794527, 26524.231791075512, 25420.706326827014, 24439.613000109686, 25025.60529139645, 24740.068040547892, 24771.477670353106, 25021.752691350415], [27267.130859375, 26845.252686256492, 27228.63057230569, 27350.49313729412, 27936.045098500155, 27921.0610921457, 27867.450930513376, 28301.37542710208, 28262.928498355384, 28499.284306377886, 28742.15769898319, 28338.31288517325, 28472.695653872426], [27267.130859375, 27623.053107064497, 27814.34724086793, 27078.42902672029, 27668.457223842604, 28779.133677113437, 28258.05104515455, 28983.942493131075, 29122.976831830107, 29301.443061207585, 29597.955216457587, 29605.034822708, 29537.66755029881], [27267.130859375, 26959.455065204973, 26392.59161833839, 26578.82970698153, 26690.086450150462, 27100.112076632173, 27461.23607303833, 28174.645837339795, 27906.993178738125, 28267.609144010974, 28803.273460665652, 28923.142368998524, 29626.501857686653], [27267.130859375, 26759.957739598118, 27459.762163538955, 27762.52369318282, 27598.7309363265, 27254.132021827703, 25188.825938442806, 23793.833632986396, 23692.601648241627, 24428.647852182887, 24536.74628241662, 24975.86554644353, 23465.97278719595], [27267.130859375, 27579.158222534894, 26282.235842377417, 25873.80302012357, 25518.649759212723, 25690.483570018572, 24901.118116018377, 25139.73674890843, 25278.34778289732, 25455.229769210964, 24127.837774723626, 24645.128439482647, 23432.264794004026], [27267.130859375, 27098.000055238277, 26328.26189474818, 27782.21083927415, 27652.620342354265, 27706.047803703692, 27322.098751076872, 27835.53371846676, 28475.72451017814, 28598.66687443377, 29313.597474240767, 28920.54863647653, 28291.457477662447], [27267.130859375, 27235.492568195332, 26842.775481538316, 26689.954341652472, 29631.45593509602, 29322.006019769546, 29602.98202204091, 29805.691112142315, 30515.774884450067, 29925.81737813796, 30090.944021842068, 30373.65501973429, 29295.780929186178], [27267.130859375, 27121.76436254415, 27125.344806254634, 26757.58471130693, 27328.503338438582, 27636.868702796353, 27295.71108336172, 26309.14991663229, 26207.79904462052, 26346.253650894763, 26130.827570444053, 26131.23471077782, 25645.218082100924], [27267.130859375, 27626.076349430663, 27248.84497565231, 27490.28770947993, 28179.718934288405, 28528.742086430033, 28640.235706821008, 28005.502010306634, 28384.96923550602, 28053.662866796374, 28300.841740937092, 28157.33482351919, 28624.6433958065], [27267.130859375, 27094.46914236921, 26526.973768242442, 25841.354473700376, 26763.468460434546, 26901.16806657809, 27323.054362834624, 27179.792211066437, 27483.919444154624, 27819.38801473649, 27954.958744504944, 27768.11470107735, 28041.450624746856], [27267.130859375, 26658.796245017864, 26935.016281646138, 27608.455513068926, 28309.02053484581, 28460.53686715765, 27573.45787537816, 28271.92604739393, 27679.081389726372, 27547.17890044458, 27384.379362356107, 27914.821054915465, 28052.72196482801], [27267.130859375, 27175.711104316742, 26671.94753091903, 26798.422373314042, 26736.560113721793, 27288.784508171695, 27181.21533998257, 27261.234991698395, 27149.1719155268, 26956.04905800726, 26732.485035811285, 26619.14186206929, 26550.20966370784], [27267.130859375, 26808.169038458323, 26990.991303437902, 27062.871660697314, 27642.438741755, 26729.684224089367, 26302.412024191355, 26347.300084486975, 26642.422556183905, 26331.17333249717, 26097.450304503032, 26165.575471978183, 25797.13120233132], [27267.130859375, 27604.65211170589, 27822.59045919056, 28559.852571524832, 28929.359264451297, 28176.464111674304, 28094.535782256728, 27843.243273457385, 27710.319742438514, 27623.03881787898, 28395.931724234928, 28343.596623636895, 28630.888844920653], [27267.130859375, 26676.13452489905, 27204.622988549396, 27438.08812197452, 27644.34866616331, 27158.390550338845, 26950.675691287088, 26931.528511598914, 27354.22146883033, 27159.809925292757, 27061.16789576243, 26542.548448204478, 26270.598522407185], [27267.130859375, 27730.861841770806, 28753.836167390164, 28728.32422639492, 29758.01404312672, 29755.66634194187, 29601.021322921068, 29518.31721105122, 29715.934589612487, 28661.4465520372, 28518.38143436911, 28809.07333790931, 28041.947781362887], [27267.130859375, 26637.88761899429, 26020.61282795997, 26024.168248269663, 26086.29116445673, 27085.856919794256, 27534.980213997354, 26865.791461769677, 27318.70232033068, 26725.871012773838, 26712.25960585438, 26791.67403516035, 26582.7504609222], [27267.130859375, 27578.646606494487, 28288.02989736072, 29159.64320923237, 29109.506421205515, 28805.37613175051, 28517.34699745127, 28828.366312676568, 28907.002481140695, 28928.72155334556, 28499.54765945309, 28187.93934452906, 28148.690540197844], [27267.130859375, 27697.963928038866, 27501.45022328322, 28546.61379105984, 28456.002144629678, 29122.739492600213, 30276.20287580055, 30179.95445745492, 29397.448859840468, 29783.95467369244, 29667.285568104955, 30246.063219446285, 29918.485798703914], [27267.130859375, 27106.266000610656, 27501.445560612563, 27945.22764302737, 28267.20856903439, 27757.898273422747, 27601.63581488045, 27722.064142272207, 28044.64223763983, 28156.246752553638, 27947.299073796, 28098.752955060096, 28196.085238004605], [27267.130859375, 26610.14474268555, 26512.914191321335, 26082.45610077008, 26546.503903195866, 26114.264305829503, 26699.62496915473, 26327.081004229636, 26493.569004986584, 26413.056718272164, 26235.194271809047, 25656.49857182994, 25600.83623454324], [27267.130859375, 26829.00666379737, 26205.39957094446, 25971.85099449023, 25581.347909976004, 25566.10913497572, 24613.842296865416, 23261.51179791043, 23004.786399257722, 23108.447415166327, 24074.889824303253, 22801.083359988806, 23288.572856757044], [27267.130859375, 26493.954985998167, 25821.975897740398, 26138.058133030107, 25907.35031034589, 26327.067947848092, 25542.525449897195, 25355.275750585923, 25691.165127359473, 25684.528547797512, 25808.162755884518, 25905.556305511567, 26199.305203484157], [27267.130859375, 26806.851994838133, 27312.521627173737, 27234.042572522423, 28123.392394927363, 27093.113469498887, 26944.807596794344, 27542.263785413183, 26863.80173982801, 25879.536653771847, 25793.743445054723, 24791.965125749255, 24584.163228780406], [27267.130859375, 27209.602932848946, 26911.31986682307, 27111.982394004175, 27884.825938562077, 27946.03500190762, 27706.56380468143, 27701.858312753164, 27966.080876591437, 27323.02131037039, 27195.717223540345, 27674.55450844261, 27336.793855297412], [27267.130859375, 26894.356381566802, 28007.71685137701, 28501.85757036378, 29294.875268150696, 29771.08501165212, 29735.19665728221, 29304.264126519534, 29182.726929522545, 29246.21306597027, 29346.688979850816, 29188.665604862108, 29194.672001932802], [27267.130859375, 27240.7626878171, 27243.346103436947, 27239.567215171042, 26639.415375633947, 26590.454402128453, 27387.24371341738, 27597.545374250916, 27701.927146518083, 26993.717363033495, 27788.086698117626, 28379.19577599935, 27105.028970740113], [27267.130859375, 27348.99979962428, 27260.430874397873, 27766.94944001234, 27970.228296316396, 27013.368164678348, 27418.680898956787, 26925.38713247403, 27079.055061462306, 27167.546776883406, 26652.34401148123, 27053.61991432097, 27280.510380599124], [27267.130859375, 27242.836469953127, 27383.55653925608, 27238.777169111534, 28457.436460879202, 28245.62901129633, 28318.78914570046, 28346.335686810216, 28776.642015005837, 28928.099360553995, 28979.683614419882, 29098.517109226566, 28592.420624392278], [27267.130859375, 27482.28517197817, 26757.646273575552, 26771.71596816057, 26694.85950864844, 27365.599948640778, 26708.541662241678, 26489.726528940035, 26462.27301075272, 26471.419323785572, 26918.274090736882, 26432.02871389733, 26946.82425156129], [27267.130859375, 27510.32463412335, 28171.334776819815, 27774.572233185176, 28069.016906813053, 28483.139319314323, 29624.888451327748, 29973.249467630954, 29650.303854339236, 29317.930900253054, 29238.160339373047, 29429.68421740552, 29860.03600643044], [27267.130859375, 27907.108551749083, 27685.965959262234, 26806.161412612786, 26429.610039303006, 26790.781447092562, 26980.20507067256, 27085.989303517163, 26989.457224450816, 26536.357921662137, 26827.288478252118, 26327.791174304377, 26392.67134467677], [27267.130859375, 26750.768994778882, 25812.845601762176, 26054.90259621658, 26491.79983946998, 26642.01742866121, 25353.156590365106, 25692.427683373862, 25883.432137509237, 25117.958021125145, 24822.13963103479, 25436.4191087569, 26415.727231922767], [27267.130859375, 27025.953302725848, 26543.38178467313, 26183.131116259443, 26640.924366548516, 26176.45053458882, 25529.018626177723, 26177.17745227953, 25858.80623200601, 25801.705195238184, 25820.14888655071, 25744.14624451306, 25658.019752630265], [27267.130859375, 27613.910601976087, 27455.807524868782, 27239.820334647764, 27756.386442198607, 28049.68635382816, 28358.886096498365, 28290.336010450126, 28094.513179257425, 27703.24400498415, 27930.165860828645, 27611.301621463215, 27478.44430653395], [27267.130859375, 27298.761154516564, 27451.42571393972, 27788.754068144037, 26792.788127310723, 26743.69304771336, 27249.501950306854, 27191.181234865882, 26597.505881550067, 26523.33434130528, 26316.775539093607, 26167.125404325423, 26820.491588943845], [27267.130859375, 27562.553600154344, 26747.795858563226, 27056.523222407985, 26441.80260778559, 26523.627108322074, 26134.32073216405, 26307.477388176136, 26578.55391492888, 26838.55560100043, 27080.200672509905, 26454.395421345307, 26868.601775339783], [27267.130859375, 27036.12419022366, 27760.3320060603, 28685.511491719706, 28714.62003275436, 28488.714347188994, 28655.90102631908, 29052.99930099197, 29355.62877433884, 29170.472738906017, 30093.946736747526, 30493.875526804117, 30608.610795950826], [27267.130859375, 27628.500425682174, 28424.45641226704, 28790.97658171265, 29124.20247511447, 28435.21861816533, 28274.308918322036, 28267.913244106963, 28248.751307482653, 27508.984003818903, 27728.510434914708, 27591.71203430522, 27279.558190497144], [27267.130859375, 27119.885221890203, 27740.903587812696, 27885.682518238158, 26898.406259406343, 26737.20763374855, 27186.821180642215, 27743.742919476583, 27856.52192694423, 28560.645984742572, 28208.755709658148, 27813.31394603796, 28078.97262513587], [27267.130859375, 26728.329147828055, 26579.529092753022, 26252.393373893425, 26589.895259982943, 26884.995553348283, 27154.313412556305, 23652.7308789096, 24017.78604617143, 23717.175467502548, 23488.4917555555, 23256.276364345533, 23523.63179343334], [27267.130859375, 27169.4702010872, 27667.46104392589, 27747.203735234467, 27536.66311094841, 27956.70004479116, 27348.9070825626, 27592.88513101849, 27729.160002219283, 26542.26909405498, 26311.97973769372, 26354.54464814421, 26396.442706576752], [27267.130859375, 27255.392465851273, 26961.499126590894, 27054.054689419772, 27024.923597471534, 27360.45585637953, 26601.707706075398, 26821.393180089523, 27096.528494091228, 27010.6556770991, 26736.501531337744, 27177.41096301727, 27582.87261566596], [27267.130859375, 26658.445292957884, 26294.429126491712, 25088.00878043079, 25285.14422077942, 26620.760208843258, 26214.766739313254, 29059.128009872355, 29147.333664553724, 29071.729641253027, 29292.58175571688, 29482.962462213924, 29113.113724530744], [27267.130859375, 26879.539536900433, 26641.316202930393, 27385.7698874532, 27256.023570261557, 27714.523895020655, 27888.7257030455, 27881.254382109368, 27774.572980635017, 27531.843667507874, 27526.54192222514, 26878.345456415453, 26372.079593902967], [27267.130859375, 25811.133143111856, 26366.1788909208, 25688.216394210565, 25819.198676455002, 25079.325154487768, 24633.425621593473, 24834.259775877195, 25318.080401270607, 25713.873783592677, 25710.47232937887, 26084.819771758197, 26097.987795534023], [27267.130859375, 27420.06443628467, 27613.473923272584, 27793.90659284514, 27784.90216659009, 27149.09036862305, 26682.033810319135, 26561.558237099238, 26398.456558253114, 26176.6958750104, 26360.89783003479, 26574.72420643468, 26882.96923221906], [27267.130859375, 27333.645884983416, 27257.290982460323, 26826.84157610477, 26531.98642052505, 26358.967666694538, 27238.636725854372, 26973.963023818793, 27123.653308911147, 26122.044298655146, 25839.01110808385, 25740.414194408946, 25690.525837640733], [27267.130859375, 27685.596564995503, 27832.108255994543, 27998.13041598311, 27286.81172683546, 26472.62273185593, 26976.19136026744, 27928.25518728615, 27688.942460626946, 27673.172278729275, 27501.13587892087, 27971.314766945714, 29454.27561996876], [27267.130859375, 26467.790957873294, 26759.704184242364, 26106.90966101784, 25494.960866522553, 26240.41896832833, 27035.281568401504, 26974.975040321253, 27207.750718536423, 26680.883867946555, 26145.810875907006, 25804.830604687904, 26668.10351735926], [27267.130859375, 26980.57894844171, 27430.74830673905, 27335.06148813566, 27793.53929726743, 28283.24095557976, 28366.480610894738, 28031.44252222841, 27695.25858830163, 27708.031234225797, 27718.48865097257, 27094.4115012879, 26764.10705487519], [27267.130859375, 27649.195779776634, 26761.77599607052, 26114.367783543625, 25255.244428378002, 23576.0135338315, 23796.2700415901, 24856.069892020936, 25211.85382517624, 24894.41771168161, 24513.358534227627, 23995.692191357226, 23407.31012124949], [27267.130859375, 27905.250860454275, 28698.16892060309, 29458.848460975267, 28817.37933947186, 29259.762648296037, 29355.67344349033, 29833.08543360172, 29302.811297654083, 29553.92890442998, 30197.317299407732, 30626.551036856177, 30981.60576521389], [27267.130859375, 27944.25913534051, 28417.772938629223, 28976.086649365785, 27945.88817032404, 28232.25977297378, 29006.21660140772, 29242.827840480233, 29368.693242879846, 29582.123565858932, 29030.24249775212, 28843.813955819885, 29156.878411205278], [27267.130859375, 27703.49725693987, 27588.815684361914, 27249.57140603712, 26213.251431324647, 25996.693441682626, 25717.94640455972, 25985.50059556703, 25696.04189598756, 26099.58195015764, 25696.830282812483, 25992.008159676905, 25332.084327833152], [27267.130859375, 27424.509334129416, 27662.769643835294, 27852.595892347566, 27556.187767713283, 28852.756604020684, 28693.13534768218, 30077.87344698899, 30102.913063804397, 29851.052878857972, 30388.788496682668, 30962.183870605775, 30927.99294353436], [27267.130859375, 27206.714027372604, 27482.206330824043, 28236.046702627336, 28676.160279720072, 28728.870450558083, 28564.60966072108, 28249.82496847269, 28447.531450991093, 28705.42602789705, 28610.6976952552, 29028.03913695067, 28614.65873868892], [27267.130859375, 27495.475737870605, 27024.059781855714, 26524.500621450825, 27561.855925499283, 27385.66176280175, 27145.32993337999, 26165.90994940876, 26082.46874763505, 26038.30104179005, 25685.99472295401, 25276.992317458265, 25169.306679114958], [27267.130859375, 26888.55256152824, 26245.315380544427, 26631.295573669446, 29176.627868860603, 28123.24651188167, 27664.708065834006, 28171.33148274359, 27949.632537637866, 27865.311232666532, 28350.269681911606, 28432.995132309818, 28617.272371765135], [27267.130859375, 27630.27755738252, 27387.703315352, 28030.06795718627, 28166.420903607595, 27938.12090286012, 25487.34579134496, 26330.63960592992, 26164.63817390121, 25954.699241389037, 26323.912963596882, 26327.167309699587, 27502.969751854343], [27267.130859375, 26972.824635535657, 27905.42113774447, 26679.38589687777, 25901.128089647824, 25742.877323332967, 25888.851517311698, 25338.526930333646, 25356.77585766288, 25769.818889543116, 26012.524241961975, 26032.341966097712, 26758.60792457135], [27267.130859375, 27356.706458077388, 27290.78809829675, 31413.86098395701, 31866.904254271452, 32401.397552040344, 33370.55821863325, 33239.10887331018, 32269.49835680139, 31998.54635358946, 32628.093922768716, 32808.1477891488, 32889.8914680764], [27267.130859375, 27347.85313316035, 26011.439144563232, 26606.385032861406, 26438.922966528036, 26024.598782727284, 25608.887155042637, 26026.82198339158, 27113.737343410463, 27526.395458967858, 27527.611808152047, 27468.56168559715, 27655.35772197229], [27267.130859375, 27754.81065538187, 27109.868473118182, 27570.704769386284, 27857.750740199932, 28042.915754628873, 28265.95881381363, 28113.432801474723, 27601.378038205574, 27733.16953866419, 26921.119426180696, 26405.190251338805, 25822.34580036021], [27267.130859375, 26794.462643335803, 26802.105367026943, 27694.849230488206, 27307.396920625677, 27691.91269911242, 27172.62702683534, 27764.657358337874, 27844.708962630266, 27898.471224444063, 28086.957103822104, 27999.76132088686, 28396.670165462645], [27267.130859375, 26843.25856584464, 27280.5558707262, 27033.348790153836, 25568.82874939584, 25295.5955298737, 26007.371833879653, 25615.913145426017, 26020.1163528638, 25863.99575373376, 26047.599778471864, 26097.883668800026, 25701.513682798555], [27267.130859375, 27529.59119762463, 27039.992490367204, 27045.982162464825, 26943.611565902676, 25755.760675041376, 24663.56373974443, 25400.92798136101, 25657.415995837386, 25761.131813199747, 25614.027852459847, 25426.448990935034, 25828.45859549601], [27267.130859375, 27299.162619111637, 27209.581369828065, 27612.926578368475, 27779.12381252064, 27710.390266240505, 27048.08418128729, 26443.848669583913, 25995.06955055197, 26202.422722064453, 26451.506574866933, 25880.597388144026, 25312.2977181678], [27267.130859375, 27015.761730446888, 27464.628812977462, 27435.52171563358, 25980.196169676066, 25326.461772394596, 25357.849880851874, 25595.806589359236, 25822.552059560283, 25693.97402959115, 25993.550704786456, 25745.68691992582, 25876.35438065936], [27267.130859375, 27303.520965565403, 27912.40696288302, 27838.238735322288, 27440.48935425627, 27040.099558558977, 27442.947748585004, 27692.46502799187, 27671.02458926324, 27911.275877414733, 28146.110760409272, 28101.78584990382, 28503.465272802037], [27267.130859375, 26692.554458529605, 26751.405274299443, 28361.0410817989, 27977.809551222104, 28254.61590472317, 27418.613864799354, 27632.860070532024, 27853.47028615071, 27758.608879744577, 27841.77645250451, 27091.316408014736, 26293.988053367513], [27267.130859375, 26802.413403759016, 26161.97870952382, 26594.833674814003, 26369.77650426362, 25991.800962708596, 26887.13225514166, 27071.896589059095, 26440.95198202709, 26121.07603677044, 25594.134782550154, 25192.579244088905, 24526.97896876045], [27267.130859375, 27215.51040861127, 26503.9053555306, 26513.12521484297, 26524.06431082713, 27995.620657795404, 27670.088724204194, 27496.402954978537, 27718.529112466214, 27514.83027545648, 27485.495944166574, 27605.62133800692, 27813.828321517936], [27267.130859375, 27607.60388141927, 27888.517266195417, 27980.83520332806, 27222.428469108152, 25270.945378258522, 24352.592116204705, 25326.691102251287, 24759.3224928151, 24647.893229616388, 23431.397028694286, 23142.07996688148, 23054.23736025652], [27267.130859375, 27021.62957126276, 27114.40120114697, 27542.66846591281, 26981.562348795094, 27389.02325670764, 28419.5644043659, 29176.228934092505, 28921.460402292993, 29214.785944951567, 29135.877219970007, 29502.0127158178, 29983.294162601105], [27267.130859375, 26609.338742554537, 26971.184329022228, 27323.2017719181, 27956.672278889142, 26418.41215923013, 27392.09966512955, 26590.335690548553, 26703.06435356478, 26205.815560837145, 26742.93828479486, 26253.18057091659, 26369.36031006145], [27267.130859375, 27114.557243057487, 27542.734558988246, 28483.65686444672, 30165.1493080319, 30176.420935290065, 30374.01507576039, 29823.189750766087, 29990.61560598156, 30080.345355921872, 29742.250623668522, 30079.599691799165, 30155.431519729176], [27267.130859375, 26773.496731386265, 26240.594785733352, 26131.984431902885, 26014.354503198578, 26034.628399896075, 26450.673283072323, 26690.841572814585, 26924.867656143753, 26311.220955395893, 26827.25332385212, 26636.20870470606, 27033.227806770585], [27267.130859375, 27403.408207445864, 26898.756390965296, 26110.55218393077, 26172.165900541404, 27276.88028729244, 27332.626424353904, 27633.989245214918, 27261.969695131265, 27328.060121780523, 27730.841250141842, 28310.76795044502, 29270.948304505397], [27267.130859375, 26702.111223638156, 26558.668257947345, 25621.750057203815, 26128.66246281449, 25264.566902920353, 25839.85714587361, 25448.211741827014, 25509.06649270538, 25855.410568401203, 25717.67668658228, 25502.176087730477, 24929.102488514578], [27267.130859375, 27394.442961863628, 27403.29083847237, 25084.744560614294, 25224.054307554223, 25297.32361353963, 25936.31564179057, 25330.12169066776, 25667.871783443887, 25749.223758355747, 25499.06847836444, 25330.35765061298, 24953.3462032552], [27267.130859375, 27302.493409014758, 27220.731621806324, 26882.518792981587, 27967.043012437247, 28157.159748828893, 27291.285670759396, 27519.583482393384, 27477.342503425614, 28112.14855669922, 28314.420226343835, 28414.46240544191, 28157.255654370856], [27267.130859375, 27143.913587799583, 26983.710461954634, 26676.510468394546, 26699.991366267404, 26520.431739429634, 26741.37628011218, 27247.184605004193, 27175.89464779085, 27078.01856543501, 26979.07863521237, 26991.117663215246, 26698.072877565017], [27267.130859375, 27348.025412142386, 28250.332340419434, 27448.983192389373, 27067.411569982938, 26697.580105054098, 26216.43172535981, 27111.627841613496, 27353.141188528283, 28330.70656057089, 27600.014876385405, 28128.698406674714, 27763.81721399013], [27267.130859375, 27306.36466354744, 27260.446405466246, 25966.781476057233, 25030.136296382418, 24982.84117093597, 25230.819686262646, 27877.768606184636, 28035.876827995417, 28718.488536105237, 28556.4951713118, 28109.85933512346, 27985.558306397128], [27267.130859375, 27069.138991859174, 26796.45951185346, 25827.68214729034, 26095.977765684212, 25494.72768255823, 26105.75747623527, 25756.68959899161, 25297.57960296439, 25093.200164965943, 24440.094046389422, 24424.40825750931, 23373.6022781863], [27267.130859375, 26297.918702493225, 26608.499166290472, 25814.380757572417, 26201.916820465078, 26264.94858808162, 26559.26028897028, 27248.362940687784, 26764.090817048895, 27314.94471983351, 27495.330154439995, 27059.282120130578, 26581.933125065134], [27267.130859375, 27346.655638252727, 25989.727231476, 26292.788825695294, 25871.359908611208, 24683.617422481417, 24245.651922539702, 23423.737273051862, 23415.814878811423, 23396.52910169303, 23310.93603673958, 23926.627822650986, 24092.684895035894], [27267.130859375, 27348.15804948213, 27181.00302257683, 27041.426213245344, 26864.60411648043, 26317.76380441854, 26265.59160970587, 24645.57375371041, 24319.13312449091, 24391.777548370857, 24182.303398932923, 23896.897412400096, 24450.233812505525]]

然后使用以下代码将其绘制成每天的子图:

for each_day in range(1, len(simulations[0])):
    temp = []
    for each_simulation in simulations:
        temp.append(each_simulation[each_day])
    plt.title('Day ' + str(each_day))
    plt.subplot(np.ceil(len(simulations[0]) - 1 / 2),2,each_day)
    plt.hist(temp, label='Day ' + str(each_day))

我打算在其中创建一个包含两列的子图,其中包含要绘制的所有图形。但是,我最终遇到了这个问题:
enter image description here

我想保留每个图形的大小,而不是将它们全部压缩成一个图。与我得到的图不同。有没有一种方法可以按原样保留所有原图(按原样,我指的是如果我分别绘出它们的原样,它们会得到的尺寸)

非常感谢

1 个答案:

答案 0 :(得分:2)

您可以创建图形并根据子图的数量设置其大小:

fig,ax = plt.subplots(np.ceil((len(simulations[0]) - 1) / 2).astype(int),2,figsize=(4*2,4*np.ceil((len(simulations[0]) - 1) / 2))) #create figure and specify the size of it. figsize(width,height)
ax=ax.flatten() #flatten the axes to make them iterable
for each_day in range(1, len(simulations[0])):
    temp = []
    for each_simulation in simulations:
        temp.append(each_simulation[each_day])
    ax[each_day-1].hist(temp, label='Day ' + str(each_day)) #plot to the specific subplot
    ax[each_day-1].title.set_text('Day ' + str(each_day))   #add title

output