python绘制折线图怎么样填充空白颜色_Python:填补两幅图之间的空白
如何在不連續(xù)點連接兩個地塊?我有一個關(guān)于不連續(xù)點的方程式.
import numpy as np
import pylab
r1 = 1 # AU Earth
r2 = 1.524 # AU Mars
deltanu = 75 * np.pi / 180 # angle in radians
mu = 38.86984154054163
c = np.sqrt(r1 ** 2 + r2 ** 2 - 2 * r1 * r2 * np.cos(deltanu))
s = (r1 + r2 + c) / 2
am = s / 2
def f(a):
alpha = 2 * np.arcsin(np.sqrt(s / (2 * a)))
beta = 2 * np.arcsin(np.sqrt((s - c) / (2 * a)))
return (np.sqrt(a **3 / mu) * (alpha - beta - (np.sin(alpha)
- np.sin(beta))))
def g(a):
alphag = 2* np.pi - 2 * np.arcsin(np.sqrt(s / (2 * a)))
betag = -2 * np.arcsin(np.sqrt((s - c) / (2 * a)))
return (np.sqrt(a ** 3 / mu)
* (alphag - betag - (np.sin(alphag) - np.sin(betag))))
a = np.linspace(am, 2, 500000)
fig = pylab.figure()
ax = fig.add_subplot(111)
ax.plot(a, f(a), color = '#000000')
ax.plot(a, g(a), color = '#000000')
pylab.xlim((0.9, 2))
pylab.ylim((0, 2))
pylab.show()
反映該點的等式為:dt = np.sqrt(s ** 3/8)*(np.pi-betam np.sin(betam))其中betam = 2 * np.arcsin(np.sqrt(1- c / s)),因此在a = s / 2時dt = 0.5.但是,圖之間的間隙看起來大于一個點.
我添加了:ax.plot([am,am],[.505,.55],color =’#000000′),它填補了空白,但感覺不合適.
總結(jié)
以上是生活随笔為你收集整理的python绘制折线图怎么样填充空白颜色_Python:填补两幅图之间的空白的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: cors跨域_跨域,不止CORS
- 下一篇: datagridview滚动条自动滚动_