Pandas hexbin plot lacks X axis labels in IPython Notebook
See original GitHub issueWhen using pandas.DataFrame.plot()
with kind='hexbin'
, the resulting plot sometimes has no X tick labels and on X axis label. This is observed in IPython Notebook (ipython version 3.2.0) with Python 3.4, matplotlib
1.4.3, with %pylab --no-import-all inline
.
The same code produces a correct plot in IPython terminal on the same setup, with %pylab --no-import-all
. This happens only on some dataframes, here’s the code I run:
df = pd.read_csv('/tmp/example.csv', index_col=0)
df.plot('x', 'y', kind='hexbin', gridsize=10)
Here’s the df
:
x y
0 18.378351 111.080217
1 17.371567 118.277121
2 24.659952 169.528504
3 31.774163 310.880044
4 17.181311 113.618851
5 20.455473 149.341431
6 18.218108 132.492567
7 23.453792 157.083139
8 25.340805 158.190820
And here’s the example.csv
file used. The plot from the Notebook is below. Also, here is another fellow with the same problem.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:11 (6 by maintainers)
Top Results From Across the Web
pandas dataframe hexbin plot has no xlabel or axis values
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.
Read more >[Code]-Pandas plot hide some x-axis labels-pandas
The problem I'm running into is that now the x-axis is crammed with too many date labels. How can I still show all...
Read more >Chapter 4. Visualization with Matplotlib - O'Reilly
Plotting interactively within an IPython notebook can be done with the %matplotlib command, and works in a similar way to the IPython shell....
Read more >Plotting with Pandas (…and Matplotlib…and Bokeh)
Plotting in Pandas provides a basic framework for visualizing our data, ... for x axis | title : string or list | Title...
Read more >Get Interactive plots directly with pandas. | by Parul Pandey
We'll create each of these charts first with pandas plotting library ... for the plotX and y label: Name to use for the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 (which it should have been by default), and poof, the xlabel and xticks appeared.
Hopefully this helps tracking down the bug.
Closing as it appears to be a pandas bug. Anyone who’s still seeing it, follow along with pydata/pandas#10678.