pandas dataframe hexbin plot has no xlabel or axis values

ⅰ亾dé卋堺 提交于 2019-12-19 05:19:51

问题


I am trying to plot a dataframe as hexbin but can't seem to get the xlabel and x-axis values to plot. The dataframe is as follows:

szen_df.xs('left', level='pos')

and the plot is as follows:

szen_df.xs('left', level='pos').plot(x='szen', y='lat', xlim=(0,90), ylim=(-90,90), kind='hexbin', colormap='Reds' )

with result:


回答1:


I'm seeing this problem as well with python 2.7, pandas 0.16.2.dev, and ipython version 3.1.0.

Looking to the documentation for pandas.DataFrame.plot, the only reference to the x labels and ticks being invisible is in the sharex option. So, I manually set sharex=False, and poof, the xlabel and xticks come back.

Clearly this is a bug, but I hope this helps for the time being. I'll add these comments to the bug report that you've already started.




回答2:


Looks like the same as the issue I had here: matplotlib scatterplot x axis labels

The workaround which worked was to set the axes explicitly. Just leaving this here for the future :)

Might be connected with https://github.com/pandas-dev/pandas/pull/12949 , Open as of now (6th of April 17)



来源:https://stackoverflow.com/questions/31220329/pandas-dataframe-hexbin-plot-has-no-xlabel-or-axis-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!