当我反转 pyplot 中的 x 轴时,随附的表格不会受到影响。如何反转表格元素的显示?
ax=ep.plot(kind='bar',table=True).invert_xaxis()
最佳答案
我就是这样做的......
import pandas as pd
import matplotlib.pyplot as plt
# get the data ... note the order ...
data = [4.77, 5.52, 5.93, 6.29, 6.0, 6.95, 7.7, 9.44, 10.94, 12.35, 13.45]
df = pd.DataFrame({'data':data})
# referse the dataframe
df = df[::-1]
# ... and plot ...
ax = df.plot(kind='bar',table=True, figsize=(8,4)) # bar plots are categorical
ax.xaxis.set_visible(False) # table heading and x-labels over-printing
plt.show()
这会产生...
如果我们再次逆转......
df = df[::-1]
我们得到...
关于pandas - pyplot 反转 x 轴和反转表格子图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28837123/