2011-12-02 18 views
1

我想製作一個特殊的標記,它不適用於scatter命令。我想製作一個「板針」形狀標記。原則上,箭頭(在fancyarrow命令下)很好,但它不允許我使用對我非常重要的vmin和vmax選項。讓我解釋一下。我有一組x, y座標和速度。速度由顏色條表示。因此,讀取x, y和速度並使用scatter vmin和vmax命令,標記將自動繪製爲正確的顏色。例如:matplotlib如何製作一個特殊的標記

f.show_colorscale(cmap="gist_hsv",vmin=0,vmax=8e3) 
f.scatter(x,y,c=vel,marker='o',s=50,vmin=0,vmax=8e3) 

我只成功繪製了電路板引腳的「頭部」(只是一個實心圓)。任何想法如何以不同的角度獲得電路板引腳的「尾部」?

回答

0

也許你可以檢查matplotlib.patches

In [23]: from matplotlib import patches 
In [24]: patches.Arrow ? 
Type:   type 
Base Class:  <type 'type'> 
String Form: <class 'matplotlib.patches.Arrow'> 
Namespace:  Interactive 
File:   c:\python26\lib\site-packages\matplotlib\patches.py 
Docstring: 
    An arrow patch. 

Constructor information: 
Definition:  patches.Arrow(self, x, y, dx, dy, width=1.0, **kwargs) 
Docstring: 
    Draws an arrow, starting at (*x*, *y*), direction and length 
given by (*dx*, *dy*) the width of the arrow is scaled by *width*. 

Valid kwargs are: 
    agg_filter: unknown 
    alpha: float or None 
......................................... 

Here you have an example

1
plot(x,y, "o", markersize=1) 

就這麼簡單

相關問題