NLevels Keyword
Corresponding System Variable: None.
The number of equally-spaced contour levels that are produced by CONTOUR and CONTOUR2. The maximum is 150. (Default: 6)
If the Levels parameter, which explicitly specifies the value of the contour levels, is present this keyword has no effect. If neither parameter is present, either two or three levels are drawn.
If the minimum and maximum Z values are Zmin and Zmax, then the value of the ith level is:
Zmin + (i + 1)* (Zmax – Zmin)/(NLevels + 1)
where i ranges from 0 to NLevels – 1.
Zmin and Zmax are derived from !Z.Crange, the Z axis' rounded minimum and maximum values, even if the Z axis is not displayed. If the keyword /ZStyle is set, which will produce an exact Z axis, Zmax and Zmax will be derived directly from the Z data range. The !Z.Crange value used can be viewed after plotting is complete.
Example
nlev = 6
CONTOUR, DIST(100), NLevels=nlev, /Follow
FOR i=0L, (nlev-1) DO PRINT, !Z.Crange(0) + (i + 1) * $
(!Z.Crange(1) - !Z.Crange(0))/(nlev + 1), Format='(F10.2)'
; PV-WAVE prints:
; 11.43
; 22.86
; 34.29
; 45.71
; 57.14
; 68.57
; now set the ZStyle keyword
CONTOUR, DIST(100), NLevels=nlev, /ZStyle, /Follow
FOR i=0L, (nlev-1) DO PRINT, !Z.Crange(0) + (i + 1) * $
(!Z.Crange(1) - !Z.Crange(0))/(nlev + 1), Format='(F10.2)'
; PV-WAVE prints:
; 9.90
; 19.80
; 29.70
; 39.60
; 49.50
; 59.40