Can you upload the data? Specifically, it is unclear to me what sort of data type g is.
Instead of plotting x, you'll want to do something like plotting
but I can't tell how to handle g1 without more info.
Also, it was unclear to me if the intervals are meant to be on x, or on g.