@@ -105,24 +105,22 @@ def _plot_single_timeline(
105105
106106 plt .figure (figsize = figsize )
107107
108+ # Convert index to datetime
109+ timeline_df .index = pd .to_datetime (timeline_df .index , errors = 'coerce' )
110+
108111 # Plot each algorithm
109112 for algo in timeline_df .columns :
110113 algo_data = timeline_df [algo ].dropna ()
111114 if len (algo_data ) > 0 :
112- x_positions = range (len (algo_data ))
113- plt .plot (x_positions , algo_data , marker = 'o' , linewidth = 2 ,
115+ plt .plot (algo_data .index , algo_data , marker = 'o' , linewidth = 2 ,
114116 markersize = 6 , label = algo )
115117
116- plt .xlabel ('Run Index (Chronological Order) ' , fontsize = 12 )
118+ plt .xlabel ('Run Timestamp ' , fontsize = 12 )
117119 plt .ylabel (f'{ aggregation .title ()} { metric .upper ()} ' , fontsize = 12 )
118120 plt .title (f'{ aggregation .title ()} { metric .upper ()} Performance Timeline - All Outcomes' ,
119121 fontsize = 14 , fontweight = 'bold' )
120122
121- # Set x-tick labels to show actual timestamps (abbreviated)
122- run_timestamps = timeline_df .index .tolist ()
123- tick_positions = range (0 , len (run_timestamps ), max (1 , len (run_timestamps ) // 10 ))
124- tick_labels = [run_timestamps [i ][:10 ] + '...' for i in tick_positions ]
125- plt .xticks (tick_positions , tick_labels , rotation = 45 , ha = 'right' )
123+ plt .xticks (rotation = 45 , ha = 'right' )
126124
127125 plt .legend (bbox_to_anchor = (1.05 , 1 ), loc = 'upper left' )
128126 plt .grid (True , alpha = 0.3 )
0 commit comments