Here is the code:
import itertools
import pandas as pd
import matplotlib.pyplot as plt
# reuse these colors
colors = itertools.cycle(["r", "b", "g"])
# some random data
df = pd.DataFrame({'x':[1,2,3,4,5],
                   'y':[2,4,5,2,4],
                   'area': [100, 200, 400, 500, 800],
                   'label': ['blah1','blah2','blah3','blah4','blah5']
                  })
# draw a scatter plot
def draw_scatter_plot(
    x,
    y,
    marker_size,
    marker_color: itertools.cycle,
    labels
):
    fig, ax = plt.subplots(figsize=(12, 8))
    if marker_size:
        i = 0
        while i<len(x):
            ax.scatter(x[i], y[i], color = next(marker_color), s = marker_size[i])
            ax.annotate(
                    labels[i],
                    (x[i], y[i]), # adjust y[i] here
                    fontproperties=cur_font,
                    fontsize=14,
                    ha="center",
                    va="top",
                )
            i+=1
    plt.show()
draw_scatter_plot(df.x.tolist(),
                  df.y.tolist(),
                  df.area.tolist(),
                  colors,
                  df.label.tolist())
As you can see the labels overlap with the bottom of the circle. How can I calculate the bottom y value of the circle so that I can always position the labels such that they do not overlap with the circles?

 
     
     
    
 
    
