Re: Reversing an axis with IDLgrAxis [message #14204 is a reply to message #14194] |
Tue, 02 February 1999 00:00   |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
> OK, I give. I would like to plot an axis (object graphics) with values
> descending rather than ascending in the normal positive direction. I can do
> this using (XY)COORD_CONV, but when I do, the tick text and axis title are
> reversed as well (mirror image) and I can't figure out how to reverse them
> back to read normally.
Plot against the inverse of the variable and get the labels you want via
the TICKFORMAT property. The TICKFORMAT_NEGATIVE function below
is designed to do this.
----
Mark Hadfield, m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand
********************************
;+
; NAME:
; TICKFORMAT_NEGATIVE
;
; PURPOSE:
; This function is designed for use with the TICKFORMAT property of
IDLgrAxis.
; Given a real value, it returns a string representing the inverse of that
value.
;
; CATEGORY:
; Miscellaneous
; Object graphics
;
; CALLING SEQUENCE:
; Result = FUNCTION_NAME(Direction, Index, Value)
;
; INPUTS:
; Direction: Axis direction, required by the TICKFORMAT interface but
ignored.
;
; Index: Axis index, required by the TICKFORMAT interface but
ignored.
;
; Value: The real value to be formatted.
;
; OUTPUTS:
; The function returns a scalar string.
;
; EXPLANATION:
; IDLgrAxis objects always have the values increasing from left to right.
; The axis can be reversed, but then the axis labels are seen from behind!
; So to get an axis with values decreasing from left to right, we have to
; plot the inverse of the variable and reformat the axis labels.
;
; TO DO:
; Allow format control via the DATA keyword.
;
; MODIFICATION HISTORY:
; Mark Hadfield, Jun 1998:
; Written.
;-
function TICKFORMAT_NEGATIVE, Direction, Index, Value
return, (format_axis_values(-Value))[0]
end
|
|
|