I tried your contour_fixed_lines_ex.pro. It works.
In an application, I need to compare a few plots with the same scale.
That is, I need to use the same grey levels in those plots.
To test the resulting plot change with the C_VALUE, I modified your example to this:
----------------------------------------------------------
pro contour_fixed_lines_ex
;
; To show the problem of the C_VALUE in the contour().
; Kam Wan, Sept 7, 2011.
; The next four lines are to show where the data array is from.
; i.e. The rdata1 file should be created by running this code with
; the four lines uncommented.
;;;;;;;;; Create a simple, random dataset for contouring:
;data = RANDOMU(seed, 51, 51)
;openw, 10, 'rdata1'
;writeu, 10, data
;close,10
data = fltarr (51, 51)
data0 = coa('rdata1', 1, 51, 51)
data = data0(0)
lvls =[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0]
; ****** This is the test.
; In the first run, this line is commented out.
; In the second run, it is NOT commented.
;lvls = lvls * 2.
; ************
; This is to sure that different lvls is used.
print, lvls[10]
;CONTOUR, data, LEVELS=lvls, C_LABELS=[1,0,1,0,1,0,1,0], C_CHARSIZE = 1.25
;ctr=contour(data, C_VALUE=lvls, FONT_SIZE=7, rgb_table=4, n_levels=30, /fill)
ctr=contour(data, C_VALUE=lvls, FONT_SIZE=7, rgb_table=4, n_levels=30 )
c1 = colorbar(TARGET=ctr,position=[0.05,0.10,0.5,0.13] )
end
------------------------------------------------------------------------------------
With these modifications, I can use the same data array with different levels.
The two contour plots I got (by commenting, or un-commenting, the 'lvls=lvls*2' line)
are identical. So, it seems that the contour() doesn't really care about the
array given to C_VALUE. The colorbar is consistent with the contour plot,
but also doesn't care about the levels array. These are my problems.
There may be other option to tell the contour() to use different level-array!?
|