olgabot / prettyplotlib

Painlessly create beautiful matplotlib plots.
olgabot.github.io/prettyplotlib
MIT License
1.69k stars 148 forks source link

Histograms with large nbins are totally invisible #64

Closed anntzer closed 10 years ago

anntzer commented 10 years ago

Try e.g.

import numpy as np, matplotlib.pyplot as plt, prettyplotlib as ppl
f, (ax1, ax2) = plt.subplots(2)
ppl.hist(ax1, np.random.normal(size=(1e6,)), 500)
ax2.hist(np.random.normal(size=(1e6,)), 500)
plt.show()

I guess that the bars become totally invisible because they become thinner than the amount of whitespace ppl is trying to insert between them.

anntzer commented 10 years ago

I have a possible fix for this. I can try drawing the histogram first, then check the width of the rectangles drawn. If they are smaller than linewidth (in the appropriate units), remove them and redraw everything without setting edgecolor to white. Or, if we don't want any redraws, at least throw a warning or an exception -- I don't think displaying an empty figure without any warning is appropriate. Sounds good?

olgabot commented 10 years ago

Thank you for your comment. Unfortunately, I no longer have the bandwidth to maintain prettyplotlib. I recommend using seaborn. Using seaborn, to get the prettyplotlib style, do:

import seaborn as sns
sns.set(style='ticks', palette='Set2')

And to remove "chartjunk", do:

sns.despine()

If you have discrete pull requests, I will accept them, but I personally will no longer fix bugs.

If you are a biological scientist looking for ways to analyze your big-ish (20+ samples) data, check out my main project, flotilla.