Reputation: 1097
I want to plot some data, but instead of having the marker centered on the line, I need to have the lower vertex of the triangle aligned with the line. How can this be done?
Here is my MWE:
import matplotlib.pyplot as mplt
data = [1.]*10
mplt.plot(data, 'rv-' )
mplt.show()
Cheers, Jorge
Upvotes: 2
Views: 1378
Reputation: 3913
One way to achieve this is to use a special set of markers defined in matplotlib
:
import matplotlib.pyplot as mplt
from matplotlib.markers import CARETDOWN
data = [1.]*10
mplt.plot(data, 'r-')
mplt.scatter(range(10), data, marker=CARETDOWN, facecolor='r')
mplt.show()
Unfortunately, it doesn't render into a triangle as clear as the one in the OP for me. If you're aiming for more visulal clarity, perhaps writing something along the lines of answers to this SO question would be a better option.
Upvotes: 3