2
matplotlibのストリームプロットの矢頭の数を増やす方法はありますか?今は3つが流線ごとに1つの矢印だけであるように見えますが、データを拡大するためにx/y軸の制限に変更したい場合は問題です。matplotlibのストリームプロットの矢頭の数
matplotlibのストリームプロットの矢頭の数を増やす方法はありますか?今は3つが流線ごとに1つの矢印だけであるように見えますが、データを拡大するためにx/y軸の制限に変更したい場合は問題です。matplotlibのストリームプロットの矢頭の数
私はちょうど矢印の数を増やすことについてはよく分からない - しかし、あなたはstreamplot機能に密度パラメータと流線の密度を高めることができ、ここではドキュメントです:
ここ*density* : float or 2-tuple
Controls the closeness of streamlines. When `density = 1`, the domain
is divided into a 30x30 grid---*density* linearly scales this grid.
Each cell in the grid can have, at most, one traversing streamline.
For different densities in each direction, use [density_x, density_y].
例です:
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0,20,1)
y = np.arange(0,20,1)
u=np.random.random((x.shape[0], y.shape[0]))
v=np.random.random((x.shape[0], y.shape[0]))
fig, ax = plt.subplots(2,2)
ax[0,0].streamplot(x,y,u,v,density=1)
ax[0,0].set_title('Original')
ax[0,1].streamplot(x,y,u,v,density=4)
ax[0,1].set_xlim(5,10)
ax[0,1].set_ylim(5,10)
ax[0,1].set_title('Zoomed, higher density')
ax[1,1].streamplot(x,y,u,v,density=1)
ax[1,1].set_xlim(5,10)
ax[1,1].set_ylim(5,10)
ax[1,1].set_title('Zoomed, same density')
ax[1,0].streamplot(x,y,u,v,density=4)
ax[1,0].set_title('Original, higher density')
fig.show()