Skip to content

Commit

Permalink
Update 3D Earth Rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
sksalahuddin2828 authored Jun 26, 2023
1 parent 744bd33 commit bb7813d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions 3D Earth Rotation
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
from matplotlib.animation import FuncAnimation
import warnings

# Suppress warning messages
warnings.filterwarnings("ignore")

# Set up the figure and axes
fig = plt.figure()
Expand All @@ -13,19 +17,20 @@ def update(frame):
ax.cla() # Clear the axes
m = Basemap(projection='ortho', lat_0=0, lon_0=frame, resolution='l') # Update lon_0 for rotation
m.drawcoastlines(color='gray')
m.drawparallels(range(-90, 91, 30), labels=[1, 0, 0, 0])
m.drawmeridians(range(-180, 181, 60), labels=[0, 0, 0, 1])
m.bluemarble() # Display the Blue Marble image
ax.set_title('3D Earth Rotation')

# Set up the animation
ani = FuncAnimation(fig, update, frames=range(0, 360, 2), interval=0)
# Set up the animation with a faster rotation speed (interval=20)
ani = FuncAnimation(fig, update, frames=range(0, 360, 2), interval=20)
plt.show()


#--------------------------------------------------------------------------------------------------------

# Set up the animation slower
# ani = FuncAnimation(fig, update, frames=range(0, 360, 2), interval=20)

# Set up the animation rotation speed you can change

# ani = FuncAnimation(fig, update, frames=range(0, 360, 2), interval=0)
# ani = FuncAnimation(fig, update, frames=range(0, 360, 2), interval=50)

# plt.show()

0 comments on commit bb7813d

Please sign in to comment.