60 lines
1.5 KiB
Python
60 lines
1.5 KiB
Python
# -*- 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
|
|
|
|
plt.rc('text', usetex=True)
|
|
plt.rc('font', family='serif')
|
|
|
|
x = np.linspace(-10, 30, 400, endpoint=True)
|
|
|
|
|
|
def f(x):
|
|
with np.errstate(divide='ignore', invalid='ignore'):
|
|
return np.divide(7,(9-x))
|
|
|
|
y=f(x)
|
|
|
|
#plt.plot(X, C)
|
|
|
|
plt.figure(figsize=(9, 6), dpi=600)
|
|
plt.ylim(-25, 25)
|
|
# 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([-10,-8,-6,-4,-2,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30])#),rotation='vertical')
|
|
#
|
|
# plt.margins(0.2)
|
|
#
|
|
#
|
|
plt.plot(x, y, color="slateblue")
|
|
#
|
|
# plt.title(r"$\displaystyle y=f\left(t\right)=\frac{7}{9-t}$" ,fontsize=12, color='slateblue',y=0.15,x=0.3)
|
|
|
|
plt.savefig('plot07a.pdf', dpi=600)
|
|
#plt.show()
|
|
#graph.save('plot06a.png')
|
|
|
|
|