Equivalent of ytick_get() in function graphics? [message #93076] |
Thu, 21 April 2016 10:29  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
Is there an equivalent to the direct graphics [XY]Tick_get keyword in function graphics?
When displaying plots that abut on each other, the annotation on the corner of one plot can overwrite that of its neighbor. For example,
p = plot(indgen(10),position=[0.1,0.525,0.95,0.95],xtickname=['' ])
p = plot(indgen(10)+2,position=[0.1,0.1,0.95,0.525],/current)
My thought was to get the Y axis values that IDL computes (and which I am happy with), and then redisplay these with the TICKVALUES property to AXIS, but omitting the offending edge value.
But I first I need to retrieve that tic values that IDL computed, (or find a function that reproduces the IDL algorithm for producing tick mark positions).
Thanks, --Wayne
|
|
|
Re: Equivalent of ytick_get() in function graphics? [message #93078 is a reply to message #93076] |
Thu, 21 April 2016 11:30   |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
Hello Wayne,
It sounds like you might want the tickname or tickvalues properties of a plot's axis:
p = plot(indgen(10),position=[0.1,0.525,0.95,0.95],xtickname=['' ])
p = plot(indgen(10)+2,position=[0.1,0.1,0.95,0.525],/current)
tn=(p['yaxis']).tickname
tn[-1]=''
(p['yaxis']).tickname=tn
I have a workaround for the overlapping labels that I incorporated in my multiplot equivalent for function graphics, which automatically suppresses these overlapping labels. The above is what I used in its setendticks method ( http://ppenteado.net/idl/pp_lib/doc/pp_multiplot__define.htm l)
If you are interested in replicating IDL's tick position algorithm, I have two in my wrapper for direct graphics' plot (created to deal with the overlapping labels issue): http://www.ppenteado.net/idl/pp_lib/doc/pp_plot.html
One is in the pp_plot_maketicks routine, the other is in pp_plot_decideintervals. I do not remember the difference between them, but the latter is supposed to be better.
Paulo
On Thursday, April 21, 2016 at 10:29:56 AM UTC-7, wlandsman wrote:
> Is there an equivalent to the direct graphics [XY]Tick_get keyword in function graphics?
>
> When displaying plots that abut on each other, the annotation on the corner of one plot can overwrite that of its neighbor. For example,
>
> p = plot(indgen(10),position=[0.1,0.525,0.95,0.95],xtickname=['' ])
> p = plot(indgen(10)+2,position=[0.1,0.1,0.95,0.525],/current)
>
> My thought was to get the Y axis values that IDL computes (and which I am happy with), and then redisplay these with the TICKVALUES property to AXIS, but omitting the offending edge value.
>
> But I first I need to retrieve that tic values that IDL computed, (or find a function that reproduces the IDL algorithm for producing tick mark positions).
>
>
> Thanks, --Wayne
|
|
|
Re: Equivalent of ytick_get() in function graphics? [message #93079 is a reply to message #93078] |
Fri, 22 April 2016 06:39   |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
On Thursday, April 21, 2016 at 2:30:02 PM UTC-4, Paulo Penteado wrote:
> Hello Wayne,
>
> It sounds like you might want the tickname or tickvalues properties of a plot's axis:
>
> p = plot(indgen(10),position=[0.1,0.525,0.95,0.95],xtickname=['' ])
> p = plot(indgen(10)+2,position=[0.1,0.1,0.95,0.525],/current)
> tn=(p['yaxis']).tickname
> tn[-1]=''
> (p['yaxis']).tickname=tn
Thanks! This is as easy as one could hope.
(I also didn't know that one could reference ['yaxis']. I had been referencing e.g. ['axis1'] but always forgetting if this was the X or Y axis.)
> I have a workaround for the overlapping labels that I incorporated in my multiplot equivalent for function graphics, which automatically suppresses these overlapping labels. The above is what I used in its setendticks method ( http://ppenteado.net/idl/pp_lib/doc/pp_multiplot__define.htm l)
I am finally getting around to converting all my plotting code to function graphics. It looks like you had figured out many of the tricks for doing this 6 years ago! Thanks again, --Wayne
|
|
|
Re: Equivalent of ytick_get() in function graphics? [message #93087 is a reply to message #93079] |
Mon, 25 April 2016 12:20  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
6 years? I did not even think function graphics had been around for that long. They are the new thing...
On Friday, April 22, 2016 at 6:39:28 AM UTC-7, wlandsman wrote:
> On Thursday, April 21, 2016 at 2:30:02 PM UTC-4, Paulo Penteado wrote:
>> Hello Wayne,
>>
>> It sounds like you might want the tickname or tickvalues properties of a plot's axis:
>>
>> p = plot(indgen(10),position=[0.1,0.525,0.95,0.95],xtickname=['' ])
>> p = plot(indgen(10)+2,position=[0.1,0.1,0.95,0.525],/current)
>> tn=(p['yaxis']).tickname
>> tn[-1]=''
>> (p['yaxis']).tickname=tn
>
>
> Thanks! This is as easy as one could hope.
>
> (I also didn't know that one could reference ['yaxis']. I had been referencing e.g. ['axis1'] but always forgetting if this was the X or Y axis.)
>
>> I have a workaround for the overlapping labels that I incorporated in my multiplot equivalent for function graphics, which automatically suppresses these overlapping labels. The above is what I used in its setendticks method ( http://ppenteado.net/idl/pp_lib/doc/pp_multiplot__define.htm l)
>
> I am finally getting around to converting all my plotting code to function graphics. It looks like you had figured out many of the tricks for doing this 6 years ago! Thanks again, --Wayne
|
|
|