@@ -132,22 +132,32 @@ def ts_ppos_inequality_unb(
132132
133133def ts_ppos_dex (
134134 ppos_dex_v1 : list [float | None ],
135+ x_axsis_v1 : list [int ],
136+ x_ticks_v1 : list [str ],
135137 ppos_dex_v2 : list [float | None ],
136- x_axsis : list [int ],
137- x_ticks : list [str ],
138+ x_axsis_v2 : list [int ],
139+ x_ticks_v2 : list [str ],
138140 x_ticks_rotation : int = XTICKS_ROTATION ,
139141 x_ticks_number : int = N_XTICKS ,
140142 save : bool = False ,
141143) -> None :
142144 plt .suptitle ("PPoS Dex" )
145+ plt .subplot (2 , 1 , 1 )
143146 plt .title ("(1 = perfect decentralization)" , fontsize = "medium" )
144- plt .plot (x_axsis , ppos_dex_v1 , label = "PPoS Dex V1" )
145- plt .plot (x_axsis , ppos_dex_v2 , label = "PPoS Dex V2" )
146- plt .xticks (x_axsis , x_ticks , rotation = x_ticks_rotation )
147+ plt .plot (x_axsis_v1 , ppos_dex_v1 , label = "PPoS Dex V1" )
148+ plt .xticks (x_axsis_v1 , x_ticks_v1 , rotation = x_ticks_rotation )
147149 plt .locator_params (nbins = x_ticks_number )
150+ plt .ylim (0 )
151+ plt .grid (True )
148152 plt .legend ()
153+ plt .subplot (2 , 1 , 2 )
154+ plt .title ("(1 = perfect decentralization)" , fontsize = "medium" )
155+ plt .plot (x_axsis_v2 , ppos_dex_v2 , label = "PPoS Dex V2" )
156+ plt .xticks (x_axsis_v2 , x_ticks_v2 , rotation = x_ticks_rotation )
157+ plt .locator_params (nbins = x_ticks_number )
149158 plt .ylim (0 )
150159 plt .grid (True )
160+ plt .legend ()
151161 plt .tight_layout ()
152162 if save :
153163 plt .savefig (fname = "./docs/images/timeseries/ppos_dex" )
@@ -339,9 +349,21 @@ def timeseries(ppos_dex_data: list[dict], save: bool = False) -> None:
339349 ts_ppos_inequality_unb (ppos_theil_l , ppos_theil_t , x_axsis , x_ticks , save = save )
340350
341351 # PPoS Dex
352+ ppos_dex_data_v2 = [d for d in ppos_dex_data if d .get ("ppos_dex_v2" )]
353+ x_axsis_v2 = list (range (len (ppos_dex_data_v2 )))
354+ x_ticks_v2 = [d ["timestamp" ][:10 ] for d in ppos_dex_data_v2 ]
355+
342356 ppos_dex_v1 = [d .get ("ppos_dex" ) for d in ppos_dex_data ]
343- ppos_dex_v2 = [d .get ("ppos_dex_v2" ) for d in ppos_dex_data ]
344- ts_ppos_dex (ppos_dex_v1 , ppos_dex_v2 , x_axsis , x_ticks , save = save )
357+ ppos_dex_v2 = [d .get ("ppos_dex_v2" ) for d in ppos_dex_data_v2 ]
358+ ts_ppos_dex (
359+ ppos_dex_v1 = ppos_dex_v1 ,
360+ x_axsis_v1 = x_axsis ,
361+ x_ticks_v1 = x_ticks ,
362+ ppos_dex_v2 = ppos_dex_v2 ,
363+ x_axsis_v2 = x_axsis_v2 ,
364+ x_ticks_v2 = x_ticks_v2 ,
365+ save = save ,
366+ )
345367
346368
347369def snapshot (ppos_dex_data : list [dict ], save : bool = False ) -> None :
0 commit comments