Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

histogram with log scale has display issues for small values #191

Open
MarcoFalke opened this issue Jul 2, 2017 · 1 comment
Open

histogram with log scale has display issues for small values #191

MarcoFalke opened this issue Jul 2, 2017 · 1 comment

Comments

@MarcoFalke
Copy link

@MarcoFalke MarcoFalke commented Jul 2, 2017

It seems matplotlib can not properly render histograms, when log scale is active for the y-axis and the absolute frequency is smaller than ~2.7, ie. 1 and 2.

The Python code:

import pandas as pd
import matplotlib.pyplot as plt
from matplotlib2tikz import save as tikz_save

plot_values = pd.DataFrame(
    {
        'test0': pd.Series([0, 0, 0, .1, .1, .2]),
        'test1': pd.Series([0, .1]),
    }
)
plot_values.plot.hist(stacked=False)  # Should not use stacked for log plot
plt.gcf().set_size_inches(4, 3)
plt.yscale('log')
plt.ylim(ymin=.1)

plt.savefig('/tmp/test_a.png')
tikz_save('/tmp/test_a.tikz')

The png looks fine:

test_a

However, from the pdf it seems histogram bars are plotted with their lower bound starting at ~2.7 (instead of -inf). This will especially cause issues when the frequency is 1 or 2.
test_a pdf

@nschloe
Copy link
Owner

@nschloe nschloe commented Mar 21, 2019

Can you cook up an example code without pandas? It's such a heavy dependency...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.