Labeling logarithmic axes [message #92734] |
Thu, 18 February 2016 17:16  |
laura.hike
Messages: 87 Registered: September 2013
|
Member |
|
|
Hi,
I can't find anything recent about this problem, so....
I am making a line plot and would like to use a logarithmic y-axis. So far so good. I use
pavgsw = plot(merraaswhr,merrap,color='red',thick=2,name='MERRA2',yra nge = [1000,100],ylog=1)
I get a nice plot with a log axis BUT only the 1000 and 100 tick marks are labeled. I would like to label 500 and 200 as well. Doug Fanning has a nice discussion of this at http://www.idlcoyote.com/graphics_tips/minorlog.html, however, the information seems to be outdated (or at least the keywords aren't recognized under the new graphics system). I tried a variety of options based on his method, like defining
axislabels = ['1000', '','','','','500','','','200','100']
then adding
pavgsw.ytickname = axislabels with or without pavgsw.ymajor = 9
(or doing the same with key words in the original plot statement).
The problem is that as soon as I add the ytickname option, the tick marks go back to linear spacing. Does anyone know how to fix this? I should point out that the plotted lines are not affected by the changes to the axis, only the axis markings are.
Thanks much,
Laura H.
|
|
|
Re: Labeling logarithmic axes [message #92786 is a reply to message #92734] |
Sat, 27 February 2016 11:50   |
Phillip Bitzer
Messages: 223 Registered: June 2006
|
Senior Member |
|
|
On Thursday, February 18, 2016 at 7:16:10 PM UTC-6, Laura H. wrote:
> The problem is that as soon as I add the ytickname option, the tick marks go back to linear spacing. Does anyone know how to fix this? I should point out that the plotted lines are not affected by the changes to the axis, only the axis markings are.
>
> Thanks much,
>
> Laura H.
Hi Laura-
You're going to want to suppress the minor ticks for this:
p=plot(/test, /ylog, yrange=[1000, 100])
ticks = [1000, 500, 200, 100]
p.ytickvalues = ticks
p.yminor=0
For kicks and giggles:
ticks2 = REVERSE((FINDGEN(10)+1)*100)
p.ytickvalues = ticks2
|
|
|
Re: Labeling logarithmic axes [message #92805 is a reply to message #92786] |
Wed, 02 March 2016 12:18   |
laura.hike
Messages: 87 Registered: September 2013
|
Member |
|
|
Thanks!
On Saturday, February 27, 2016 at 2:50:53 PM UTC-5, Phillip Bitzer wrote:
> On Thursday, February 18, 2016 at 7:16:10 PM UTC-6, Laura H. wrote:
>> The problem is that as soon as I add the ytickname option, the tick marks go back to linear spacing. Does anyone know how to fix this? I should point out that the plotted lines are not affected by the changes to the axis, only the axis markings are.
>>
>> Thanks much,
>>
>> Laura H.
>
> Hi Laura-
>
> You're going to want to suppress the minor ticks for this:
>
> p=plot(/test, /ylog, yrange=[1000, 100])
> ticks = [1000, 500, 200, 100]
> p.ytickvalues = ticks
> p.yminor=0
>
> For kicks and giggles:
> ticks2 = REVERSE((FINDGEN(10)+1)*100)
> p.ytickvalues = ticks2
|
|
|
Re: Labeling logarithmic axes [message #92806 is a reply to message #92786] |
Wed, 02 March 2016 12:25  |
laura.hike
Messages: 87 Registered: September 2013
|
Member |
|
|
Phil,
I still can't get this to work. When I add your commands after making the plot, it reverses the orientation of the y-axis (i.e., was 1000 to 100, reverses to 100 to 1000). If I force the orientation with a new yrange command, it flips, but the locations of the tick marks are incorrect: 100 is closer to 200 than 900 is to 1000. I don't understand this.
Laura
On Saturday, February 27, 2016 at 2:50:53 PM UTC-5, Phillip Bitzer wrote:
> On Thursday, February 18, 2016 at 7:16:10 PM UTC-6, Laura H. wrote:
>> The problem is that as soon as I add the ytickname option, the tick marks go back to linear spacing. Does anyone know how to fix this? I should point out that the plotted lines are not affected by the changes to the axis, only the axis markings are.
>>
>> Thanks much,
>>
>> Laura H.
>
> Hi Laura-
>
> You're going to want to suppress the minor ticks for this:
>
> p=plot(/test, /ylog, yrange=[1000, 100])
> ticks = [1000, 500, 200, 100]
> p.ytickvalues = ticks
> p.yminor=0
>
> For kicks and giggles:
> ticks2 = REVERSE((FINDGEN(10)+1)*100)
> p.ytickvalues = ticks2
|
|
|