Plotting question, photon flux vs position, likely simple

Hello. In my current simulation, I’ve stored photon and neutron flux into a .h5 file, and my plot seems to be working. However, it is currently plotting each of the 500 batches as separate lines. How would I go about getting the sum of these batches, and then plotting errorbars on that plot? Is there a relevant example of someone who has done this before?

Here is my code for unpacking the .h5 file:

import matplotlib.pyplot as plt
import openmc
import numpy as np
with openmc.StatePoint(‘statepoint.500.h5’) as sp:
t = sp.get_tally(name=‘flux’)
FluxN = t.get_slice(scores=([‘flux’]),
filters = [openmc.ParticleFilter],
filter_bins=[(‘neutron’,)])
FluxP = t.get_slice(scores=([‘flux’]),
filters = [openmc.ParticleFilter],
filter_bins=[(‘photon’,)])

FluxN.mean.shape = (1000,1000)
FluxP.mean.shape = (1000,1000)

fig4 = plt.plot(FluxP.mean)
plt.xlabel(‘position (m)’)
plt.ylabel(‘flux’)
plt.show()

Looks like you are reshaping the tally mean, is your tally a mesh tally on a regular mesh.