How Do You Make An Errorbar Plot In Matplotlib Using Linestyle=none In Rcparams?
Solution 1:
This is a "bug" in older versions of matplotlib
(and has been fixed for the 1.4 series). The issue is that in Axes.errorbar
there is a default value of '-'
for fmt
, which is then passed to the call to plot
which is used to draw the markers and line. Because a format string is passed into plot
in never looks at the default value in rcparams
.
You can also pass in fmt = ''
eb = plt.errorbar(x, y, yerr=.1, fmt='', color='b')
which will cause the rcParam['lines.linestlye']
value to be respected. I have submitted a PRto implement this.
Another work around for this is to make the errorbar in two steps:
l0, = plt.plot(x,y, marker='o', color='b')
eb = plt.errorbar(x, y, yerr=.1, fmt=None, color='b')
This is an annoying design decision, but changing it would be a major api break. Please open an issue on github about this.
errorbar doc.
As a side note, it looks like the call signature was last changed in 2007, and that was to make errorbars not default to blue.
Solution 2:
Using: fmt=''
indeed doesn't work. One needs to put something that is not an empty string.
As mentioned by @strpeter, a dot or any other marker would work.
Examples:
fmt='.'
fmt=' '
fmt='o'
Post a Comment for "How Do You Make An Errorbar Plot In Matplotlib Using Linestyle=none In Rcparams?"