私は、Python上で2つの関数のグラフをプロットするコードを持っています。私は0と0.8の間の領域にx関数しかない方法があれば、hとの交差点の後には実行されませんが、hを続けたいと思っています。私はこれを変更する方法はありますか?ありがとう。これは私のコードです:グラフ上の関数の1つにドメインを設定するにはどうすればよいですか?
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.legend_handler import HandlerLine2D
t = np.arange(0.0, 1.0, 0.001)
h = 0.1*np.sin(10*t)
x = 4*t-5*t**2
line1, = plt.plot(t, h, label='h(t)')
line2, = plt.plot(t, x, label='x(t)', linestyle='--')
plt.legend(handler_map={line1: HandlerLine2D(numpoints=4)})
plt.xlabel('time')
plt.ylabel('height')
plt.title('Fig 1.')
plt.grid(False)
plt.savefig("Plot.png")
plt.show()
これは、それがどのように見えるかです:
最も簡単な方法は、別の 'T'を使用することですいいえ? 't_h = np.arange(0.0、.080、0.001)' –