Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plotting axes help
#3
(Jan-23-2020, 01:26 AM)jefsummers Wrote: You need an array of zeros as well, such as z=np.zeros(100)
Then, use plt.plot(x1,z) and plt.plot(z,y1) to plot your axes.
Then use plt.plot() to plot the blue circle.

Ah great! I've used the above and continued onto the next part of the question (see below):

x1=np.linspace(-1, 1, 100)
x2=np.zeros(100)
y1=np.linspace(-1, 1, 100)
y2=np.zeros(100)

plt.plot(x1, x2)
plt.plot(y2, y1)
plt.plot(0.5, 0.4, 'bo:')

xprime=0.5*np.cos(np.pi/6)-0.4*np.sin(np.pi/6)
yprime=0.5*np.sin(np.pi/6)+0.4*np.cos(np.pi/6)
plt.plot(xprime, yprime, 'ro:')
The above code gives the initial coordinate (x,y) = (0.5,04) as an "active rotation" of the point by 30 degrees.

I next need to be able to produce the same result by a "passive rotation" of the coordinate axes instead of moving the point ....?

The question reads:

Let us now consider a passive rotation. We will leave our point alone and just rotate the axes. You still apply the same formula as above, but now not on a single point, but on all points that make our axes. Thus your x and y are now the arrays containing the x-values and y-values of the axis you are rotating. Copy the previous code and add new code to compute the new x-axis and the new y-axis that result from a rotation by 30 degrees. Plot the new axes as red lines. You should now have a plot with the original axes in blue, the original point in blue, and the new axes in red.
Reply


Messages In This Thread
Plotting axes help - by StillAnotherDave - Jan-22-2020, 02:25 PM
RE: Plotting axes help - by jefsummers - Jan-23-2020, 01:26 AM
RE: Plotting axes help - by StillAnotherDave - Jan-23-2020, 10:48 AM
RE: Plotting axes help - by jefsummers - Jan-23-2020, 01:04 PM
RE: Plotting axes help - by StillAnotherDave - Jan-23-2020, 02:39 PM
RE: Plotting axes help - by StillAnotherDave - Jan-23-2020, 05:19 PM
RE: Plotting axes help - by jefsummers - Jan-23-2020, 11:07 PM
RE: Plotting axes help - by StillAnotherDave - Jan-24-2020, 01:20 AM
RE: Plotting axes help - by StillAnotherDave - Jan-24-2020, 12:03 PM
RE: Plotting axes help - by StillAnotherDave - Jan-24-2020, 03:28 PM
RE: Plotting axes help - by jefsummers - Jan-24-2020, 04:23 PM
RE: Plotting axes help - by StillAnotherDave - Jan-24-2020, 04:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Defining x and y axes in Spectrogram Function amy5678 3 2,436 Nov-29-2020, 01:42 PM
Last Post: jefsummers
  How do I set the figure title and axes labels font size in Matplotlib? anouar2002 1 1,745 Nov-03-2020, 05:31 PM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020