Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Down arrow symbol in matplotlib

I would like to create a plot where some of the points have a downward pointing arrow (see image below). In Astronomy this illustrates that the true value is actually lower than what's measured.Note that only some of the points have this symbol.

I would like to know how I can create such symbols in matplotlib. Are there downward arrow symbols that I can use?

Thanks for your help in advance!

enter image description here

like image 610
Rohit Avatar asked May 31 '13 15:05

Rohit


People also ask

How do I annotate an arrow in Matplotlib?

We can add arrows to an annotation in Matplotlib by passing the arrowprops argument to the ax. annotate(~) method.

How do I use marker in Matplotlib?

It is used both by the marker functionality of the plot and scatter. Render the string using mathtext. E.g “$r$” for marker showing the letter r. A list of (x, y) pairs used for Path vertices.


1 Answers

Sure.

When calling matplotlibs plot function, set a marker

  • If stuff like caretdown doesn't work for you, you can create your own marker by passing a list of (x,y) pairs, which are passed to a Path artist. x/y are 0…1 normalized coordinates that are scaled to the set marker size.
  • You can also pass an existing Path instance as a marker, which allows even more flexibility.
  • As mentioned by tom10 in the comments you can also pass a string in the form of $…$ as a marker, where is arbitrary text, including Unicode characters, if your font supports it (should be the case these days). Downwards arrow in Unicode: ↓ (or \u2193, resulting in $\u2193$ as the marker. Note that this must be a unicode string in Python 2.x [prepend u]). Unicode Block Arrows @ Wikipedia
  • You could also try passing a Arrow instance as marker, but I'm not sure whether that works.
like image 112
dom0 Avatar answered Oct 09 '22 00:10

dom0