2017-12-17 10 views
1

私は、特定の場所で英国の風速と風向をプロットしています。私が疑問に思っているのは、風の方向をより明瞭にするために、三角形の先端の色を塗りつぶす方法はありますか?私のプロットで三角形の先頭の色を塗ることができますか?

これをプロットするための私のコードは次のとおりです。風速と方向を持つ英国の

payload_user={'[email protected]': {'lat': '51.45', 'lon': '-2.59'},'[email protected]': {'lat': '52.06', 'lon': '-2.82'}} 
m.plot(y=float(payload_user[email_user]['lat']),x=float(payload_user[email_user]['lon']),marker=(3,0,wind_direction_deg),color = col, markersize=7) 
        plt.title("Wind speed and Direction in the UK for specific users") 
        plt.xlabel('Longitude') 
        plt.ylabel("Latitude") 

地図:

Map of the UK with windspeed and direction

答えて

0

私はの一部を色付けするためにあらゆる合理的に簡単な方法を知りませんマーカーの残りの部分とは異なるマーカー。しかし、方向を示すために、私は、正三角形以外の二等辺三角形を使用することは意味をなさないと思います。そのような三角形を達成する

enter image description here

一つの方法は、vertsポリゴンの頂点がマーカーとして使用されるmarker=verts表記法を使用することです。

import numpy as np 
import matplotlib.pyplot as plt 

def get_arrow(angle): 
    a = np.deg2rad(angle) 
    ar = np.array([[-.25,-.5],[.25,-.5],[0,.5],[-.25,-.5]]).T 
    rot = np.array([[np.cos(a),np.sin(a)],[-np.sin(a),np.cos(a)]]) 
    return np.dot(rot,ar).T 

for i, angle in enumerate([0,45,60,-36]): 
    plt.plot(i/10.,0.6,marker=get_arrow(angle), ms=30) 

plt.show() 

enter image description here

関連する問題