In [ ]:
%matplotlib nbagg
# import seaborn as sns
# sns.set_context('notebook')
In [ ]:
from matplotlib.lines import Line2D
def draw_coord_axes(ax):
xline = Line2D([-4.8, 4.8], [0, 0], ls='dotted',lw=2)
yline = Line2D([0, 0], [-8.5, 4.5], ls='dotted', lw=2)
ax.add_line(xline)
ax.add_line(yline)
In [ ]:
def annotate_degrees(ax):
size = 55
ax.annotate('$0^\circ$', xy=(5.5, 0), va='center', size=size)
ax.annotate('$180^\circ$', xy=(-10, 0), va='center', size=size)
ax.annotate('$90^\circ$', xy=(0, 5), ha='center', size=size)
ax.annotate('$270^\circ$', xy=(0, -9), va='top', ha='center', size=size)
In [ ]:
import math
from matplotlib.patches import Circle
def annotate_sun(ax):
circle = Circle(xy=(0, 0), radius=2, color='yellow')
ax.add_artist(circle)
In [ ]:
def draw_ls(ls, ax):
theta = math.radians(ls)
ax.annotate('',
xy=(theta, 5), # theta, radius
xytext=(0, 0), # theta, radius
xycoords='polar',
textcoords='polar',
arrowprops=dict(facecolor='black', width=10, headwidth=20),
horizontalalignment='center',
verticalalignment='center',
clip_on=True, # clip to the axes bounding box
)
In [ ]:
from matplotlib.patches import Ellipse
el = Ellipse((0,-2), 10, 13, facecolor='lightgrey', edgecolor='r', lw=3)
fig = plt.figure()
ax = fig.add_subplot(111, aspect='equal')
ax.add_artist(el)
el.set_clip_box(ax.bbox)
ax.set_xlim(-10, 7)
ax.set_ylim(-10, 6)
ax.axis('off')
draw_coord_axes(ax)
annotate_degrees(ax)
annotate_sun(ax)
draw_ls(265, ax)
fig.savefig('/Users/klay6683/Desktop/ls.pdf',bbox_inches='tight')
In [ ]:
ax.annotate?
In [ ]:
math.sqrt(13**2-100)
In [ ]: