1

I have a pandas dataframe and I want to annotate the data points to the values in the dataframe. The dataframe has 4 columns Returns, Volatility, ,Cl and Symbol. Return and Volatility are floating types and Symbol is a string type.

My code compiles but doesn't plot the graph.

fig,ax= plt.subplots(figsize=(20,15))
Y1.plot("Return","Volatility",kind="scatter",ax=ax)
def label_point(x, y, val, ax):
    a = pd.concat({'x': x, 'y': y, 'val': val}, axis=1)
    for i, point in a.iterrows():
        ax.text(point['x'],point['y'],point['val'])

label_point(Y1.Return,Y1.Volatility ,Y1.Symbol, ax)

There is no graph output on the jupyter notebook. Is there any otherway to solve this problem ?

Sourav Rai
  • 13
  • 4

0 Answers0