logarithmic colorbar [message #87435] |
Mon, 03 February 2014 07:43  |
simona bellavista
Messages: 56 Registered: December 2009
|
Member |
|
|
I am trying to make a logarithmic colobar. I am not entirely sure this is correct.
The variable a that I am plotting as a shade of color is actually a log10(a). In the colorbar I would like to have a logarithmic axis. I do the following:
colors = bytscl(alog10(a))
plot, x, y, /nodata
for i = 0, n_elements(x) plots, x[i], y[i], color=colors[i], psym=4
vtick = alog10(2e3*dindgen(5)+1e3)
colorbar, range = [min(alog10(a)),max(alog10(a))], orientation=1, tickvalues=vtick, tickname=string(tickvalues,format='(I6)')
and the ticks are created as usually equi-spaced and they are actually 7.
And also the option orientation does have any effect and I can't get the bar on the side, but instead it is on the top inside my plot, how do I get it to stay on the side? I think the problem is that when plot is called it fills the whole window and no space is left.
|
|
|
Re: logarithmic colorbar [message #87436 is a reply to message #87435] |
Mon, 03 February 2014 07:54   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
simona bellavista writes:
>
> I am trying to make a logarithmic colobar. I am not entirely sure this is correct.
> The variable a that I am plotting as a shade of color is actually a log10(a). In the colorbar I would like to have a logarithmic axis. I do the following:
>
> colors = bytscl(alog10(a))
>
> plot, x, y, /nodata
> for i = 0, n_elements(x) plots, x[i], y[i], color=colors[i], psym=4
> vtick = alog10(2e3*dindgen(5)+1e3)
> colorbar, range = [min(alog10(a)),max(alog10(a))], orientation=1, tickvalues=vtick, tickname=string(tickvalues,format='(I6)')
>
> and the ticks are created as usually equi-spaced and they are actually 7.
>
> And also the option orientation does have any effect and I can't get the bar on the side, but instead it is on the top inside my plot, how do I get it to stay on the side? I think the problem is that when plot is called it fills the whole window and no space is left.
This article might help:
http://www.idlcoyote.com/graphics_tips/logcb.html
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: logarithmic colorbar [message #87441 is a reply to message #87436] |
Mon, 03 February 2014 09:43   |
simona bellavista
Messages: 56 Registered: December 2009
|
Member |
|
|
Dear David,
your answer are always resolutive.
I just want to point out to hypothetical future readers that in order to fit the color bar I changed the margins with with xmargin.
On Monday, 3 February 2014 16:54:43 UTC+1, David Fanning wrote:
> simona bellavista writes:
>
>
>
>>
>
>> I am trying to make a logarithmic colobar. I am not entirely sure this is correct.
>
>> The variable a that I am plotting as a shade of color is actually a log10(a). In the colorbar I would like to have a logarithmic axis. I do the following:
>
>>
>
>> colors = bytscl(alog10(a))
>
>>
>
>> plot, x, y, /nodata
>
>> for i = 0, n_elements(x) plots, x[i], y[i], color=colors[i], psym=4
>
>> vtick = alog10(2e3*dindgen(5)+1e3)
>
>> colorbar, range = [min(alog10(a)),max(alog10(a))], orientation=1, tickvalues=vtick, tickname=string(tickvalues,format='(I6)')
>
>>
>
>> and the ticks are created as usually equi-spaced and they are actually 7.
>
>>
>
>> And also the option orientation does have any effect and I can't get the bar on the side, but instead it is on the top inside my plot, how do I get it to stay on the side? I think the problem is that when plot is called it fills the whole window and no space is left.
>
>
>
> This article might help:
>
>
>
> http://www.idlcoyote.com/graphics_tips/logcb.html
>
>
>
> 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: logarithmic colorbar [message #87442 is a reply to message #87441] |
Mon, 03 February 2014 09:49  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
simona bellavista writes:
> I just want to point out to hypothetical future readers that in order to fit the color bar I changed the margins with with xmargin.
Yeah, I never use margins, because they have such strange units
(character size) that it becomes impossible to overlap other annotations
on top of them, create the same kind of hard copy output, etc. I always
position my graphics output with the POSITION keyword, since it means
the same thing on every graphics device, including the PostScript and Z
graphics buffer.
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.")
|
|
|