Init
This commit is contained in:
60
plot06a.py
Normal file
60
plot06a.py
Normal file
@@ -0,0 +1,60 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#from __future__ import unicode_literals
|
||||
#import matplotlib.pyplot as plt
|
||||
#from sympy import symbols, sqrt
|
||||
#from sympy.plotting import plot
|
||||
|
||||
#http://www.scipy-lectures.org/intro/matplotlib/matplotlib.html
|
||||
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
#x,y = symbols('x,y')
|
||||
#y = sqrt(64-x**2)
|
||||
|
||||
#title="$y=\sqrt{64-x^2}$"
|
||||
#graph = plot((y),(x,-10,10),(y,-1,12),ylabel='$y$',xlabel="$y=\sqrt{64-x^2}$", show=True)
|
||||
|
||||
plt.rc('text', usetex=True)
|
||||
plt.rc('font', family='serif')
|
||||
|
||||
X = np.linspace(-8, 8, 512, endpoint=True)
|
||||
|
||||
C, S = np.cos(X), np.sin(X)
|
||||
|
||||
Y=np.sqrt(64-X**2)
|
||||
|
||||
#plt.plot(X, C)
|
||||
|
||||
#plt.figure(figsize=(5, 5), dpi=600)
|
||||
plt.ylim(Y.min() * 1.1, Y.max() * 1.1)
|
||||
plt.xlim(X.min() * 1.1, X.max() * 1.1)
|
||||
|
||||
ax = plt.gca() # gca stands for 'get current axis'
|
||||
ax.spines['right'].set_color('none')
|
||||
ax.spines['top'].set_color('none')
|
||||
ax.xaxis.set_ticks_position('bottom')
|
||||
ax.spines['bottom'].set_position(('data',0))
|
||||
ax.yaxis.set_ticks_position('left')
|
||||
ax.spines['left'].set_position(('data',0))
|
||||
|
||||
#x
|
||||
plt.arrow(8.5, -0.003, 0.1, 0, head_width=0.1, head_length=0.25,clip_on=False) #width=0.015, color="k", clip_on=False, head_width=0.12, head_length=0.22)
|
||||
|
||||
#y
|
||||
plt.arrow(0.0, 8.7, 0, 0.1, clip_on=False, head_width=0.1, head_length=0.25)
|
||||
|
||||
|
||||
plt.yticks([2,4,6,8])
|
||||
plt.xticks([-8,-6,-4,-2,0,2,4,6,8])#),rotation='vertical')
|
||||
|
||||
plt.margins(0.2)
|
||||
|
||||
|
||||
plt.plot(X, Y, color="slateblue")
|
||||
|
||||
plt.title(r"$\displaystyle y=\sqrt{64-x^2}$" ,fontsize=12, color='slateblue',y=0.15,x=0.3)
|
||||
|
||||
#plt.show()
|
||||
#graph.save('plot06a.png')
|
||||
|
||||
plt.savefig('plot06a.pdf', dpi=600)
|
||||
Reference in New Issue
Block a user