-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
evince misrenders some pdf bar plots #12864
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
Comments
The ticking issue is already open as #8768 (especially #8768 (comment)), but the pdf/evince issue is new. I can't repro using okular (also using poppler as rendering backend) or mupdf or zathura(mupdf) or acroread, so I think it's a bug in evince, but heh. |
Yes, that's true, I couldn't reproduce the PDF displaying issue anywhere else beside Evince. |
Thanks for linking #8768. I was wondering no else found this bug before me :-) |
Relabeled the issue to focus on the evince problem as the ticker problem is already tracked elsewhere. |
Maybe for very small ranges change locator: import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
arr = np.array([3765, 3792], dtype=np.float32)
plt.clf()
plt.bar(range(len(arr)), arr)
plt.yscale('log')
base_exponents = np.unique(np.floor(np.log10(plt.ylim())))
msb_digits = np.floor(plt.ylim() / (10**np.floor(np.log10(plt.ylim())))).astype(np.int)
if (base_exponents.size == 1 or np.abs(np.diff(base_exponents))[0] < 1) and np.count_nonzero(np.bincount(msb_digits)) < 3:
ax = plt.gca()
ax.yaxis.set_major_locator(locator=ticker.NullLocator())
ax.yaxis.set_minor_locator(locator=ticker.AutoLocator()) This at least puts some numbers on the y-axis. But this doesn't solve the Evince issue. |
plt.tight_layout() or plt.savefig("test.pdf", bbox_inches="tight") fixes the displaying of the tick labels. |
Closing as I think the remaining issue belongs to evince (https://gitlab.gnome.org/GNOME/evince/issues/1056) and I don't think there's anything else to do on Matplotlib's side. |
This is a regression in matplotlib 2.x.x. The bug does not exist in matplotlib 1.5.x.
Bug report
Bug summary
When using some special numbers matplotlib.bar() is missing y-ticks and corresponding y-tick labels.
Code for reproduction
Actual outcome
Expected outcome
Matplotlib version
Bonus
Plotting issues with Evince 3.18.2 in Ubuntu 16.04. The bars are upside down depending on the zoom level.
Zoom level: 140%

Zoom level: 170%

The text was updated successfully, but these errors were encountered: