iplot colorbar label [message #67877] |
Wed, 09 September 2009 07:42  |
Thibault .
Messages: 9 Registered: September 2009
|
Junior Member |
|
|
Hi,
Using iplot as a scatter plot, I assign colors to the data points
according to an array (using vert_colors) and I want to create the
corresponding colorbar with /insert_colorbar:
x=randomu(41,10)
y=randomu(50,10)
my_col=[150,255,12,160,187,245,36,58,210,170]
iplot,x,y,/insert_colorbar,rgb_table=39,sym_index=4,/
scatter,vert_colors=my_col
Doing that, the plot works and the colorbar is displayed BUT the
colorbar label goes from 0 to 1. I noticed that it goes from min to
max values of the y variable... whereas I want the label to span what
it really represents, namely the my_col array !!!
How to make the colorbar label ranging from 0 to 255 ( = the my_col
array min and max values) ?
Thank you.
|
|
|
|
|
|
Re: iplot colorbar label [message #68010 is a reply to message #67877] |
Thu, 10 September 2009 07:34   |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Sep 10, 10:03 am, "Thibault ." <garthalg...@yahoo.fr> wrote:
>> It guesses the format by the extension in the file name.
>
>> Before 7.1, you can, in the iplot window, go to the menu file->export-
>
>>> to data file, if I remember right (in 7.1 it is in file->save).
>
> Yeah, i have a version previous to 7.1 and I had already noticed the
> File->export way to save in .ps.
> But is there any way to implement it in a routine?
> I have to save many iplots in .ps automatically in a for loop...
I did a lot of that, too, which before 7.1 I did with
http://www.ppenteado.net/idl/pp_itool_save.html
http://www.ppenteado.net/idl/pp_itool_save.pro
|
|
|
|
Re: iplot colorbar label [message #68015 is a reply to message #67877] |
Thu, 10 September 2009 04:16   |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Sep 10, 7:11 am, "Thibault ." <garthalg...@yahoo.fr> wrote:
> Thanks for the routine!
>
> Indeed, I dont want the label to be the color index.
> I set my color table to a third variable z ( x and y are the
> positions).
> my_col = fix(z * 255/(max(z)-min(z))) where z spans the range 50 to
> 800.
> I think that writing this makes the plot that i want, attributing to
> each point defined by x and y in position, the appropriate color
> according to the z value.
> Then, using your pp_colorbar_range.pro routine by setting:
>
> iplot,x,y,/insert_colorbar,rgb_table=39,sym_index=3,/
> scatter,vert_colors=my_col
> pp_colorbar_range,[min(z),max(z)],font_size=12
>
> it gives something which seems to make sense... I hope it does :)
>
> In which way the keyword colors=colors is useful??
>
> Furthermore, do you have any idea how to save the iplots as postscript
> files?
There is no colors keyword for iplot, that I am aware of.There is
color, which is used to set the color of the plot line by its rgb
values (a constant color, while vert_colors sets the color at each
vertex.
In IDL 7.1, you can save the current itool to isv, ps, eps, and a
bunch of other formats with
isave,'file.ps'
It guesses the format by the extension in the file name.
Before 7.1, you can, in the iplot window, go to the menu file->export-
> to data file, if I remember right (in 7.1 it is in file->save).
|
|
|
Re: iplot colorbar label [message #68112 is a reply to message #67970] |
Wed, 16 September 2009 20:54  |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Sep 16, 10:35 am, "Thibault ." <garthalg...@yahoo.fr> wrote:
> Here is the result of print,!version: { x86_64 linux unix linux 7.0
> Oct 25 2007 64 64}
>
> The error message is in a pop up window :"Invalid export data source
> provided. Unable to continue."
>
> The test
>
>> iplot,findgen(10)
>> pp_itool_save,'pp_iplotexample'
>
> does the same thing...
Thanks. I forgot that the export source selection had changed in IDL
7.1, so I did not notice that I broke the program for older versions.
I updated the file on my website, it should work now. Please let me
know if it still does not work.
|
|
|