hamster
hamster

Reputation: 69

matplotlib how to make a special marker

I am trying to make a special marker which isn't available with the scatter command. I would like to make a "board pin" shape marker. In principle, arrow (under fancyarrow command) is fine but it doesn't allow me to use vmin and vmax option which is very crucial to me. Let's me explain.

I have a set of x, y coordinates and velocities. The velocity is represented by the colorbar. Thus, reading in x, y and velocity and use scatter vmin and vmax command, the markers will be automatically plotted with the right color. eg:

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

I only succeeded in plotting the "head" of the board pin (just a filled circle). Any idea how to get the "tail" of the board pin in various angle?

Upvotes: 1

Views: 749

Answers (2)

Mavin Martin
Mavin Martin

Reputation: 41

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

That simple

Upvotes: 2

joaquin
joaquin

Reputation: 85683

Maybe you can check 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

Upvotes: 0

Related Questions