I'm reading the matplotlib docs. I'm struggling to find the keyword argument for the 'format string'. Or it is a positional arg only?
2 Answers
This is a specific pyplot argument (sort of a remnant of the older pylab). In 'ro', r means red, and 'o' means a round marker.
The arguments can be set like this instead:
color='r'
marker='.'
linestyle='-' # if you need the dots connected by a line
Scroll down to see the matplotlib.pyplot.plot: Format Strings section. '[marker][line][color]'
plt.plot(range(1, 5), range(1, 17, 4), 'o-r')
# is equivalent to
plt.plot(range(1, 5), range(1, 17, 4), marker='o', linestyle='-', color='red')
2 Comments
James Schinner
So if you want to use keyword arguments. The format string needs to be pulled apart and supplied as individual components?
James Schinner
Ok, ta. That's it!
Here is a proof from the matplotlib documentation that there is no such named argument - see "This argument cannot be passed as keyword.".
