question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pandas hexbin plot lacks X axis labels in IPython Notebook

See original GitHub issue

When 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.

image

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

17reactions
BDannowitzcommented, Jul 26, 2015

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.

0reactions
takluyvercommented, Jan 26, 2016

Closing as it appears to be a pandas bug. Anyone who’s still seeing it, follow along with pydata/pandas#10678.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found