لماذا تضيف IDL علامات علامة خاصة بعلامات علامة مؤامرة مخصصة؟

StackOverflow https://stackoverflow.com/questions/3426091

سؤال

أحاول تحديد علامات علامة محور Y مخصص ، لكن IDL لا تتعاون.

enter image description here

في الجزء العلوي اليسار ، يجب أن يكون 1.0000 القيمة الأقصى ، لكن IDL يضع 57 هناك. 57 هو بُعد صفيف الحد الأقصى لبيبياتي.

لدي مجموعة من مستويات ETA (سلاسل) مقابلة 1: 1 مع مؤشرات الصفيف ، وأريد استخدامها كعلامات علامة. لقد حصلت على القليل من التعليمات البرمجية التي تتيح لها رسم علامات علامة رئيسية ، لكن IDL تستمر في إلقاء قيمة فهرس Array Silly Silly Max Array بدلاً من علامة القراد النهائية المطلوبة.

هل هناك طريقة يمكنني التخلص من ذلك؟

كما هو مطلوب ، إليك الرمز:

;Get the total number of possible y axis values( this case has 58 )
number_of_ticks = (size( custom_levels[ min_level:max_level ] ) )[1]

;I want 6 major tick marks
number_of_major_ticks = 6

;The amount in between each tick in terms of array index
tick_step = number_of_ticks / number_of_major_ticks

;Check if we can fit another tick mark in
if ((((number_of_major_ticks - 1)+min_level) * tick_step) + tick_step) LT number_of_ticks then begin
   number_of_major_ticks = number_of_major_ticks + 1
endif

;Get the array positions of the values that will be used for tick marks
tick_array_indices = indgen( number_of_major_ticks )    
tick_array_indices = (tick_array_indices+min_level) * tick_step

;Now build the array of tick mark strings that should be displayed
y_tick_labels = strarr( number_of_major_ticks + 1 )

for i = 0, number_of_major_ticks - 1 do begin
   y_tick_labels[i] = custom_levels[ tick_array_indices[ i ] ]
endfor

;That's all the initial setup, now to actually plot the data:
if overplot EQ 1 then begin 
  CASE contour_type OF
    'Solid Line':contour, var_slice, /overplot, levels = var_levels, /FOLLOW, Color = 0, YSTYLE = 1, XSTYLE = 1, XRANGE = [0, n_points ], YRANGE = [ min_level, max_level ]
    'Dashed Line':contour, var_slice, /overplot, levels = var_levels, /FOLLOW,  C_LINESTYLE = [1], C_COLOR = 0, Color = 0, YSTYLE = 1, XSTYLE = 1, YRANGE = [ min_level, max_level ], XRANGE = [0, n_points ]  
  endcase
endif else begin
  CASE contour_type OF
    'Fill':contour, var_slice, /Fill, C_COLORS=var_colors, Background = 16777215, levels=var_levels, POSITION=[0.1, 0.25, 0.9, 0.95], /NORMAL, Color = 0, Title = 'Cross section plot between coordinates ' +  strtrim(lat[x1, y1],2) + ',' + strtrim(lon[x1, y1],2) + ' and ' + strtrim(lat[x2, y2],2) + ',' + strtrim(lon[x2, y2],2), YTICKS = number_of_major_ticks, YTICKNAME =  y_tick_labels, YTITLE = custom_levels_title, XTITLE = 'Points in between the 2 chosen coordinates', CHARSIZE = 1.2, YSTYLE = 1, XSTYLE = 1, YRANGE = [ min_level, max_level ], XRANGE = [0, n_points ]
    'Solid Line':contour, var_slice, Background = 16777215, levels=var_levels, POSITION=[0.1, 0.25, 0.9, 0.95], Color = 0, Title = 'Cross section plot between coordinates ' +  strtrim(lat[x1, y1],2) + ',' + strtrim(lon[x1, y1],2) + ' and ' + strtrim(lat[x2, y2],2) + ',' + strtrim(lon[x2, y2],2), YTICKS = number_of_major_ticks, YTICKNAME =  y_tick_labels, YTITLE = custom_levels_title, XTITLE = 'Points in between the 2 chosen coordinates', CHARSIZE = 1.2, YSTYLE = 1, XSTYLE = 1, YRANGE = [ min_level, max_level ], XRANGE = [0, n_points ]
    'Dashed Line':contour, var_slice, Background = 16777215, levels=var_levels,C_LINESTYLE = [1], C_COLOR = 0, POSITION=[0.1, 0.25, 0.9, 0.95], Color = 0, Title = 'Cross section plot between coordinates ' +  strtrim(lat[x1, y1],2) + ',' + strtrim(lon[x1, y1],2) + ' and ' + strtrim(lat[x2, y2],2) + ',' + strtrim(lon[x2, y2],2), YTICKS = number_of_major_ticks, YTICKNAME =  y_tick_labels, YTITLE = custom_levels_title, XTITLE = 'Points in between the 2 chosen coordinates', CHARSIZE = 1.2, YSTYLE = 1, XSTYLE = 1, YRANGE = [ min_level, max_level ], XRANGE = [0, n_points ]           
  endcase  
endelse    

حالة التعبئة هي تلك التي يتم استخدامها الآن. Var_slice هو صفيف 450 × 58 في هذه الحالة.

هل كانت مفيدة؟

المحلول

Woops ، برزت بها.

يبدو أن IDL يتطلب منك تحديد عدد من علامات القراد 1 أقل من العلامات التي تقدمها.

لذا ، إذا كنت تريد 11 علامة علامة ، ولديك 11 علامة لعلامات العلامات الخاصة بك ، حدد عدد علامات القراد الرئيسية إلى 10.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top