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

Home » Public Forums » archive » COLORBAR label too long
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
COLORBAR label too long [message #55359] Fri, 17 August 2007 10:41 Go to next message
rchughes is currently offline  rchughes
Messages: 26
Registered: April 2006
Junior Member
Dear All,

I have created a nice-looking plot with a color bar on the top but the
labels extend too far past the end of the bar. My plot is positioned
in the bottom 80% of the window and the color bar is in the top 20%
(using the POSITION keywords). The array of values I give to the
COLORBAR procedure extends beyond the end of the bar.

Here is a diagram of what happens:

1 2 3 4 5 6 7 8 9 0 <-labels
---------------------
--------------------- <-colorbar
____________
| |
| | <-plot
| |
|___________ |

Here is my code:
PLOT, FINDGEN(10), POSITION=[0.05, 0.05, 0.95, 0.82]

ticks = (SINDGEN((clrTableLength/5)+1)*5)-(clrTableLength/2)

COLORBAR, BOTTOM=0, NCOLORS=clrTableLength, /TOP, $
TICKNAMES=ticks, COLOR=black, DIVISIONS=(clrTableLength/5), $
POSITION=[0.07, 0.87, 0.93, 0.95]

'clrTableLength' is the length of a color table I created. Currently
I am using a table of length 100 (i.e. clrTableLength=100)

Thanks,
Ryan.

P.S. David Fanning if you are reading this, I cannot access your web
page to see if you have any documentation on this at the moment
because all external network connections are down except internal
pages and any Google affiliated pages. (Please don't ask me why this
is, I don't know)
Re: COLORBAR [message #56719 is a reply to message #55359] Fri, 09 November 2007 11:35 Go to previous message
phillipbitzer is currently offline  phillipbitzer
Messages: 6
Registered: November 2007
Junior Member
On Nov 9, 11:59 am, David Fanning <n...@dfanning.com> wrote:
> phillipbit...@gmail.com writes:
>> For anyone who's used D Fanning's colorbar program-
>
>> When using colorbar pro, how can I get the values of the tickmarks (!
>> x.tickv doesn't work - return an array of 0's)?
>
>> Here's the underlying reason, when annotating the color bar, the
>> program (seems to one be able to) annotates the major tick marks. I
>> actually would like my tick labels not on the major tick marks, but
>> "in the middle" of the color. I think this would correspond to (only)
>> labelling the minor tick marks.
>
>> Maybe a visual would help me be more clear:
>
>> Instead of labelling:
>> here here here
>> |----------|----------|
>
>> I would like:
>> here here
>> |----------|----------|
>
>> I've been fooling around with the parameters, but to no avail. Anyone
>> else have this need/want before? Anyone have any ideas to accomplish
>> this?
>
> The COLORBAR program, for historical reasons, as well as for
> ease of programming, uses a PLOT command to do the annotation.
> So, what you want to do is not possible with that code.
>
> And because of recent changes, I can't even offer an undocumented
> keyword solution that will completely scrub the bar of annotations,
> so you could write your own axis labeling routine. :-(
>
> I'd recommend just writing your own colorbar routine. You can use
> PLOTS to draw your boxes on the colorbar image, and you can annotate it
> however you like with XYOUTS.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")


OK, so if anyone's interested, I've got a little workaround.
Basically, it's slightly mod-ing of colorbar so that it works (I'm
doing a vertical bar, with /right set)- the keyword I was looking for
is [xyz]tick_get:

PLOT,[minrange,maxrange], [minrange,maxrange], /NODATA,
XTICKS=1, $

YTICKS=divisions, XSTYLE=1, YSTYLE=1, $

POSITION=position, COLOR=color, CHARSIZE=charsize, /NOERASE,
$

YTICKFORMAT='(A1)', XTICKFORMAT='(A1)', YTICKLEN=ticklen , $

YRANGE=[minrange, maxrange], FONT=font, _EXTRA=extra,
YMINOR=minor, ytick_get=Y_tick_values

mid = FINDGEN(divisions)
FOR i=0, N_ELEMENTS(y_tick_values)-2 DO BEGIN
mid[i] = (y_tick_values[i]+y_tick_values[i+1])/2
ENDFOR

AXIS, YAXIS=1, YTICKV=mid, $
YTICKFORMAT=format, YTICKS=divisions, $

YTICKLEN=ticklen, YSTYLE=1, COLOR=color, CHARSIZE=charsize,
$

FONT=font, YTITLE=title, _EXTRA=extra, YMINOR=minor,
YTICKNAME=ticknames
Re: COLORBAR [message #56720 is a reply to message #55359] Fri, 09 November 2007 10:07 Go to previous message
phillipbitzer is currently offline  phillipbitzer
Messages: 6
Registered: November 2007
Junior Member
On Nov 9, 11:59 am, David Fanning <n...@dfanning.com> wrote:
> phillipbit...@gmail.com writes:
>> For anyone who's used D Fanning's colorbar program-
>
>> When using colorbar pro, how can I get the values of the tickmarks (!
>> x.tickv doesn't work - return an array of 0's)?
>
>> Here's the underlying reason, when annotating the color bar, the
>> program (seems to one be able to) annotates the major tick marks. I
>> actually would like my tick labels not on the major tick marks, but
>> "in the middle" of the color. I think this would correspond to (only)
>> labelling the minor tick marks.
>
>> Maybe a visual would help me be more clear:
>
>> Instead of labelling:
>> here here here
>> |----------|----------|
>
>> I would like:
>> here here
>> |----------|----------|
>
>> I've been fooling around with the parameters, but to no avail. Anyone
>> else have this need/want before? Anyone have any ideas to accomplish
>> this?
>
> The COLORBAR program, for historical reasons, as well as for
> ease of programming, uses a PLOT command to do the annotation.
> So, what you want to do is not possible with that code.
>
> And because of recent changes, I can't even offer an undocumented
> keyword solution that will completely scrub the bar of annotations,
> so you could write your own axis labeling routine. :-(
>
> I'd recommend just writing your own colorbar routine. You can use
> PLOTS to draw your boxes on the colorbar image, and you can annotate it
> however you like with XYOUTS.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Thought (afraid?) that was going to be case. Thanks!
Re: COLORBAR [message #56721 is a reply to message #55359] Fri, 09 November 2007 09:59 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
phillipbitzer@gmail.com writes:

> For anyone who's used D Fanning's colorbar program-
>
> When using colorbar pro, how can I get the values of the tickmarks (!
> x.tickv doesn't work - return an array of 0's)?
>
> Here's the underlying reason, when annotating the color bar, the
> program (seems to one be able to) annotates the major tick marks. I
> actually would like my tick labels not on the major tick marks, but
> "in the middle" of the color. I think this would correspond to (only)
> labelling the minor tick marks.
>
> Maybe a visual would help me be more clear:
>
> Instead of labelling:
> here here here
> |----------|----------|
>
> I would like:
> here here
> |----------|----------|
>
> I've been fooling around with the parameters, but to no avail. Anyone
> else have this need/want before? Anyone have any ideas to accomplish
> this?

The COLORBAR program, for historical reasons, as well as for
ease of programming, uses a PLOT command to do the annotation.
So, what you want to do is not possible with that code.

And because of recent changes, I can't even offer an undocumented
keyword solution that will completely scrub the bar of annotations,
so you could write your own axis labeling routine. :-(

I'd recommend just writing your own colorbar routine. You can use
PLOTS to draw your boxes on the colorbar image, and you can annotate it
however you like with XYOUTS.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: How to use customized Hershey fonts?
Next Topic: CUDA technology in IDL

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

Current Time: Fri Oct 10 12:48:27 PDT 2025

Total time taken to generate the page: 0.97661 seconds