Down arrow symbol in matplotlib

2024/11/16 8:56:36

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

Answer

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.
https://en.xdnf.cn/q/71364.html

Related Q&A

Overwrite the previous print value in python?

How can i overwrite the previous "print" value in python?print "hello" print "dude" print "bye"It will output:hello dude byeBut i want to overwrite the value.In…

pyQt4 - How to select table rows and disable editing cells

I create a QTableWidget with:self.table = QtGui.QTableWidget() self.table.setObjectName(table) self.table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) verticalLayout.addWidget(self.table)wi…

Error when checking input: expected dense_input to have shape (21,) but got array with shape (1,)

How to fix the input array to meet the input shape?I tried to transpose the input array, as described here, but an error is the same.ValueError: Error when checking input: expected dense_input to have…

Sort order when loading related objects using selectinload in SQLAlchemy

Is there a way to specify the sort order when loading related objects using the selectinload option in SQLAlchemy?My SQLAlchemy version: 1.2.10 My python version: 3.6.6

How to implement autovivification for nested dictionary ONLY when assigning values?

TL;DR How can I get superkeys to be autovivified in a Python dict when assigning values to subkeys, without also getting them autovivified when checking for subkeys?Background: Normally in Python, se…

How can I iterate across the photos on my connected iPhone from Windows 7 in Python?

When I connect my iPhone to my Windows 7 system, the Windows Explorer opens a Virtual Folder to the DCIM content. I can access the shell library interface via Pywin32 (218) as mentioned here: Can I use…

Why doesnt the python slice syntax wrap around from negative to positive indices?

I noticed, given l = [1,2,3], that l[-1:] returns [3] as expected, but that l[-1:0] returns [], very much unlike what I expected. I then tried [-1:1], which I expected to return [3,1], but it also retu…

How do I modify a generator in Python?

Is there a common interface in Python that I could derive from to modify behavior of a generator?For example, I want to modify an existing generator to insert some values in the stream and remove some…

Reading a website with asyncore

I would like to read a website asynchronously, which isnt possible with urllib as far as I know. Now I tried reading with with plain sockets, but HTTP is giving me hell. I run into all kind of funky en…

How to select specific the cipher while sending request via python request module

Usecase: I want to find out how many ciphers are supported by the hostname with python request module.I am not able to find a way to provide the cipher name to request module hook. Can anyone suggest …