0

I have a 2d scatter plot generated using matplotlib on python.

The issue is that the whole figure is rotated by 90 (compared to the result I have in mind) .. and I need to rotate it back (i.e. rotate the whole figure by -90)

I have looked it up but I could not find a similar issue to what I need to do

Following is the part of the code where I plot the data

Code

#generate xvalues, yvalues and labels
x_list = [x for [x, y] in coordinates]
y_list = [y for [x, y] in coordinates]
#labels = ['point{0}'.format(i) for i in range(9)]
labels = ['c1', 'c2', 'c3', 'c4', 'c5', 'm1', 'm2', 'm3', 'm4']

#plt.plot(x_list, y_list,"ro")
#plt.margins(0.2)

#Generate scatter plot
T = np.arctan2(y_list,x_list)
originalplt = plt.scatter(x_list, y_list, s=75, c=T, alpha=.5)

#Annotate graph to points
for i in range(9):
    plt.annotate(
        labels[i], 
        xy = (x_list[i], y_list[i]), xytext = (-20, 20),
        textcoords = 'offset points', ha = 'right', va = 'bottom',
        bbox = dict(boxstyle = 'round,pad=0.5', fc = 'yellow', alpha = 0.5),
        arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0'))

#Plot graph
plt.xlim(0.0,1.8), plt.xticks([])
plt.ylim(-2.0,0.5), plt.yticks([])

#show plot
plt.show()
Abdelrahman Shoman
  • 2,882
  • 7
  • 36
  • 61

0 Answers0