i have problem using matplotlib in python. problem must make rotation in 2d of x , y axis 30°,45°,60° , 120° , opposite. in code below can please give me tips how make rotations of axis. note: there has visible 2 pairs of axis, 1 original,black , rotated in case green.
import numpy np mpl_toolkits.axes_grid1 import axesgrid import matplotlib.pyplot plt import matplotlib mpl pylab import axis([-5,5,-5,5]) #original axis x,y axvline(x=0, ymin=0, linewidth=1, color='k') axhline(y=0, xmin=0, linewidth=1, color='k') t_start1 = axvline(x=0, ymin=0, linewidth=2, color='g') #rotated y coordinate t_start2 = axhline(y=0, xmin=0, linewidth=2, color='g') #rotated x coordinate scatter([0],[0],color="k",s=30,label="s = (0,0)") scatter([2],[1],color="b",s=30,label="a = (2,1)") scatter([2.23],[-0.13],color="r",s=40,label="a' = (2.23,-0.13)") legend(loc=0) xlabel('x') ylabel('y') title('rotation 30° right coordinate system '); grid() plt.show()
*
Comments
Post a Comment