Repository navigation
Small issue with hist (probably in mac os x backend) - #408
Conversation
|
Can you try one of the *Agg backends? (If you don't have another GUI framework installed, you should still be able to set the backend to "Agg" and save PNG files to disk). That would help to determine whether it's Mac OS-X backend-specific. |
|
See this for a screen shot of what I'm talking about http://assorted-experience.blogspot.com/2011/07/small-issue-with-hist.html |
|
Thanks for the quick reply Michael. I just tried with Agg and indeed it is still there. I couldn't see anything popup, but I could save to png as you suggested. I've now putup the png here http://assorted-experience.blogspot.com/2011/07/small-issue-with-hist.html |
|
This seems to be related to pixel-snapping. Setting the rcParam "path.snap" to False resolves the issue (but also makes the axes rectangle look blurrier etc.) A better solution is to turn off snapping just for the histogram patch: hist = pylab.hist(r,bins=100,range=[-3,3],normed=True, align='mid',histtype='stepfilled',color='gray')
for patch in hist[2]:
patch.set_snap(False)I think the real fix is probably to not snap histograms -- or re-examine how rounding is done within the pixel-snapping algorithm (which will probably introduce other subtle bugs). Will have to think on that a bit. |
…ly with smoothed curves. Closes matplotlib#408.
Small issue with hist (probably in mac os x backend)
|
Thanks Michael! |
(Firstly, this is the kind of bugreport that gets the reporter run out of town with pitch-forks, because it is so trivial. But it scared me a little when I first saw it, so I will report it anyway).
Issue:
When hist is used to plot a histogram with the align='mid' option, the drawing of the histogram on screen is just slightly displaced. A pdf produced with the same plot turns out exactly as expected.
To replicate
system specs
matplotlib 1.0.1
Mac OS X
This might be an issue with the mac os x backend since pdfs come out fine.
The reason I post this is because I had an analytic derivation for a distribution I was working with and some simulations I was doing. I kept noticing a slight systematic discrepancy between my analytic formula and the monte carlo simulation histogram and started to worry I had missed something in the derivation. But when I printed to pdf, my problem went away, much to my relief.