comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL New Graphics Axis function: bug or feature?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL New Graphics Axis function: bug or feature? [message #81757] Mon, 22 October 2012 17:33 Go to next message
manodeep@gmail.com is currently offline  manodeep@gmail.com
Messages: 33
Registered: June 2006
Member
Hi everyone,

I was trying to add an alternate X-axis to a new graphics plot when I could not place this new X-axis on the plot no matter how I tried. It turns out that the original data co-ordinate was established with /YLOG and the AXIS function wanted the location to be set in alog10(yrange[1]).

Here's an example code:
--------------------------------------
;;; generate some random data
N = 100
x = dindgen(N)
y = randomu(seed,N)*N


;;; create the plot
p = plot(x,y,/ylog) ;;; use YLOG
ax = p.axes
ax[2].hide=1 ;;; hide the top X-axis

;;; Now try to plot a new alternate X-axis
ymax = (p.yrange)[1]
a0 = axis('X',location=[0.0,ymax],tickdir=1);;; axis does not appear
a1 = axis('X',location=[0.0,alog10(ymax)],tickdir=1) ;;; axis appears at the top

end
--------------------------------------
IDL> print,!version
{ x86_64 linux unix linux 8.0 Jun 18 2010 64 64}



Looking through the newsgroup, it seems this behaviour is in line with what Sean Davis saw here: https://groups.google.com/forum/#!topic/comp.lang.idl-pvwave /lNWGIDjJQh8

I don't think IDL Direct Graphics AXIS procedure worked in this fashion. Anybody aware of the reason for the change?

Cheers,
Manodeep
Re: IDL New Graphics Axis function: bug or feature? [message #81827 is a reply to message #81757] Wed, 24 October 2012 22:51 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le mercredi 24 octobre 2012 18:31:29 UTC+2, Manodeep Sinha a écrit :
> On Wednesday, October 24, 2012 2:11:23 AM UTC-5, alx wrote:
>
>> Le mardi 23 octobre 2012 19:32:22 UTC+2, Mark Piper a écrit :
>
>>
>
>>> On Monday, October 22, 2012 6:33:00 PM UTC-6, Manodeep Sinha wrote:
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> I was trying to add an alternate X-axis to a new graphics plot when I could not place this new X-axis on the plot no matter how I tried. It turns out that the original data co-ordinate was established with /YLOG and the AXIS function wanted the location to be set in alog10(yrange[1]).
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Hi Manodeep,
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> I think this is a bug. Your statement:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> a0 = axis('X',location=[0.0,ymax],tickdir=1)
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> should place an x-axis at y=100. I'll write it up.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> mp
>
>>
>
>>
>
>>
>
>> I had the feeling, by looking at the AXIS documentation ("When drawing an X axis, the x coordinate is ignored, etc..."), that the coordinate had to be ignored too in the statement. So that:
>
>>
>
>> a0 = axis('X',location=[ymax],tickdir=1)
>
>>
>
>> seems to work, as well as:
>
>>
>
>> a1 = axis('Y',location=[xmax],tickdir=1)
>
>>
>
>> in case of Y being log-scaled.
>
>>
>
>> If true, that is definitely a bug, since the starting coordinate of the new axis remains constrained along a direction.
>
>>
>
>>
>
>>
>
>> alain.
>
>
>
> Huh. I actually get an error 'LOCATION must have 2 or 3 elements' when I try to run those two lines. You are right that orientation of the new axis is constrained to be parallel to the currently established co-ordinate system.

By using IDL V8.2.1 and Win7, on "pl=plot(/TEST)", I find that
"ax=axis('X',LOCATION=[0.2,0.2])", as well as "ax=axis('X',LOCATION=[0.2])", produces an horizontal axis located at the right Y, but wrongly starting at X=0.

alx.
Re: IDL New Graphics Axis function: bug or feature? [message #81837 is a reply to message #81757] Wed, 24 October 2012 09:31 Go to previous messageGo to next message
manodeep@gmail.com is currently offline  manodeep@gmail.com
Messages: 33
Registered: June 2006
Member
On Wednesday, October 24, 2012 2:11:23 AM UTC-5, alx wrote:
> Le mardi 23 octobre 2012 19:32:22 UTC+2, Mark Piper a écrit :
>
>> On Monday, October 22, 2012 6:33:00 PM UTC-6, Manodeep Sinha wrote:
>
>>
>
>>>
>
>>
>
>>> I was trying to add an alternate X-axis to a new graphics plot when I could not place this new X-axis on the plot no matter how I tried. It turns out that the original data co-ordinate was established with /YLOG and the AXIS function wanted the location to be set in alog10(yrange[1]).
>
>>
>
>>>
>
>>
>
>>
>
>>
>
>> Hi Manodeep,
>
>>
>
>>
>
>>
>
>> I think this is a bug. Your statement:
>
>>
>
>>
>
>>
>
>> a0 = axis('X',location=[0.0,ymax],tickdir=1)
>
>>
>
>>
>
>>
>
>> should place an x-axis at y=100. I'll write it up.
>
>>
>
>>
>
>>
>
>> mp
>
>
>
> I had the feeling, by looking at the AXIS documentation ("When drawing an X axis, the x coordinate is ignored, etc..."), that the coordinate had to be ignored too in the statement. So that:
>
> a0 = axis('X',location=[ymax],tickdir=1)
>
> seems to work, as well as:
>
> a1 = axis('Y',location=[xmax],tickdir=1)
>
> in case of Y being log-scaled.
>
> If true, that is definitely a bug, since the starting coordinate of the new axis remains constrained along a direction.
>
>
>
> alain.

Huh. I actually get an error 'LOCATION must have 2 or 3 elements' when I try to run those two lines. You are right that orientation of the new axis is constrained to be parallel to the currently established co-ordinate system.
Re: IDL New Graphics Axis function: bug or feature? [message #81893 is a reply to message #81827] Fri, 26 October 2012 12:47 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi all,

The original bug is now fixed. If you have logarithmic axes, you can just specify the LOCATION in regular units (you don't have to take the log first). Thanks for reporting the bug!

Regarding the LOCATION, we also changed the behavior so you only have to give a single scalar number. So for example, for an X axis, you just set the LOCATION to the "Y" value where you want the axis. You can also set LOCATION="bottom", or "top", "left", or "right" as a shortcut. Note that the old behavior (where you had to specify a 2 or 3-element array) will still work find, but is undocumented.

Finally, if you want to do what alx wants (where the axis doesn't extend across the entire range), you can use the AXIS_RANGE property.

Hope this helps.

Cheers,
Chris
ExelisVIS
p.s. all of the above changes will be in IDL 8.2.2, due out early next year.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Counting Keyword set in a procedure!
Next Topic: Re: I'm a beginner, IDL question plot, max_value

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:17:48 PDT 2025

Total time taken to generate the page: 0.00887 seconds