How to make scatter plot with colorbar in IDL? [message #85427] |
Fri, 02 August 2013 08:07  |
atmospheric physics
Messages: 121 Registered: June 2010
|
Senior Member |
|
|
Hello everyone,
I am working in IDL version 8.0. I am struck up with plotting in IDL even after following various suggestions by Coyote and EXELIS.
Data description:
I have 100 stations (represented by longitude and latitude) collecting some variable as a function of time (each second). I wanted to make the following subplots (using !p.multi) in the same figure.
Figure 1. I have downloaded the static googlemap from the following link: (centering 6.42 deg. E and 50.9 deg. N (or) lat: [50.84-50.96] deg. N and lon: [6.36-6.48] deg. E).
http://maps.googleapis.com/maps/api/staticmap?center=50.9,6. 42&zoom=13&size=500x500&maptype=satellite&se nsor=true
Now I want to include latitude (y-axis) & longitude (x-axis) as per the ranges shown above. Can anyone let me know how to do this? Overlaying on this, I want to make 2D scatter plot with colorbar representing my variable data while x and y represent the longitude & latitude of stations respectively. My variable data ranges from 0 to 1200.So, my colorbar is also required to have 1201 divisions. I prefer to have 'jetstream' colorbar.
I tried using the following lines for 2D scatter plot but could not succeed.
data_1=longitude ; array of 100 elements
data_2=latitude ; array of 100 elements
data_3=variable ; array of 100 elements
cgLoadCT,23
cgScatter2d,data_1,data_2,COLOR=BytScl(data_3)
I want each variable point to be represented a colored circle representing the corresponding value from the colorbar. I would appreciate if someone can help me with some example code to do this?
Figure 2. Since I have the variable data for 100 stations as a function of time, I would like to make simultaneously variable (y-axis) versus time (x-axis) with colorbar representing 100 stations with distinct colors.
Can anyone provide me a sample / rough code where I can plot Figure 1 above and Figure 2 below on the same figure. Ultimate goal for me to make a movie while I make each figure for each time step. I could succeed making this in MATLAB. Please advise me with some suggestions or sample examples to realize my figures & thus movie.
Thanks in advance ...
|
|
|
Re: How to make scatter plot with colorbar in IDL? [message #85428 is a reply to message #85427] |
Fri, 02 August 2013 08:44   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Madhavan Bomidi writes:
> Can anyone provide me a sample / rough code where I can plot Figure 1 above and Figure 2 below on the same figure. Ultimate goal for me to make a movie while I make each figure for each time step. I could succeed making this in MATLAB. Please advise me with some suggestions or sample examples to realize my figures & thus movie.
Do you have enough interest to purchase a $50 consulting contract from
the Coyote Store? I'm just about to head off on a family vacation, but I
expect to be eliminated from the 1st Annual Richie Seemueller Black-
Light, Glow-in-the-Dark Family Ping Pong Tournament early and will
probably have some time to put something together. (I taught the damn
kids how to play and now they show NO respect! If I could just *see* the
ball, I could probably beat them.)
As you probably have already discovered you are doing it "all wrong".
:-)
Distances are probably linear in the small lat/lon range you are using,
but generally it is must easier to navigate images when you do it in
projected meter space, rather than lat/lon space. There is plenty of
code in the Coyote Library to help with this (e.g., cgGoogleMapWidget),
but you are putting things together in a fairly novel way. At the very
least, you are going to have to set up a coordinate system for your
image (maybe just using the [XY]Range keywords on cgImage) and then put
the scatter plot on using the /OVERPLOT keyword.
> My variable data ranges from 0 to 1200.So, my colorbar is also
> required to have 1201 divisions.
That's not going to happen. :-)
Colorbars generally have 256 colors, tops. Your eye wouldn't be able to
distinguish any more colors than this, probably, unless you were
planning to use one of the monitors on Times Square to display the color
bar.
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: How to make scatter plot with colorbar in IDL? [message #85429 is a reply to message #85428] |
Fri, 02 August 2013 09:20   |
atmospheric physics
Messages: 121 Registered: June 2010
|
Senior Member |
|
|
Hello David,
I was expecting a response from you. Thanks for writing. I am not so dump in IDL and not required so quickly to purchase a consulting contract. I know that my objective is something difficult but all I require here is to get your or others suggestions in realizing my task. I enjoy learning things and not that I just agree for purchasing something in a hurry to finish my task.
First I will try to project the google map to meter space and then come up here again for going to the next step.
My ultimate goal is to overlay the following type scatter plot with colorbar on the static google map:
file:///mnt/satyr/home/madhavan/44040.jpg (I have made the above figure in MATLAB)
Is it not possible to divide the 256 colors into 1000 or 1200 divisions as shown in the figure? May be my wording is wrong by I mean to say through the figure. Don't be panic!!!
Sorry for any inconvenience,
Thanks
On Friday, August 2, 2013 5:44:22 PM UTC+2, David Fanning wrote:
> Madhavan Bomidi writes:
>
>
>
>> Can anyone provide me a sample / rough code where I can plot Figure 1 above and Figure 2 below on the same figure. Ultimate goal for me to make a movie while I make each figure for each time step. I could succeed making this in MATLAB. Please advise me with some suggestions or sample examples to realize my figures & thus movie.
>
>
>
> Do you have enough interest to purchase a $50 consulting contract from
>
> the Coyote Store? I'm just about to head off on a family vacation, but I
>
> expect to be eliminated from the 1st Annual Richie Seemueller Black-
>
> Light, Glow-in-the-Dark Family Ping Pong Tournament early and will
>
> probably have some time to put something together. (I taught the damn
>
> kids how to play and now they show NO respect! If I could just *see* the
>
> ball, I could probably beat them.)
>
>
>
> As you probably have already discovered you are doing it "all wrong".
>
> :-)
>
>
>
> Distances are probably linear in the small lat/lon range you are using,
>
> but generally it is must easier to navigate images when you do it in
>
> projected meter space, rather than lat/lon space. There is plenty of
>
> code in the Coyote Library to help with this (e.g., cgGoogleMapWidget),
>
> but you are putting things together in a fairly novel way. At the very
>
> least, you are going to have to set up a coordinate system for your
>
> image (maybe just using the [XY]Range keywords on cgImage) and then put
>
> the scatter plot on using the /OVERPLOT keyword.
>
>
>
>> My variable data ranges from 0 to 1200.So, my colorbar is also
>
>> required to have 1201 divisions.
>
>
>
> That's not going to happen. :-)
>
>
>
> Colorbars generally have 256 colors, tops. Your eye wouldn't be able to
>
> distinguish any more colors than this, probably, unless you were
>
> planning to use one of the monitors on Times Square to display the color
>
> bar.
>
>
>
> 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: How to make scatter plot with colorbar in IDL? [message #85430 is a reply to message #85429] |
Fri, 02 August 2013 09:33  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Madhavan Bomidi writes:
> I was expecting a response from you. Thanks for writing. I am not so dump in IDL and not required so quickly to purchase a consulting contract. I know that my objective is something difficult but all I require here is to get your or others suggestions in realizing my task. I enjoy learning things and not that I just agree for purchasing something in a hurry to finish my task.
No, I understand. Everyone thinks my advice is terrific until I ask them
to pay something for it, then it's not worth squat. Story of my
professional life. :-)
Time for a vacation. Cynicism abounds. I'll probably regain some
perspective if I can just get though a couple of rounds of the
tournament. But, these days, even my wife gives me trouble. :-(
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.")
|
|
|