Search code examples
rperformanceanalytics

Plot more than 12 data groups on one chart using PerformanceAnalytics


I am using this function to call the plot:

charts.PerformanceSummary(bonds.returns, method="HistoricalVaR")

It works fine, however I have more than 12 groups of data that need to be displayed. But charts.PerformanceSummary only display 12 at max.

ncol = 25 actually. I know I can split the data into two sets.

Is there any possibility to life the limit of this function?

Thank you.

 structure(c(0.0167975628161772, 0.00697269562030423, -0.00223837817672268, 
-0.00999498426884327, -0.0126198656951519, -0.00417953334763821, 
-0.00555550350849254, -0.00510607830576182, -0.0131526617805806, 
-0.0220885268238387, -0.00764362458911849, 0.00643687707641205, 
0.0049023942153712, 0.0156228613886553, -0.0140830156713256, 
0.00299743216723125, -0.00581146328167581, 0.000910595215948273, 
0.0134117232743778, -0.00371639557893721, 0.0151632593740918, 
0.00280601288475291, 0.00198916902226154, 0.00338152320522811, 
-0.00892705000284, -0.00301840654879604, 0.00455089820359267, 
0.0101192179303768, 0.00109525922708698, 0.0075452479085516, 
-0.000430602750240983, -0.000618087487474384, 0.00222086866888427, 
0.0106496372204352, 0.00136921667853951, 0, 0, 0.00511830301462513, 
0.00513819822966544, -0.00825773648401495, -0.00421396232330395, 
0.00112045336691602, -0.0206635649736849, 3.77789741119461e-05, 
0.012324924681016, -0.00442213680635895, 0, 0.00628783477331929, 
-0.000651860129440851, -0.00614080044728127, -0.00098235183571671, 
0.00326632521312353, 0.00718467950193036, 0.00671033035472512, 
-0.00300918726727117, -0.00403841127720028, -0.0101411979819186, 
-0.00611456035028313, -0.00423338696770748, 0.00132207695697617, 
0.00123403520883669, -0.00473182041491771, -0.00596671112111824, 
-0.00431241015812167, 0.00381485694286465, 0.00496835939542928, 
0.00413717735220631, -0.00319590923617763, 0.00279888737727774, 
-0.000829545650934183, -0.000190262042722433, 0.0064614905542868, 
-0.00333462249151306, 0.00314744711857684, 0.000223498263590471, 
-0.000189071658158513, 0.00317184706367768, 0.000651214600916994, 
-0.000231201993474928, 0.00423968343697001, 0.0024904263575809, 
-0.000195676402276579, 0.000280808046426939, 0.00478090360779571, 
0.0034797185745854, 0.00118963247949777, 0.00225845868621755, 
0.00188341335037356, 0.00505215807715875, -0.00536911630858639, 
-0.00483562241848279, -0.00124008773409823, -0.0049918491802724, 
-0.00277584421317134, 0.00722706958927444, 0.00665122882931612, 
-0.00337500314832384, -0.000210599027874903, 0.000783593407704508, 
-0.0072993929801225, 0.0163545203735145, 0.00965089722675372, 
-0.00464683414227474, -0.00944094539315621, -0.00555205957156724, 
0.00198406159159958, -0.0114926649562528, -0.0080525478660749, 
-0.0120561142680791, -0.0177785625033954, -0.00271021446646103, 
0.00892225780957512, 0.00406780592717815, 0.0111343028229256, 
-0.0127375602360713, -0.00143278261465696, -0.00394065673035349, 
0.00794695596435258, 0.0131974835886213, -0.00261861375447103, 
0.0145552232342232, 0.00296799236992529, 0.00130338214366477, 
0.0019193220609135, -0.00619767603719934, -0.00607624993330136, 
0.00208701020688928, 0.00716543447980289, -0.00110373808162345, 
0.00730203951222119, -0.000343622174203362, -0.00819027347184287, 
-0.00430557592076686, 0.0121157759451644, 0.00511236623854172, 
0, 0, 0.00769205461424582, 0.00476022566995749, 0.00471167781222182, 
-0.00409449022626429, 0.0158022927288668, -0.0175194056189978, 
0.000527144697965776, 0.0112463330709838, -0.00274654591298529, 
0, 0.00286375861868815, 0.00154998874489487, -0.00506016978539237, 
-0.0025230276331597, 0.00410527161039065, 0.010046282875336, 
0.00898636210684667, -0.00302108876900453, -0.00316798173983202, 
-0.0125542834583497, -0.00591715976331364, -0.00294602638352648, 
0.00305557516412369, 0.00724870810126066, -0.00519029414993954, 
-0.00567891077287375, -0.000837529389209002, 0.00349431416510138, 
0.00592770017310085, 0.00419197022600626, -0.00386561989399437, 
0.00331052968474954, -0.000159497582614687, -5.98211348069588e-05, 
0.00847516775846757, -0.0040635535825515, 0.0042985347258071, 
0.000523896604556873, 0.00045446462091725, 0.00434507821140784, 
0.00128805160072365, -0.000736485491235728, 0.00632861635220117, 
0.00281239014100998, -0.000272659992988644, 0.00102275383776207, 
0.00580914478101358, 0.00408258034556819, 0.00104058272632668, 
0.00261800261800271, 0.00270716534828352, 0.00604116802297749, 
-0.00618570436139743, -0.00544857369938045, -0.00127091717856376, 
-0.00569748385230895, -0.0062149138541191, 0.00600987336338266, 
0.0090579358767966, -0.00434414885437484, 9.65288235066364e-05, 
0.00413103488214972, -0.00852605878847301, 0.0154416997051945, 
0.00895994553954904, -0.00223249722178132, -0.0111277956224703, 
-0.0104384553499598, -0.00529460783317415, -0.00873509669905292, 
0.00074206913610797, -0.0120187851449052, -0.0131761370151463, 
0.00104577096559533, 0.0071439123736361, 0.0064645914315351, 
0.00359150530918173, -0.00837093511747322, 0.00164229377183611, 
-0.00340452195707786, 0.0042963878904736, 0.0114254113669801, 
0.000123795572245067, 0.00838611185608484, 0.00586135291891288, 
0.00439327990888017, 0.00718885423838644, -0.000100528781390219, 
-0.0101041582884259, -0.00149300724159296, 0.00248189437708524, 
0.000842160801980629, 0.00683299709040042, 0.00444050627813075, 
0.00112276199450645, -0.00105140888790989, 0.00547308066278407, 
0.00292103243043851, 0, 0, 0.00586481113320092, 0.000484237572882851, 
-0.00360532996177376, -0.00299383389178576, 0.00743745774171733, 
-0.013728780102645, 0.00109077444985939, 0.012705172034627, -0.00264537207947957, 
0, 0.00207836422838259, 0.00152097263236906, -0.00595631379123318, 
0.00335532938150096, 0.00436963549214142, -0.0127522141572884, 
-0.0134677863590886, 0.00569768104381518, 0.0110815251260552, 
0.00425851422679946, 0.00766629841652433, -0.000941306755260163, 
-0.00648450922795551, -0.00615865223697409, 0.000303105143806492, 
-0.00305257841871953, 0.000731710062702007, -3.37465409795401e-05, 
0.00129366106080209, -0.000898775418492259, -0.000618463960418425, 
0.000900140646975967, 0, 0.0029003428699903, 0.00100882158429827, 
0.00047030894818767, 0.00132072303990149, 0.00343158624235729, 
0.000724072630054584, 0.00239327656258692, 0.0014991671293727, 
0.00080944724732479, 0.000354539209820759, 0.000498394063572771, 
0.000774893452150316, 0.00578507825894592, 0.00786336442020064, 
0.00264068177602228, 0, 0, 0.00319965173858616, 7.59392052420704e-05, 
0.00104137287657546, -0.000791053509893502, -0.000379572492923641, 
-0.00468678803133205, -0.00162411981426169, 9.8260784121118e-05, 
-0.00121176393528533, 0, -0.000623012099550846, -0.000229673863114344, 
-0.00217693325894563, -0.000927066181455993, 0.00301922331172788, 
0.0066830521112371, 0.0063369270018927, -0.00204448806018964, 
-0.00157748094730803, -0.00808453883246141, -0.0046268522923949, 
-0.00250775881179333, 0.00265296201125076, 0.00241043969744825, 
-0.002943615257048, -0.00458092505578889, -0.00378743046514385, 
0.00278847430620099, 0.0155483385370205, 0.00346557415299298, 
-0.00222945617682457, 0.00267310038520074, -0.000998031280761369, 
2.05279796363644e-05, 0.00600088952752387, -0.00298594768129934, 
0.00275611769441197, 0.000102049841142593, 0.000585026054067184, 
0.00299820515609706, 0.00120654244250273, -0.000324967672486798, 
0.0044426685809873, 0.00123386036476414, 0.000437716332879923, 
0.00273957849531858, 0.00459152849567035, 0.00344127119889892, 
0.00103217042132542, 0.00176285889146111, 0.00171327254978793, 
0.00391124782063956, -0.00422617986357376, -0.00459558214022815, 
-0.00130576133880522, -0.0056901566293992, -0.00344168260038247, 
0.00438933096363314, 0.00563025322734156, -0.00279936547715842, 
0.000287406258772549, 0.000354143140648189, -0.00736089773562221, 
-0.000970123022847158, 0.00231507543346088, 0.00665538714274683, 
0.00523750078457885, -0.00208824753711656, -0.00152948783014339, 
-0.00868965805360011, -0.00384909848213477, -0.00458317762281157, 
0.00225963888278913, 0.000975320159443571, -0.00468827225870216, 
-0.00573897251819588, -0.00343186569347254, 0.00204759586471548, 
0.00416541632728884, 0.00332989433989117, -0.00332593448830953, 
0.00246186247723124, -0.00149762225849948, -0.000206143063285924, 
0.00521151795236396, -0.00242603424739907, 0.00289988655700535, 
0.000417111467737374, 0.000212002148288537, 0.00234565982280377, 
0.000260802142806771, -0.000429858992156862, 0.00372234677044103, 
0.00235998145728855, -0.000988017658188123, 0.000196396130996312, 
0.00448116019271083, 0.00288335334692413, 0.00052210596662694, 
0.00196209401352609, 0.0015485465883367, 0.00427098572409146, 
-0.00483275225240765, -0.00419022512053846, -0.00105196424714893, 
-0.0067926633656461, -0.00232417705875732, 0.00952246894464559, 
0.00727143434794142, -0.00231864397394821, 0.00192166275859207, 
0.00133635224306383, -0.00550423189688565, -0.00181960534137537, 
0.00119107276437802, 0.00697834681368126, 0.00691557950395105, 
-0.00203180780815149, -0.00106098513903918, -0.00762137141626906, 
-0.00347114251209468, -0.00097965936880906, 0.00357381526571166, 
0.0240228720324263, -0.00383095724453808, -0.00517252389365475, 
-0.00218247175624797, 0.00230161112778937, 0.00471388635326342, 
0.00308052667068881, -0.00362300893722711, 0.00218028933220671, 
-0.000488966367617749, -0.000368676663476175, 0.00593646493088329, 
-0.00317986321652697, 0.00265951803308839, 0.00122746993051392, 
0.00073276074657036, 0.00283032816317341, 0.000435286270930701, 
-0.000392990729629505, 0.00421227034351057, 0.00228605784355529, 
-0.00052312928966014, 0.00158416670737593, 0.00452201783723516, 
0.0028924387350957, 0.000145242277952207, 0.00222672484734487, 
0.00163528348363684, 0.00338922337186376, -0.00470279696274822, 
-0.00436633028219058, -0.000159345988637871, -0.00154520950407788, 
-0.00265798714727872, 0.00581027200423057, 0.00663456615886981, 
-0.00276966427270531, 0.000916596601011843, 0.00336007160808349, 
-0.00546241842399631, -0.00057014606599215, 0.00335944220582229, 
0.00797790733353798, 0.00716268242456808, -0.00250688950128897, 
-0.00270034222158844, -0.0102497654260311, -0.0052005272756821, 
-0.00379372311266823, 0.00160344010786773, 0.00128251773694754, 
-0.00522342638602491, -0.00590835205376883, -0.00437262881341915, 
0.00222359595139454, 0.00505413168360591, 0.00341659567841868, 
-0.00346886239570598, 0.00287635344337978, -0.000630252100840334, 
-0.00127043898693913, 0.00370634746321108, -0.0044311934133866, 
0.0051927356650272, 0.00136664297818845, -0.000109182225133786, 
0.00454975613307118, 0.000516323055183232, -0.000543217477116942, 
0.00519960504742145, 0.00304595059792567, 0.00181483311621222, 
0.00192813007255133, 0.00722328637152936, 0.00474544339681326, 
0.000955219656297857, 0.00289826899117251, 0.00211455607538391, 
0.00480925627972817, -0.00345624135939659, -0.00407407082210187, 
0.00106676540858874, -0.00495825553950757, -0.00464663450900571, 
0.00465054241508112, 0.00700990414487146, -0.00345418589321034, 
0.00115538621650702, 0.00211429527895479, -0.00377132910780376, 
-0.000195485318023825, 0.00173913043478269, 0.00424268573307041, 
0.00367237128798958, -0.000856129479391732, -0.000663048800391697, 
-0.00670633988996294, -0.00279519062789035, -0.00376141305467959, 
0.00127233043352337, 0.00253109632629434, -0.00461660535237673, 
-0.00500036234509749, -0.00519196753719686, 0.000292853332775511, 
0.00201800520708084, 0.00296351949244511, -0.00272587290357484, 
0.000928495420118081, 6.25371314217915e-05, -0.00153206390895155, 
0.00442579486858308, -0.00174588988423074, 0.00156155655957857, 
-0.000498919008814269, 0.000842346089850343, 0.00439521617605809, 
0.000982785732020153, 0.000320383633563903, 0.00443227606157648, 
0.00133718717534648, -5.13615959075731e-05, -0.00041091387245229, 
0.00307284387075546, 0.00220280114340743, 0.000194238279253467, 
0.000429285444157212, 0.00135882058459935, 0.00174468432436847, 
-0.00371754784433165, -0.00355762743053423, -0.000471940084128319, 
-0.00438290359664972, -0.00120622287287242, 0.00543971924029729, 
0.00533842536984008, -0.00174619869903103, 0.000296656982691657, 
-0.00025566293398771, -0.00438829787234041, -0.000143882131757644, 
0.00275334094419444, 0.00671616088171145, 0.00636724763841645, 
-0.00157701896200046, -0.00125793301743127, -0.00927118451456499, 
-0.00376611831729079, 0.00189977260297636, 0.00238457781480728, 
0.00321008885067342, -0.00451402776984178, -0.00668694753759613, 
-0.00442055993759216, 0.00347282682299244, 0.00387533378963312, 
0.00358188889422384, -0.00377004631224398, 0.00208425379872068, 
0.000172527820111013, -0.000632492884455105, 0.00642482475571282, 
-0.00278219774565758, 0.00290461585499857, 5.71619111131572e-05, 
0.00103838202932227, 0.00405405405405412, 0.00127006994862855, 
-0.000141991669822095, 0.00575621301775153, 0.00313461918612856, 
-0.000187677120282226, 0.000272182906913443, 0.00450387051372281, 
0.00321330157395727, 0.000819374482071478, 0.00105128992343251, 
0.00263940520446093, 0.00399503170071558, -0.00563172229146469, 
-0.00571004131655906, -0.00133532542721071, -0.00826577650611982, 
-0.00506302857735508, 0.00330724181718245, 0.00591263282172383, 
-0.00270419996056381, -0.000602562774801529, 0.0005369810360909, 
-0.00806922396098153, -0.00102839633135343, 0.00473759401655549, 
0.00863592167030847, 0.00836503477656958, -0.00285773026315794, 
-0.00231953980330302, -0.0119243208613616, -0.00536481808769862, 
-0.00312270003154236, 0.00182464429983242, 0.00254774387804502, 
-0.00430545637837609, -0.00793098356852073, -0.00316798843365296, 
0.00383926286153069, 0.00524817270100297, 0.00391029570290202, 
-0.00371610240862397, 0.00394129270174037, -0.00129457331705474, 
0.00130679003888767, 0.00763053476892628, -0.0034782427040464, 
0.00350086473455269, 0.000584923594355358, 0.000751604989821963, 
0.00573711496135276, 0.00165945839426662, -0.000124253186576495, 
0.0056956454201833, 0.00323328013180268, 0.000923749602274482, 
0.00117925737548585, 0.00519286314193823, 0.00386179068890669, 
0.00129922858302889, 0.00266604492741873, 0.00286115801073694, 
0.00516160251628128, -0.00475397669147293, -0.00549217994195428, 
-0.000881575080811103, -0.00810344827586196, -0.00493859980981792, 
0.00412051213547326, 0.00683592750642159, -0.00429934849116242, 
-0.000530807235310848, 0.000551515646703082, -0.00977890288467431, 
0.00021592548607785, 0.00227654083545126, 0.00417070520163287, 
0.0040753848703774, -0.000728261397290875, -0.000524730346905034, 
-0.00606673407482305, -0.00311057203224041, -0.00303196812999196, 
0.00118104423994869, 0.00218235438682735, -0.00393341638302247, 
-0.00516022295314444, -0.00509789946744277, 4.97477787615441e-05, 
0.00154210442534231, 0.00248343548531293, -0.00219982758108161, 
0.00142013009583386, 0.000307423788651118, -0.00166552657407137, 
0.00477651661850431, -0.00158130892846553, 0.00197976678347289, 
-0.000375412459741931, 0.00162080961416833, 0.00383826025180567, 
0.00147438984833448, 0.00171758909379993, 0.00449726636750203, 
0.00136557388242409, 6.81855816717647e-05, -9.74013324506195e-06, 
0.00322401550644313, 0.00166993533855031, -2.90782204128703e-05, 
-0.000106623241928117, 0.00104695800535093, 0.0012976448713975, 
-0.00449718563221713, -0.00323511410334887, -0.000653021442495016, 
-0.00400846556718326, -0.00243826012024828, 0.00456450678786324, 
0.00495417147100796, -0.000281977733482375, 0.00109905073140371, 
0.00106869784025876, -0.00261066198235627), .indexCLASS = "Date", tclass = "Date", .indexTZ = "UTC", tzone = "UTC", class = c("xts", 
"zoo"), index = structure(c(1487635200, 1487721600, 1487808000, 
1487894400, 1488153600, 1488240000, 1488326400, 1488412800, 1488499200, 
1488758400, 1488844800, 1488931200, 1489017600, 1489104000, 1489363200, 
1489449600, 1489536000, 1489622400, 1489708800, 1489968000, 1490054400, 
1490140800, 1490227200, 1490313600, 1490572800, 1490659200, 1490745600, 
1490832000, 1490918400, 1491177600, 1491264000, 1491350400, 1491436800, 
1491523200, 1491782400, 1491868800, 1491955200, 1492041600, 1492473600, 
1492560000, 1492646400, 1492732800, 1492992000, 1493078400, 1493164800, 
1493251200, 1493337600, 1493683200, 1493769600, 1493856000), tzone = "UTC", tclass = "Date"), .Dim = c(50L, 
14L), .Dimnames = list(NULL, c("BE0000343526", "BE6248644013", 
"FR0010171975", "FR0013152907", "IE00BV8C9186", "SI0002103677", 
"XS0162513211", "XS0162869076", "XS0162990229", "XS0908570459", 
"XS1117298247", "XS1146286205", "XS1196380031", "XS1196817586"
)))

Solution

  • No problem at all:

    df
    ncol(df)
    charts.PerformanceSummary(df[, c(1:ncol(df))], method="HistoricalVaR")
    

    enter image description here