擅长:python、mysql、java
<p>如果要避免添加列,可以一步完成tomaugspugger的解决方案:</p>
<pre><code>data['values'].plot(kind='barh',
color=(data['values'] > 0).map({True: 'g',
False: 'r'}))
</code></pre>
<p><a href="https://i.stack.imgur.com/2z50O.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2z50O.png" alt="bar plot with positives green and negatives red"/></a></p>