      for service, events in services.items():
        start, end = get_interval(frame_id, service,timestamps)
        service_bars.append(((start-t0)/1e6,(end-start)/1e6))
        for event in events:
          points["x"].append((event[1]-t0)/1e6)
          points["y"].append(frame_id+0.45)
          points["labels"].append(event[0])
      ax.broken_barh(service_bars, (frame_id, 0.9), facecolors=(["blue", 'green', 'red', 'yellow', 'purple']))
  
    scatter = ax.scatter(points['x'], points['y'], marker="d", edgecolor='black')
    tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=points["labels"])
    ax.legend()
    mpld3.plugins.connect(fig, tooltip)
    #mpld3.save_html(fig, 'test.html')
    mpld3.show()
  
  if __name__ == "__main__":
 
</s> remove   #mpld3.save_html(fig, 'test.html')
  mpld3.show()
 </s> add   plt.legend(handles=[mpatches.Patch(color=colors[i], label=SERVICES[i]) for i in range(len(SERVICES))])
  #mpld3.save_html(fig, 'latencylogger_plot.html')
  mpld3.show(fig) </s> remove DEMO_ROUTE = "9f583b1d93915c31|2022-04-01--17-51-29"
 </s> add DEMO_ROUTE = "9f583b1d93915c31|2022-04-06--11-34-03" </s> remove import matplotlib.pyplot as plt
 </s> add 
        points['x'].append((event[1]-t0)/1e6)
        points['y'].append(frame_id)
        points['labels'].append(event[0])
    ax.broken_barh(service_bars, (frame_id-0.45, 0.9), facecolors=(colors), alpha=0.5)

  scatter = ax.scatter(points['x'], points['y'], marker='d', edgecolor='black')
  tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=points['labels'])
      for service, events in services.items():
        start, end = get_interval(frame_id, service,timestamps)
        service_bars.append(((start-t0)/1e6,(end-start)/1e6))
        for event in events:
        points['x'].append((event[1]-t0)/1e6)
        points['y'].append(frame_id)
        points['labels'].append(event[0])
    ax.broken_barh(service_bars, (frame_id-0.45, 0.9), facecolors=(colors), alpha=0.5)

  scatter = ax.scatter(points['x'], points['y'], marker='d', edgecolor='black')
  tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=points['labels'])
        points['x'].append((event[1]-t0)/1e6)
        points['y'].append(frame_id)
        points['labels'].append(event[0])
    ax.broken_barh(service_bars, (frame_id-0.45, 0.9), facecolors=(colors), alpha=0.5)

  scatter = ax.scatter(points['x'], points['y'], marker='d', edgecolor='black')
  tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=points['labels'])
        points['x'].append((event[1]-t0)/1e6)
        points['y'].append(frame_id)
        points['labels'].append(event[0])
    ax.broken_barh(service_bars, (frame_id-0.45, 0.9), facecolors=(colors), alpha=0.5)

  scatter = ax.scatter(points['x'], points['y'], marker='d', edgecolor='black')
  tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=points['labels'])
        points['x'].append((event[1]-t0)/1e6)
        points['y'].append(frame_id)
        points['labels'].append(event[0])
    ax.broken_barh(service_bars, (frame_id-0.45, 0.9), facecolors=(colors), alpha=0.5)

  scatter = ax.scatter(points['x'], points['y'], marker='d', edgecolor='black')
  tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=points['labels'])
        points['x'].append((event[1]-t0)/1e6)
        points['y'].append(frame_id)
        points['labels'].append(event[0])
    ax.broken_barh(service_bars, (frame_id-0.45, 0.9), facecolors=(colors), alpha=0.5)

  scatter = ax.scatter(points['x'], points['y'], marker='d', edgecolor='black')
  tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=points['labels'])
        points['x'].append((event[1]-t0)/1e6)
        points['y'].append(frame_id)
        points['labels'].append(event[0])
    ax.broken_barh(service_bars, (frame_id-0.45, 0.9), facecolors=(colors), alpha=0.5)

  scatter = ax.scatter(points['x'], points['y'], marker='d', edgecolor='black')
  tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=points['labels'])
        points['x'].append((event[1]-t0)/1e6)
        points['y'].append(frame_id)
        points['labels'].append(event[0])
    ax.broken_barh(service_bars, (frame_id-0.45, 0.9), facecolors=(colors), alpha=0.5)

  scatter = ax.scatter(points['x'], points['y'], marker='d', edgecolor='black')
  tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=points['labels'])
        points['x'].append((event[1]-t0)/1e6)
        points['y'].append(frame_id)
        points['labels'].append(event[0])
    ax.broken_barh(service_bars, (frame_id-0.45, 0.9), facecolors=(colors), alpha=0.5)

  scatter = ax.scatter(points['x'], points['y'], marker='d', edgecolor='black')
  tooltip = mpld3.plugins.PointLabelTooltip(scatter, labels=points['labels'])
    mpld3.plugins.connect(fig, tooltip)
    #mpld3.save_html(fig, 'test.html')
    mpld3.show()
  
  if __name__ == "__main__":
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
 latencylogger graph design (#24165)

* latencylogger graph design

* Update tools/latencylogger/latency_logger.py

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* quotes

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> 
tools/latencylogger/latency_logger.py