File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 66import pandas as pd
77import seaborn as sns
88from matplotlib .figure import Figure
9+ import matplotlib .dates as mdates
10+ from matplotlib .ticker import MaxNLocator
911
1012
1113def make_alert_plot (
@@ -101,6 +103,7 @@ def make_batch_plot(df: pd.DataFrame) -> plt.Figure:
101103 Returns:
102104 plt.Figure: The generated batch plot figure.
103105 """
106+ df ['metric_timestamp' ] = pd .to_datetime (df ['metric_timestamp' ])
104107 unique_metrics = df ["metric_name" ].unique ()
105108 colors = sns .color_palette ("viridis" , len (unique_metrics ))
106109
@@ -123,11 +126,14 @@ def make_batch_plot(df: pd.DataFrame) -> plt.Figure:
123126 label = "Metric Value" ,
124127 color = colors [i ],
125128 ax = ax1 ,
126- legend = True ,
129+ legend = False ,
127130 )
128131 ax1 .set_ylabel ("Metric Value" )
129132 ax1 .tick_params (axis = "y" , labelcolor = colors [i ])
130133
134+ ax1 .xaxis .set_major_locator (MaxNLocator (nbins = 5 ))
135+ ax1 .xaxis .set_major_formatter (mdates .DateFormatter ("%Y-%m-%d %H:%M" ))
136+
131137 ax2 = ax1 .twinx ()
132138 sns .lineplot (
133139 data = metric_data ,
You can’t perform that action at this time.
0 commit comments