How to plot an envelope form error bar with psxy

Hi there,

I have a question about error bar plotting. Could you know how to plot an envelope to the error bar with psxy? Normally, I use psxy -E to make an error bar. But I would like to link all the ends of the bars (upper and lower) together that looks like an envelope. BTW, I use GMT 5 for my plotting. Cheers.

Alex

Presuming you have three column data (x,y,error), it’s an easy thing to send the table through gmtmath to compute lines representing the top/bottom of the envelope.

First, create the lines for the top & bottom of the envelope, then plot them as lines. Something like this (if this is something GMT5 can do):

gmt gmtmath -o0,1 infile.txt -C1 2 COL ADD = top_env.txt
gmt gmtmath -o0,1 infile.txt -C1 2 COL SUB = bot_env.txt
gmt psxy top_env.txt -J -R -W... >> outfil.ps
gmt psxy bot_env.txt -J -R -W... >> outfil.ps

There is also psxy -L+d that was written specifically for this case. But who knows if ancient GMT versions supports that.

Thanks John, a reasonable and general idea.

Thanks Paul, that’s concise. I will try that.