Bar Plot does not allow to change linewidth #1658

CRP opened this Issue Jul 23, 2012 · 5 comments


None yet

2 participants


linewidth for barplots (ie the edge lines of the bars) appears to be fixed at 1. Would it be possible to allow it to be set freely?


What version of pandas are you on?
I just tried it on master and passing in linewidth>1 looks fine. Would you be able to give the latest a shot?


I am on 0.8.1, just upgraded.

Here is my output:


so this works fine. If I specify a linewidth keyword it breaks, as the method bar_f already has a keyword linewidth:


TypeError Traceback (most recent call last)
in ()
----> 1 a.plot(kind='bar',stacked=True,linewidth=2)

/usr/local/lib/python2.7/site-packages/pandas/tools/plotting.pyc in plot_frame(frame, x, y, subplots, sharex, sharey, use_index, figsize, grid, legend, rot, ax, style, title, xlim, ylim, logy, xticks, yticks, kind, sort_columns, fontsize, secondary_y, *kwds)
1215 sort_columns=sort_columns, secondary_y=secondary_y,
1216 *
-> 1217 plot_obj.generate()
1218 plot_obj.draw()
1219 if subplots:

/usr/local/lib/python2.7/site-packages/pandas/tools/plotting.pyc in generate(self)
573 self._compute_plot_data()
574 self._setup_subplots()
--> 575 self._make_plot()
576 self._post_plot_logic()
577 self._adorn_subplots()

/usr/local/lib/python2.7/site-packages/pandas/tools/plotting.pyc in _make_plot(self)
1076 rect = bar_f(ax, self.ax_pos, y, 0.5, start=start,
-> 1077 label=label, linewidth=1, **kwds)
1078 pos_prior = pos_prior + np.where(mask, y, 0)
1079 neg_prior = neg_prior + np.where(mask, 0, y)

TypeError: f() got multiple values for keyword argument 'linewidth'


Thanks, btw, I also noticed an inconsistent handling of x axis formatting: eg the size of xaxis ticklabels is controlled by the fontsize parameter, but this does not affect y axis and/or legend. Further, even if the fontsize keyword is not explicitly specified, there is a default somewhere that overrides matplotlib rc settings. maybe it would be better not to handle fontsize at pandas level and fall back on matplotlib defaults.

@changhiskhan changhiskhan was assigned Jul 24, 2012

Yeah, I think it absolutely makes sense to push as much of the styling down to matplotlib as possible.
We are working on a more unified plotting API that will be part of v0.9, please stay tuned.
Thanks for the feedback

@changhiskhan changhiskhan added a commit to changhiskhan/pandas that referenced this issue Jul 24, 2012
@changhiskhan changhiskhan BUG: plot styling bugs #1666 #1665 #1658 7c54141
@changhiskhan changhiskhan was unassigned by wesm Oct 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment