pandas dataframe hexbin plot has no xlabel or axis

2019-02-16 08:22发布

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')

enter image description here

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:

enter image description here

2条回答
ゆ 、 Hurt°
2楼-- · 2019-02-16 09:13

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)

查看更多
放我归山
3楼-- · 2019-02-16 09:14

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.

查看更多
登录 后发表回答