2021-12-02

Matplotlib patch not getting applied properly

enter image description here

I expected something like above to be applied to my scatter plot.but instead i received this

enter image description here

code is as below

# Data
import matplotlib.patches as patches
df1=pd.DataFrame({'x_pos': x, 'y_pos': y })
print(df1)

 
# Plot
fig1 = plt.figure(figsize=(20,10))
ax1 = fig1.add_subplot(111)
ax1.plot( 'x_pos', 'y_pos', data=df1, linestyle='none', marker='o')

 
# Annotation
ax1.add_patch(
patches.Circle(
(35, 40),          
3,                
alpha=0.3, facecolor="green", edgecolor="black", linewidth=1, linestyle='solid'
)
)

# Show the graph
plt.show()

Dataframe

   x_pos  y_pos
0       38  62506
3       33  64991
4       32  50825
5       44  57568
7       38  59365
..     ...    ...
301     44  55140
302     38  58062
303     48  59728
307     39  48513
310     43  45046

what am I doing wrong here ?



from Recent Questions - Stack Overflow https://ift.tt/3xHB6uD
https://ift.tt/31h0lba

No comments:

Post a Comment