ENH/VIS: Dataframe bar plot can now accept width and pos keywords 
State: closed

Following keywords are now acceptable for `dataframe.plot(kind='bar')` and `dataframe.plot(kind='barh')`.
`width`: Specify the bar width. In previous versions, static value 0.5 was passed to matplotlib and it cannot be overwritten.
`pos`: Specify relative alignments for bar plot layout. From 0 (left/bottom-end) to 1(right/top-end). Default is 0.5 (center).

_Examples:_
![figure_1](https://f.cloud.github.com/assets/1696302/2428540/7496a148-ac4c-11e3-9964-8c3353551606.png)


Labels:
name: Visualization
description: plotting
name: API Design

Comments:
Thanks. We'll need an entry under the API section in `release.rst`. We have this PR for error bars: https://github.com/pydata/pandas/pull/5638. Need to check if these play well together. I'll take a look early next week. 

@TomAugspurger iirc some convention for simply passing thru keywords on plot directly to matplotlob 
isn't that right?

Thank you for your confirmation. I've added release note description. I'll recheck once #5638 is merged to master.

@jreback We do some stuff on the pandas side before passing things through to matplotlib's ax.bar().  Right now if you pass a `width=` in the keyword args you get a `TypeError` with multiple values for width.

@sinhrks What do you think about `position` instead of `pos`? `position` seems to be more common in the matplotlib code. Also could you get [Travis-CI](https://github.com/pydata/pandas/wiki/Testing#hook-up-travis-ci) hooked up so that the tests get run?

OK, agreed. I've changed the keyword to `position` and hooked to Travis-CI. 

Also, I found some bar plot related dataframe tests are under `TestSeriesPlot` class, thus moved it to `TestDataFramePlots` class.

Travis test should have passed, but no icon seems to be displayed. Is it OK or any other configuration required?
https://travis-ci.org/sinhrks/pandas/builds/20881935

Thanks. Got it.

pls rebase and then squash as well

Yes, did it.

Thanks, I added your note about the position argument to the `plot*` docstrings. Width didn't need one since it's a regular matplotlib `bar` argument.

@TomAugspurger did you mean to close?

Hmm. I merged via command line since I had to move the release note down a line. Did I break something?

It is merged. https://github.com/pydata/pandas/commit/8d87a292913e490023410a23647b3e78eb81526e

@TomAugspurger I see..no problem...git closes the issue automatically, but I see you just put a reference (which is correct!)

@sinhrks thanks!

Thanks

@jreback I see that this failed on Travis: https://travis-ci.org/pydata/pandas/jobs/21098475

Looking into it.

Hmm strange. Here's the failing test:

``` pyton
kinds = 'line', 'bar', 'barh', 'kde', 'density'
df = DataFrame(randn(10, 2), dtype=object)
df[np.random.rand(df.shape[0]) > 0.5] = 'a'
for kind in kinds:
    with tm.assertRaises(TypeError):
        df.plot(kind=kind)
```

I can't reliably reproduce the failure. What does reproduce it is if I don't do the `df[np.random.rand(df.shape[0]) > 0.5] = 'a'` line. In that case (all numeric data, just objects) we automatically convert types and plot.

Do you think it could have randomly drawn 10 values all greater than .5? The probability is `.5 ** 10 = 0.0009765625`, not impossible...

I'm going to set a seed and see if it fixes.

See https://github.com/pydata/pandas/pull/6670 for a hopeful fix on the last comment.