X

Help Articles are product support tips and information straight from the NV5 Geospatial Technical Support team developed to help you use our products to their fullest potential.



7704 Rate this article:
3.5

How to Create a Buffered Line Graph

The following example code example demonstrates how to create a line graph with a buffer. This requires the use of the FILL_LEVEL property in conjunction with the FILL_BACKGROUND property. The FILL_LEVEL is the Y-value for the boundary below the plot line. Setting the FILL_BACKGROUND creates the fill underneath the line plot. 

In this example the first line, which is the upper buffer limit, uses the gray color for its fill. This is also the buffer colour. The second line is the lower buffer line and its fill colour is white and overlays the gray creating the desired width. The final line is the actual data line and is overplotted on the other plots.

pro ex_shaded_region_plot


; Define the data. The data in this example are called sightings.
year = [1970, 1975, 1980, 1985, 1990, 1995, 2000, 2005, 2010]
sightings = [215, 321, 473, 524, 608, 680, 575, 577, 532]

; Add desired buffer widths to the 'sightings' line
sightings_up40= sightings + 40
sightings_down40= sightings - 40

;Since 'fill_level' goes down calculate the lowest potential value
;from this line which is the upper buffer edge.
p2=plot(year,sightings_up40, thick=2, fill_level=175.0, $
color='white', $ ; to create clean buffer line
fill_background=1, $
fill_color='silver') 

;Set the 'fill_level' to a value that is lower than value for 'p2'. The overplot covers the
;silver color from p2 with white (to blend with background).
This becomes the lower buffer edge.
p3=plot(year,sightings_down40,thick=2, fill_level=100.0, $
color='white', $ ; to create clean buffer line
fill_background=1, fill_color='white',/overplot)

;Now overplot the orginal line...
p1=plot(year,sightings,thick=4, color='red',$
title='Crested Caracara Sightings',$
xtitle='Year', $
ytitle='Number of Sightings', $
font_style= 'bold', $
font_color= 'dim gray', $
/overplot)


END

Please login or register to post comments.
Featured

End-of-Life Policy Enforcement for ENVI 5.3 / IDL 8.5 and Earlier Versions

5/6/2024

April 1, 2024 Dear ENVI/IDL Customer,  We are reaching out to notify you of our supported... more »

How to Upgrade licenses to ENVI 6.x / IDL 9.x

12/5/2023

What is the new Upgrade function? Starting with ENVI 6.0 and IDL 9.0, we have implemented an... more »

What to do if the 'License Administrator - License Server' for the Next-Generation License Server does not start?

6/13/2023

Background: With the release of ENVI 5.7 & IDL 8.9 and the corresponding Next-Generation licensing... more »

Next-Generation Licensing FAQ

4/28/2023

  NV5 Geospatial has adopted a new licensing technology for all future releases of our ENVI, IDL... more »

The IDL Virtual Machine

6/6/2013

What is the IDL Virtual Machine? An IDL Virtual Machine is a runtime version of IDL that can... more »