comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » plotting x-y error bars in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: plotting x-y error bars in IDL [message #86857 is a reply to message #86856] Mon, 09 December 2013 02:10 Go to previous messageGo to previous message
atmospheric physics is currently offline  atmospheric physics
Messages: 121
Registered: June 2010
Senior Member
Hello All,

Thanks for the suggestions. I have an array of latitude, longitude coordinates from GPS measurements from various stations with corresponding variability (i.e., standard deviation) over a period of operation. I am trying to plot the errorbars of latitude and longitude on a latitude-longitude axes. I am first obtaining the latitude-longitude axes and then projecting the lat-lon points. Next, I wanted to plot the errorbars corresponding to lat and lon values by using the commands as suggested in the example of Coyote graphics. While I see the figures and the points on the lat-lon axes nicely, I don't see the error bars and x-y labels. Can you suggest where I am going wrong? Below is my IDL code for your reference...

; ---------------------------------------------
PRO test_errorPlot

xlon = longitude
ylat = latitude
xstd = lon_err & ystd = lat_err

x_higherr=(xlon + xstd) & x_lowerr=(xlon - xstd)
y_higherr=(ylat + ystd) & y_lowerr=(ylat - ystd)

; Set up variables for the plot
xtitle='Longitude'
ytitle='Latitude'
title='Errorbar Plot'
position = [0.125, 0.125, 0.9, 0.925]
thick = (!D.Name EQ 'PS') ? 3 : 1

; Data Projection to Map coordinates
Lats=[50.84D,50.96D] ; deg.N
Lons=[6.36D,6.50D] ; deg E
centerLat=(Max(Lats) + Min(Lats)) / 2.0
centerLon=(Max(Lons) + Min(Lons)) / 2.0
zoom=12
scale = cgGoogle_MetersPerPixel(zoom)
xsize = 600 < 640 ; Max size of Google image with this Google API
ysize = 600 < 640 ; Max size of Google image with this Google API
resolution = STRTRIM(xsize,2) + 'x' + STRTRIM(ysize,2)

map = Obj_New('cgMap', 'Mercator', ELLIPSOID='WGS 84')
uv = map -> Forward(centerLon, centerLat)
uv_xcenter = uv[0,0]
uv_ycenter = uv[1,0]
xrange = [uv_xcenter - (xsize/2.0D*scale), uv_xcenter + (xsize/2.0D*scale)]
yrange = [uv_ycenter - (ysize/2.0D*scale), uv_ycenter + (ysize/2.0D*scale)]
map -> SetProperty, XRANGE=xrange, YRANGE=yrange

cgDisplay, 600, 500, Title=title

cgMap_Grid, MAP=map, /BOX_AXES, /cgGRID, FORMAT='(F0.2)'

cgPlotS, xlon, ylat, PSYM=16, SYMSIZE=1.2, MAP=map, COLOR='red'

; Draw the error bars in the signal Y
cgErrPlot, xlon, y_lowerr, y_higherr, COLOR='blu5',Thick=thick

; Draw the error bars in the signal X
cgErrPlot, ylat, x_lowerr, x_higherr, COLOR='blu5',Thick=thick, /Horizontal

END

; Display the plot in a graphics window.
cgDisplay, 600, 500
test_errorPlot

; Create a PostScript file.
cgPS_Open, Filename='test_errorPlot.ps'
test_errorPlot
cgPS_Close

; Create a PNG file with a width of 600 pixels.
cgPS2Raster, 'test_errorPlot.ps', /PNG

END

;-------------------------------------

Thanks in advance
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Error Bars Using Coyote Graphics
Next Topic: object graphics, exploding axis text, how to fix by explicitly setting char_dimens?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:06:18 PDT 2025

Total time taken to generate the page: 0.00451 seconds