-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Description
Hi all,
I am using the root2matplotlib module to plot root histograms. I would like to have the ticks on the inner side of the axis, but they are covered by the histogram. Specifying a large value for zorder does not solve the problem. Note that the green line has a smaller zorder value than the ticks, yet it is shown on top of the histogram.
from __future__ import division, print_function
import matplotlib
import matplotlib.pyplot as plt
import rootpy.io
import rootpy.plotting
import rootpy.plotting.root2matplotlib
f = rootpy.io.root_open('samplehistogram.root')
h = f['h']
fig, ax = plt.subplots(1, 1)
rootpy.plotting.root2matplotlib.hist(h, color='red', axes=ax)
ax.tick_params(which='both', direction='in', zorder=10)
ax.axvline(0, color='green', linestyle='--', zorder=5)
plt.tight_layout()
fig.show()
As a sanity check, this works as intended in matplotlib:
from __future__ import division, print_function
import numpy as np
import numpy.random
import matplotlib
import matplotlib.pyplot as plt
numbers = np.random.rand(50, 1)
fig, ax = plt.subplots(1, 1)
ax.hist(numbers, histtype='stepfilled')
ax.tick_params(which='both', direction='in')
fig.show()
I found the unrelated #537, but the picture therein shows the ticks on the inside in front of the histograms. When I run the code now, the ticks are on the outside. If I manually place them on the inside, the histograms overlays them.
Tested with
- Python 2.7.16, matplotlib 2.2.4, rootpy 1.0.1
Metadata
Metadata
Assignees
Labels
No labels

