Can't suppress 0 on AXIS call [message #87073] |
Sun, 05 January 2014 01:30  |
OM
Messages: 12 Registered: February 2011
|
Junior Member |
|
|
Hi everyone,
I'm trying to add another x-axis at the top of several plots that are adjacent by using the AXIS command and the xstyle=9 keyword. Because they are adjacent, the rightmost tick mark of one plot is very close to the leftmost tick mark of the plot to its right. For that reason, I'd like to suppress the leftmost tick mark of all plots but the first one. I'm already using the xtickname keyword, so I tried just making the first tick mark empty with ' ', but it seems that IDL is set on putting a 0 there, no matter what I do. I tried putting another value instead of making it empty, but it just puts the value there WITH the 0 on top (or below, it's hard to tell). I tried using David Fanning's cgaxis, but that doesn't change anything. I'm really not sure what's going on here, or how to solve this...
The IDL version, if needed, is x86_64 linux 8.2.2.
I'd really appreciate help with this, it's kind of driving me crazy...
|
|
|
Re: Can't suppress 0 on AXIS call [message #87074 is a reply to message #87073] |
Sun, 05 January 2014 06:43   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
OM writes:
> I'm trying to add another x-axis at the top of several plots that are adjacent by using the AXIS command and the xstyle=9 keyword. Because they are adjacent, the rightmost tick mark of one plot is very close to the leftmost tick mark of the plot to its right. For that reason, I'd like to suppress the leftmost tick mark of all plots but the first one. I'm already using the xtickname keyword, so I tried just making the first tick mark empty with ' ', but it seems that IDL
is set on putting a 0 there, no matter what I do. I tried putting another value instead of making it empty, but it just puts the value there WITH the 0 on top (or below, it's hard to tell). I tried using David Fanning's cgaxis, but that doesn't change anything. I'm really not sure what's going on here, or how to solve this...
> The IDL version, if needed, is x86_64 linux 8.2.2.
>
> I'd really appreciate help with this, it's kind of driving me crazy...
Instead of making the value an empty string (e.g. value = ""), make it a
blank character (e.g. value = " "). That works for me. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|
|
Re: Can't suppress 0 on AXIS call [message #87078 is a reply to message #87076] |
Mon, 06 January 2014 04:27   |
OM
Messages: 12 Registered: February 2011
|
Junior Member |
|
|
Here is a typical plotting code for one of the plots to the left of the first one (this is of course all done using !p.multi; the first object of the xtickname array is a blank space):
LEFT=0.35
RIGHT=0.65
BOTTOM=0.3
TOP=0.9
cgplot, t[w],ymm[3,w],/ylog,thick=7,linestyle=4,color=192,xstyle=9,x range=[0,14],ystyle=1,yrange=[1.e-4,2.e-2],charsize=sh,chart hick=ch,xtickformat= "(A1)",ytickformat="(A1)",pos=[LEFT,BOTTOM,RIGHT,TOP]
for i=0,2 do cgoplot, t[w],ymm[i,w],thick=7,linestyle=i+1,color=col[i]
axis,xaxis=1,xrange=[0,14],xstyle=1,xtickv=ts,xtickname=[' ',string(rss[1],format='(D0.1)'),strtrim(string(rss[2:6],for mat='(I)'),2)],xticks=8,charsize=sh,charthick=ch
|
|
|
Re: Can't suppress 0 on AXIS call [message #87079 is a reply to message #87078] |
Mon, 06 January 2014 05:57  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
OM writes:
>
> Here is a typical plotting code for one of the plots to the left of the first one (this is of course all done using !p.multi; the first object of the xtickname array is a blank space):
>
> LEFT=0.35
> RIGHT=0.65
> BOTTOM=0.3
> TOP=0.9
>
> cgplot, t[w],ymm[3,w],/ylog,thick=7,linestyle=4,color=192,xstyle=9,x range=[0,14],ystyle=1,yrange=[1.e-4,2.e-2],charsize=sh,chart hick=ch,xtickformat= "(A1)",ytickformat="(A1)",pos=[LEFT,BOTTOM,RIGHT,TOP]
>
> for i=0,2 do cgoplot, t[w],ymm[i,w],thick=7,linestyle=i+1,color=col[i]
>
> axis,xaxis=1,xrange=[0,14],xstyle=1,xtickv=ts,xtickname=[' ',string(rss[1],format='(D0.1)'),strtrim(string(rss[2:6],for mat='(I)'),2)],xticks=8,charsize=sh,charthick=ch
Well, it is a grave mistake to use !P.MULTI and the POSITION keyword at
the at the same time, but I doubt that has much to do with the
particular problem we are trying to solve here.
Trying to duplicate your code as much as possible, I find that this
works perfectly:
cgPlot, cgdemodata(1), xstyle=9, ystyle=8, $
position=[0.1, 0.1, 0.5, 0.9], $
xrange=[0,14], xtickformat='(A1)', ytickformat='(A1)'
xnames = StrTrim(SIndGen(8)*2,2)
xnames[7] = ' '
cgAxis, XAXIS=1, XTickName=xnames, xstyle=1
cgPlot, cgdemodata(1), xstyle=9, ystyle=8, $
position=[0.5, 0.1, 0.9, 0.9], /NoErase, $
xrange=[0,14], xtickformat='(A1)', ytickformat='(A1)'
cgAxis, XAXIS=1, xstyle=1
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|