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

Home » Public Forums » archive » plot
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
plot [message #7831] Fri, 10 January 1997 00:00 Go to next message
collier is currently offline  collier
Messages: 2
Registered: January 1997
Junior Member
Hi there,

IDL is new to me. Recently I tried to generate a filled contour plot
with labels on southern hemisphere by using map_set and contour
(I am using Idl v4.0.1 on a sgi workstation) such as the following. By
default without c_colors, Idl will fill the areas with less grid values by
darker grey colors, with larger values lighter. But idl doesn't fill
all the hemisphere leaving many parts of area white. This is confusing
and misleading, since white filling (actually some of them not filled at all)
means large grid values. I also tried by specifying c_colors to all
contours (see below) but to no avail. For the same data, by using
NCAR graphics one can produce a very good smoothly, continusly shaded,
labeled contours on the hemisphere.

Can anybody tell me how to do this by Idl? (I like using Idl, because
it has good mathematical and statistical functions).

If I change /fill into /cell_fill in the fillowing code as suggested by
the User's Guide P19-14, there will be no filling at all, why?

The max. Nlevels is 29. is there a way of increasing this?


; use Polar Stereographic Projection
!P.FONT=0
map_set, -90,0,0, /stereo,limit=[-90,-180,0,180],title=tit
; contour, dats,los,las,nlevels=25,c_charsize=1.0,/overplot,/fill
contour, dats,los,las,nlevels=25,c_charsize=1.0,/overplot,/fill, $
c_colors=[7*255,240,210,180,150,120,90,12*60]
contour, dats,los,las,nlevels=25,c_charsize=1.0,/follow,/overplot
map_continents, mlinethick=2
map_grid, latdel=30,londel=30,glinethick=2,lonlab=0


I will be very grateful if someone can help me on these questions.
Thanks in advance.

Mozheng Wei
--------------------------------------------------
CSIRO Division of Atmospheric Research
PMB 1, Aspendale
Victoria 3195, Australia

Voice: +61-3-9239-4415; Fax: +61-3-9239-4444
E-mail: mzw@dar.csiro.au
--------------------------------------------------
Re: plot [message #37061 is a reply to message #7831] Thu, 20 November 2003 05:52 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Steve writes:

> I have a simple question. I have a plot, and I would like that x label
> would not write all number (e.x. 33,34,35,36,37,...) in order to not
> overwhelm too much my plot. Is there any command to set the interval
> of number written (e.x. 33,35,37, ...) without changing the range of
> my plot?

How about this function:

FUNCTION EveryOther, axis, index, value
IF (index MOD 2) EQ 0 THEN $
RETURN, "" ELSE $
RETURN, String(value, Format='(I2)')
END

Then,

data = Findgen(11)
Plot, data, XTicks=10 ; Too many numbers!
Plot, data, XTicks=10, XTickformat='EveryOther'

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: plot [message #68486 is a reply to message #7831] Sat, 31 October 2009 07:39 Go to previous messageGo to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Oct 30, 8:05 am, bing999 <thibaultga...@gmail.com> wrote:
> Hi,
>
> i am trying to do a simple thing at first sight but I don't manage to
> do it...
>
> I have a scatter plot at 2D and i would like to roughly plot the
> contour of all my data points.
>
> Its seems that the CONTOUR routine is not meant to deal with this, is
> it?
>
> What else can i try?
>
> Thanks!

Try doing hist_2d first and feed the result into contour.

-Jeremy.
Re: plot [message #68489 is a reply to message #7831] Fri, 30 October 2009 13:57 Go to previous messageGo to next message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
On Oct 30, 4:47 pm, David Fanning <n...@dfanning.com> wrote:
> Paolo writes:
>> Oh yes - you are right - so what is it exactly
>> that the OP is looking for? A definition of the
>> problem might help here instead of funny looking
>> plots...
>
> The OP is looking for a unique set of lines that
> connect "important points" in the scatterplot. As
> far as I can tell, such points can only be determined
> by inspection, but who knows. ;-)

Ah - that explains why I was confused - I may go as far
as to say that random sampling of the important points
comes to mind as a viable strategy too, and it has the
additional advantage of providing each plot with a
unique look :)

Ciao,
Paolo


>
> 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.")
Re: plot [message #68490 is a reply to message #7831] Fri, 30 October 2009 13:47 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paolo writes:

> Oh yes - you are right - so what is it exactly
> that the OP is looking for? A definition of the
> problem might help here instead of funny looking
> plots...

The OP is looking for a unique set of lines that
connect "important points" in the scatterplot. As
far as I can tell, such points can only be determined
by inspection, but who knows. ;-)

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.")
Re: plot [message #68492 is a reply to message #7831] Fri, 30 October 2009 12:58 Go to previous messageGo to next message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
On Oct 30, 3:39 pm, David Fanning <n...@dfanning.com> wrote:
> Paolo writes:
>> Compute the Delauney triangulation
>> of your points (IDL function triangulate)
>> and plot the boundary.
>
>> triangulate,x,y,tri,boundary
>
> Well, we seem to be lost. That is the same
> convex hull we saw before and rejected. Didn't
> anyone bring the GPS!? :-(

Oh yes - you are right - so what is it exactly
that the OP is looking for? A definition of the
problem might help here instead of funny looking
plots...

Ciao,
Paolo

>
> 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.")
Re: plot [message #68494 is a reply to message #7831] Fri, 30 October 2009 12:39 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paolo writes:

> Compute the Delauney triangulation
> of your points (IDL function triangulate)
> and plot the boundary.
>
> triangulate,x,y,tri,boundary

Well, we seem to be lost. That is the same
convex hull we saw before and rejected. Didn't
anyone bring the GPS!? :-(

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.")
Re: plot [message #68495 is a reply to message #7831] Fri, 30 October 2009 12:32 Go to previous messageGo to next message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
On Oct 30, 12:23 pm, bing999 <thibaultga...@gmail.com> wrote:
> No, i don't want the contour to be based on the weight of the points,
> neither set the important points by myself ( i want to do it
> automatically for several plots...)
>
> Going back to the sketch :) :
>
>                               P
>                             PaP
>                            PaaP
>                           PaaaP
>                         PaaaaaP
> PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
>
> I just want the contour to connect all the points on the very left,
> right, top and bottom, that is to say, all the P points = the
> surrounding points actually.
>
> Cheers

Compute the Delauney triangulation
of your points (IDL function triangulate)
and plot the boundary.

triangulate,x,y,tri,boundary

Ciao,
Paolo
Re: plot [message #68496 is a reply to message #7831] Fri, 30 October 2009 11:53 Go to previous messageGo to next message
R.G.Stockwell is currently offline  R.G.Stockwell
Messages: 163
Registered: October 2004
Senior Member
"David Fanning" <news@dfanning.com> wrote in message
news:MPG.2554c354dc93878b98a7a8@news.giganews.com...
> bing999 writes:
>
>> No, i don't want the contour to be based on the weight of the points,
>> neither set the important points by myself ( i want to do it
>> automatically for several plots...)
>>
>> Going back to the sketch :) :
>>
>> P
>> PaP
>> PaaP
>> PaaaP
>> PaaaaaP
>> PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
>>
>> I just want the contour to connect all the points on the very left,
>> right, top and bottom, that is to say, all the P points = the
>> surrounding points actually.


how about:

a = fltarr(10,10)

a[5,5] = 1
a[4:6,4] = 1
a[3:7,3] = 1
a[2:8,2] = 1

contour,a,nlevels=1

end


cheers,
bob
Re: plot [message #68499 is a reply to message #7831] Fri, 30 October 2009 09:50 Go to previous messageGo to next message
Thibault Garel is currently offline  Thibault Garel
Messages: 55
Registered: October 2009
Member
indeed, i will need luck :)
thank you for the good hints you gave!
Re: plot [message #68500 is a reply to message #7831] Fri, 30 October 2009 09:33 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
bing999 writes:

> No, i don't want the contour to be based on the weight of the points,
> neither set the important points by myself ( i want to do it
> automatically for several plots...)
>
> Going back to the sketch :) :
>
> P
> PaP
> PaaP
> PaaaP
> PaaaaaP
> PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
>
> I just want the contour to connect all the points on the very left,
> right, top and bottom, that is to say, all the P points = the
> surrounding points actually.

I know what you want. I'm just saying "Good luck
with that!" :-)

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.")
Re: plot [message #68501 is a reply to message #7831] Fri, 30 October 2009 09:23 Go to previous messageGo to next message
Thibault Garel is currently offline  Thibault Garel
Messages: 55
Registered: October 2009
Member
No, i don't want the contour to be based on the weight of the points,
neither set the important points by myself ( i want to do it
automatically for several plots...)

Going back to the sketch :) :

P
PaP
PaaP
PaaaP
PaaaaaP
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP

I just want the contour to connect all the points on the very left,
right, top and bottom, that is to say, all the P points = the
surrounding points actually.

Cheers
Re: plot [message #68503 is a reply to message #7831] Fri, 30 October 2009 08:01 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
bing999 writes:

> Yes, thank you, thats it.
> Nevertheless, it is not accurate enough for what i want... The lines
> it draws connect "extreme" points and then do not pass by all
> "important" points.
> Clearly, the problem is as follows:
>
> T
> a
> aa
> aaa
> Zaaaaa
> Paaaaaaaaaaaaaaaaaaaaaaaaaaaaa
>
> with convex_hull.pro, a line connects directly the data points T to P
> whereas i would like to connect T to Z and then Z to P.
>
> Can it be done by modifying convex_hull.pro?

No, you will probably have to write the ImportantPointLocater
code yourself. Then just connect them with PLOTS. :-)

Although, after my shower, it occurs to me that what
you want *may* be an active contour in which you start
from the convex hull and "shrink" the contour based on
the weights of the points inside the convex hull.

http://www.dfanning.com/ip_tips/snakes.html

That would be quite a bit harder to write than an connect-the-dots
one-off for doing this interactively.

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.")
Re: plot [message #68505 is a reply to message #7831] Fri, 30 October 2009 07:25 Go to previous messageGo to next message
Thibault Garel is currently offline  Thibault Garel
Messages: 55
Registered: October 2009
Member
Yes, thank you, thats it.
Nevertheless, it is not accurate enough for what i want... The lines
it draws connect "extreme" points and then do not pass by all
"important" points.
Clearly, the problem is as follows:

T
a
aa
aaa
Zaaaaa
Paaaaaaaaaaaaaaaaaaaaaaaaaaaaa

with convex_hull.pro, a line connects directly the data points T to P
whereas i would like to connect T to Z and then Z to P.

Can it be done by modifying convex_hull.pro?

cheers
Re: plot [message #68506 is a reply to message #7831] Fri, 30 October 2009 06:06 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
bing999 writes:

> "I have a scatter plot at 2D and i would like to roughly plot the
> contour of all my data points. "

Yes, I don't know what this means. Does it mean you
want to draw a line that surround all your data points?
If so, what you want is the "convex hull" of your points.
Here is how you find it:

http://www.dfanning.com/tips/convex_hull.html

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.")
Re: plot [message #68507 is a reply to message #7831] Fri, 30 October 2009 05:55 Go to previous messageGo to next message
Thibault Garel is currently offline  Thibault Garel
Messages: 55
Registered: October 2009
Member
> Hard to know what you DID try? Did you try setting
> the IRREGULAR keyword?

Yes, I did. But what I meant is what can i use except CONTOUR
procedure as It does not seem to be meant for what I want to do:

"I have a scatter plot at 2D and i would like to roughly plot the
contour of all my data points. "

which is something more basic, I guess, than what CONTOUR does.
cheers
Re: plot [message #68510 is a reply to message #7831] Fri, 30 October 2009 05:11 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
bing999 writes:

> i am trying to do a simple thing at first sight but I don't manage to
> do it...
>
> I have a scatter plot at 2D and i would like to roughly plot the
> contour of all my data points.
>
> Its seems that the CONTOUR routine is not meant to deal with this, is
> it?
>
> What else can i try?

Hard to know what you DID try? Did you try setting
the IRREGULAR keyword?

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.")
Re: plot [message #68551 is a reply to message #7831] Tue, 03 November 2009 06:41 Go to previous messageGo to next message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
On Nov 2, 6:25 pm, chris <rog...@googlemail.com> wrote:
> On 30 Okt., 17:23, bing999 <thibaultga...@gmail.com> wrote:
>
>
>
>> No, i don't want the contour to be based on the weight of the points,
>> neither set the important points by myself ( i want to do it
>> automatically for several plots...)
>
>> Going back to the sketch :) :
>
>>                               P
>>                             PaP
>>                            PaaP
>>                           PaaaP
>>                         PaaaaaP
>> PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
>
>> I just want the contour to connect all the points on the very left,
>> right, top and bottom, that is to say, all the P points = the
>> surrounding points actually.
>
>> Cheers
>
> Hi,
> I think, you should apply some kind of linescan of rounded coordinates
> of your scatter gram, so you would determine the first "fit" and the
> last "fit" within a scanned line (column or row) with your rounded
> data points, determine for each fit within the line its nearest
> neighbour and store them. Then, you scan the next line and so on.
> After this you can connect your stored points by computing lines
> between the points, round the coordinates of the lines, sort the
> unique entries and store them and so on... Maybe it's a typical
> clipping problem which can be combined with some nearest neighbor
> approaches...
>
> Only my 2 cents
>
> Regards
>
> CR

OK - but is there a unique solution at all?

For instance, if you have these 5 points marked as X

X---X
--X--
X---X

What would be the desired polygon?

We already excluded the rectangular
convex hull.

Then what? We cut out one triangle to the center?

|\/|
|__|

Which one of the possible 4 then?


Or two triangles?

|\/|
|/\|



Or 3? Or 4?

I still think that the problem as stated
is ill-posed.

Ciao,
Paolo
Re: plot [message #68563 is a reply to message #68501] Mon, 02 November 2009 15:25 Go to previous messageGo to next message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 30 Okt., 17:23, bing999 <thibaultga...@gmail.com> wrote:
> No, i don't want the contour to be based on the weight of the points,
> neither set the important points by myself ( i want to do it
> automatically for several plots...)
>
> Going back to the sketch :) :
>
>                               P
>                             PaP
>                            PaaP
>                           PaaaP
>                         PaaaaaP
> PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
>
> I just want the contour to connect all the points on the very left,
> right, top and bottom, that is to say, all the P points = the
> surrounding points actually.
>
> Cheers

Hi,
I think, you should apply some kind of linescan of rounded coordinates
of your scatter gram, so you would determine the first "fit" and the
last "fit" within a scanned line (column or row) with your rounded
data points, determine for each fit within the line its nearest
neighbour and store them. Then, you scan the next line and so on.
After this you can connect your stored points by computing lines
between the points, round the coordinates of the lines, sort the
unique entries and store them and so on... Maybe it's a typical
clipping problem which can be combined with some nearest neighbor
approaches...

Only my 2 cents

Regards

CR
Re: plot [message #68668 is a reply to message #68551] Thu, 05 November 2009 03:35 Go to previous messageGo to next message
greg.addr is currently offline  greg.addr
Messages: 160
Registered: May 2007
Senior Member
> I still think that the problem as stated
> is ill-posed.

I agree. If you take away the convex condition (as the OP seems to
ask), then whatever the set of points you can keep reducing the
surrounding area until you get to zero. You'll get some kind of
spidery thing, but it's probably not what he had in mind.

Greg
Re: plot [message #68817 is a reply to message #7831] Tue, 01 December 2009 05:08 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
chris writes:
.
> p.s.: My personal favourite is Davids selectimage - it's superb and
> I'm hoping that he will extend this routine to open ENVI files (also
> spectra)....

Humm, odd you should say this. I actually have
a need to read and browse ENVI spectral library files
(outside of ENVI) this week. Stay tuned...

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.")
Re: plot [message #68872 is a reply to message #68668] Mon, 30 November 2009 23:56 Go to previous messageGo to next message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 5 Nov., 12:35, greg <greg.a...@googlemail.com> wrote:
>> I still think that the problem as stated
>> is ill-posed.
>
> I agree. If you take away the convex condition (as the OP seems to
> ask), then whatever the set of points you can keep reducing the
> surrounding area until you get to zero. You'll get some kind of
> spidery thing, but it's probably not what he had in mind.
>
> Greg

Dear Bing,
like many times the routines from David Fanning will help. So the
following approach solved my own "concavity problem". Here it is -
hope it helps:

function get_mult_inds_from_mask,mask,verbose=verbose
;lines must be 255b, background must be 0b)
; denies dfanning's find_boundary

mask= bytscl(mask)
sz = size(mask,/dimensions)
l = label_region(mask)
h = histogram(l)
n = n_elements(h)
rois=replicate(ptr_new(),n-1)
if keyword_set(verbose) then window,/free,xsize=sz[0],ysize=sz[1]
for i=1,n-1 do begin
r=find_boundary(where(l eq i),xsize=sz[0],ysize=sz[1])
rois[i-1] = ptr_new(lonarr(2,n_elements(r)/2)+1)
*(rois[i-1]) = [[r],[r[*,0]]]

if keyword_set(verbose) then plots, r[0,*],r[1,*],color=255/i
endfor
return,rois
end

Regards

CR

p.s.: My personal favourite is Davids selectimage - it's superb and
I'm hoping that he will extend this routine to open ENVI files (also
spectra)....
Re: Plot [message #78559 is a reply to message #7831] Fri, 09 December 2011 12:44 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> The purpose of the Coyote Graphics routines, I guess
> I can't say this enough, is that they don't care a whit
> if you want to use black windows or white windows, or
> indexed color or decomposed color (although they LOVE
> decomposed color!) or the latest IDL or the oldest
> possible IDL, or you work on the display or exclusively
> in PostScript. They work every where and every time
> in every environment. Plus, they are about 100 times
> faster than any of the "new" alternatives.

I guess I'll put these books on sale for Christmas.
I'll advertise them as describing "just another
graphics system!" :-)

Cheers,

David

PS: OK, done. Everything in my store on-sale now!

http://www.idlcoyote.com/store/

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Plot [message #78560 is a reply to message #7831] Fri, 09 December 2011 12:34 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Russell writes:

> And David's thing cgText is, if I may speak for him, just a
> wrapper to xyouts to get all the various keywords set in a more User-
> friendly way.

Well, among other things. :-)

The purpose of the Coyote Graphics routines, I guess
I can't say this enough, is that they don't care a whit
if you want to use black windows or white windows, or
indexed color or decomposed color (although they LOVE
decomposed color!) or the latest IDL or the oldest
possible IDL, or you work on the display or exclusively
in PostScript. They work every where and every time
in every environment. Plus, they are about 100 times
faster than any of the "new" alternatives.

And, they have features that the very latest of the
new graphics routines lack.

So, yes, it is a wrapper to the XYOutS command. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Plot [message #78561 is a reply to message #7831] Fri, 09 December 2011 12:23 Go to previous messageGo to next message
Russell[1] is currently offline  Russell[1]
Messages: 101
Registered: August 2011
Senior Member
Yeah, that test I gave you was with IDL 8.1.

-R

xyouts is a very old (I think it's first generation IDL) way of doing
this. And David's thing cgText is, if I may speak for him, just a
wrapper to xyouts to get all the various keywords set in a more User-
friendly way. I learned IDL in a fairly closed-box environment, so
I'm used to reinventing the wheel ;).



On Dec 9, 2:46 pm, Dave Poreh <d.po...@gmail.com> wrote:
> On Dec 9, 10:28 am, Dave Poreh <d.po...@gmail.com> wrote:
>
>
>
>
>
>> On Dec 9, 8:09 am, Russell <rryan....@gmail.com> wrote:
>
>>> As always, David's got it.  But just in case you're not familiar with
>>> the cg* stuff, then the old-fashioned xyouts will work just as well:
>
>>> x = [0, 35, 70, 140]
>>> y = [0, 196.7, 779.8, 37]
>>> vals=[12006,12507,13008,14010]
>
>>> names=string(vals,f='(I5)')
>
>>> plot,x,y,ps=2
>>> xyouts,x,y,vals
>
>>> -R
>
>>> PS, you can add all sorts of flags to xyouts to control where the text
>>> appears (such as alignment=alignment where 0<alignment<1, and a few
>>> others).  Or you can get really fancy and measure the size of the text
>>> for the plot, and position it with respect to that size...
>
>>> On Dec 9, 10:06 am, Dave Poreh <d.po...@gmail.com> wrote:
>
>>>> Folks
>>>> hi,
>>>> I have a data like this and i want to plot column 1 (x) and column 2
>>>> (y) and column 3 as  the name of the points on plot (like 12006, 12507
>>>> etc.). Could somebody help please?
>
>>>> 0     0        12006
>>>> 35  196.7    12507
>>>> 70  779.8    13008
>>>> 140  37      14010
>>>> .............
>>>> Cheers,
>>>> Dave
>
>> Thanks. both works very good.
>> Cheers,
>> Dave
>
> @ Dear Russell
> Does xyouts work with IDL 8.0 or not?
> Cheers,
> Dave
Re: Plot [message #78563 is a reply to message #7831] Fri, 09 December 2011 11:46 Go to previous messageGo to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Dec 9, 10:28 am, Dave Poreh <d.po...@gmail.com> wrote:
> On Dec 9, 8:09 am, Russell <rryan....@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
>> As always, David's got it.  But just in case you're not familiar with
>> the cg* stuff, then the old-fashioned xyouts will work just as well:
>
>> x = [0, 35, 70, 140]
>> y = [0, 196.7, 779.8, 37]
>> vals=[12006,12507,13008,14010]
>
>> names=string(vals,f='(I5)')
>
>> plot,x,y,ps=2
>> xyouts,x,y,vals
>
>> -R
>
>> PS, you can add all sorts of flags to xyouts to control where the text
>> appears (such as alignment=alignment where 0<alignment<1, and a few
>> others).  Or you can get really fancy and measure the size of the text
>> for the plot, and position it with respect to that size...
>
>> On Dec 9, 10:06 am, Dave Poreh <d.po...@gmail.com> wrote:
>
>>> Folks
>>> hi,
>>> I have a data like this and i want to plot column 1 (x) and column 2
>>> (y) and column 3 as  the name of the points on plot (like 12006, 12507
>>> etc.). Could somebody help please?
>
>>> 0     0        12006
>>> 35  196.7    12507
>>> 70  779.8    13008
>>> 140  37      14010
>>> .............
>>> Cheers,
>>> Dave
>
> Thanks. both works very good.
> Cheers,
> Dave

@ Dear Russell
Does xyouts work with IDL 8.0 or not?
Cheers,
Dave
Re: Plot [message #78566 is a reply to message #7831] Fri, 09 December 2011 10:28 Go to previous messageGo to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Dec 9, 8:09 am, Russell <rryan....@gmail.com> wrote:
> As always, David's got it.  But just in case you're not familiar with
> the cg* stuff, then the old-fashioned xyouts will work just as well:
>
> x = [0, 35, 70, 140]
> y = [0, 196.7, 779.8, 37]
> vals=[12006,12507,13008,14010]
>
> names=string(vals,f='(I5)')
>
> plot,x,y,ps=2
> xyouts,x,y,vals
>
> -R
>
> PS, you can add all sorts of flags to xyouts to control where the text
> appears (such as alignment=alignment where 0<alignment<1, and a few
> others).  Or you can get really fancy and measure the size of the text
> for the plot, and position it with respect to that size...
>
> On Dec 9, 10:06 am, Dave Poreh <d.po...@gmail.com> wrote:
>
>
>
>
>
>
>
>> Folks
>> hi,
>> I have a data like this and i want to plot column 1 (x) and column 2
>> (y) and column 3 as  the name of the points on plot (like 12006, 12507
>> etc.). Could somebody help please?
>
>> 0     0        12006
>> 35  196.7    12507
>> 70  779.8    13008
>> 140  37      14010
>> .............
>> Cheers,
>> Dave

Thanks. both works very good.
Cheers,
Dave
Re: Plot [message #78567 is a reply to message #7831] Fri, 09 December 2011 08:09 Go to previous messageGo to next message
Russell[1] is currently offline  Russell[1]
Messages: 101
Registered: August 2011
Senior Member
As always, David's got it. But just in case you're not familiar with
the cg* stuff, then the old-fashioned xyouts will work just as well:

x = [0, 35, 70, 140]
y = [0, 196.7, 779.8, 37]
vals=[12006,12507,13008,14010]

names=string(vals,f='(I5)')

plot,x,y,ps=2
xyouts,x,y,vals


-R


PS, you can add all sorts of flags to xyouts to control where the text
appears (such as alignment=alignment where 0<alignment<1, and a few
others). Or you can get really fancy and measure the size of the text
for the plot, and position it with respect to that size...









On Dec 9, 10:06 am, Dave Poreh <d.po...@gmail.com> wrote:
> Folks
> hi,
> I have a data like this and i want to plot column 1 (x) and column 2
> (y) and column 3 as  the name of the points on plot (like 12006, 12507
> etc.). Could somebody help please?
>
> 0     0        12006
> 35  196.7    12507
> 70  779.8    13008
> 140  37      14010
> .............
> Cheers,
> Dave
Re: Plot [message #78569 is a reply to message #7831] Fri, 09 December 2011 07:38 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Dave Poreh writes:

> I have a data like this and i want to plot column 1 (x) and column 2
> (y) and column 3 as the name of the points on plot (like 12006, 12507
> etc.). Could somebody help please?
>
> 0 0 12006
> 35 196.7 12507
> 70 779.8 13008
> 140 37 14010

x = [0, 35, 70, 140]
y = [0, 196.7, 779.8, 37]
names = StrTrim([12006,12507,13008,14010],2)
cgplot, x, y, PSym=2, color='red', SymSize=2, $
xrange=[-50, 200], yrange=[-200,1000]
n = Convert_Coord(x, y, /Data, /To_Normal)
xn = n[0,*]
yn = n[1,*]
for j=0,N_Elements(xn)-1 do begin
cgText, xn[j], yn[j]+0.025, names[j], align=0.5, $
/Normal, color='royal blue'
endfor
END

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Plot [message #78725 is a reply to message #7831] Tue, 13 December 2011 10:20 Go to previous messageGo to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Dec 13, 8:18 am, Mark Piper <mpi...@ittvis.com> wrote:
> On 12/10/2011 7:04 AM, Poreh wrote:
>
>> Mark, when i am running it gives me this error:
>> ps = symbol(x, y, sym_text=s, /data)
>> but still i have the plot.
>> Cheers,
>> Dave
>>                             ^
>> % Syntax error.
>
> Yes -- I'm sorry, this was my mistake; I was using the 8.2 tech preview
> (wherein SYMBOL is vectorized). In 8.1, use TEXT:
>
> x = [0, 35, 70, 140]
> y = [0, 196.7, 779.8, 37]
> s = string([12006, 12507, 13008, 14010])
>
> ; NG (IDL 8.1)
> p = plot(x, y)
> t = text(x, y, s, alignment='center', /data)
>
> mp

Thanks. how could we use points (beautiful one) instead of line here?
Cheers,
Dave
Re: Plot [message #78728 is a reply to message #7831] Tue, 13 December 2011 08:18 Go to previous messageGo to next message
Mark Piper is currently offline  Mark Piper
Messages: 198
Registered: December 2009
Senior Member
On 12/10/2011 7:04 AM, Poreh wrote:

> Mark, when i am running it gives me this error:
> ps = symbol(x, y, sym_text=s, /data)
> but still i have the plot.
> Cheers,
> Dave
> ^
> % Syntax error.

Yes -- I'm sorry, this was my mistake; I was using the 8.2 tech preview
(wherein SYMBOL is vectorized). In 8.1, use TEXT:

x = [0, 35, 70, 140]
y = [0, 196.7, 779.8, 37]
s = string([12006, 12507, 13008, 14010])

; NG (IDL 8.1)
p = plot(x, y)
t = text(x, y, s, alignment='center', /data)

mp
Re: Plot [message #78748 is a reply to message #7831] Sat, 10 December 2011 06:09 Go to previous messageGo to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Dec 9, 4:11 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
> On 12/9/11 3:06 PM, Dave Poreh wrote:
>
>> Folks
>> hi,
>> I have a data like this and i want to plot column 1 (x) and column 2
>> (y) and column 3 as  the name of the points on plot (like 12006, 12507
>> etc.). Could somebody help please?
>
>> 0     0        12006
>> 35  196.7    12507
>> 70  779.8    13008
>> 140  37      14010
>> .............
>> Cheers,
>> Dave
>
> Try using XYOUTS.
>
> -Jeremy.
>
> .

Mark, when i am running it gives me this error:
ps = symbol(x, y, sym_text=s, /data)
^
% Syntax error.

but still i have the plot.
Cheers,
Dave
Re: Plot [message #78749 is a reply to message #7831] Sat, 10 December 2011 06:39 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Poreh writes:

>
> On Dec 9, 4:11 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
>> On 12/9/11 3:06 PM, Dave Poreh wrote:
>>
>>> Folks
>>> hi,
>>> I have a data like this and i want to plot column 1 (x) and column 2
>>> (y) and column 3 as  the name of the points on plot (like 12006, 12507
>>> etc.). Could somebody help please?
>>
>>> 0     0        12006
>>> 35  196.7    12507
>>> 70  779.8    13008
>>> 140  37      14010
>>> .............
>>> Cheers,
>>> Dave
>>
>> Try using XYOUTS.
>>
>> -Jeremy.
>>
>> .
> Mark, when i am running it gives me this error:
> ps = symbol(x, y, sym_text=s, /data)
> but still i have the plot.
> Cheers,
> Dave
> ^
> % Syntax error.

Here's what I get, but honestly, it's what I have
come to expect from function graphics. :-)

IDL> x = [0, 35, 70, 140]
IDL> y = [0, 196.7, 779.8, 37]
IDL> s = string([12006, 12507, 13008, 14010])
IDL>
IDL> ; NG (IDL 8.1)
IDL> p = plot(x, y)
IDL> ps = symbol(x, y, sym_text=s, /data)
% Loaded DLM: XML.
% SYMBOL: Incorrect number of arguments.
% Execution halted at: $MAIN$

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Plot [message #78795 is a reply to message #78725] Mon, 19 December 2011 05:10 Go to previous messageGo to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Dec 13, 7:20 pm, DavePoreh <d.po...@gmail.com> wrote:
> On Dec 13, 8:18 am, Mark Piper <mpi...@ittvis.com> wrote:
>
>
>
>
>
>
>
>
>
>> On 12/10/2011 7:04 AM, Poreh wrote:
>
>>> Mark, when i am running it gives me this error:
>>> ps = symbol(x, y, sym_text=s, /data)
>>> but still i have the plot.
>>> Cheers,
>>> Dave
>>>                             ^
>>> % Syntax error.
>
>> Yes -- I'm sorry, this was my mistake; I was using the 8.2 tech preview
>> (wherein SYMBOL is vectorized). In 8.1, use TEXT:
>
>> x = [0, 35, 70, 140]
>> y = [0, 196.7, 779.8, 37]
>> s = string([12006, 12507, 13008, 14010])
>
>> ; NG (IDL 8.1)
>> p = plot(x, y)
>> t = text(x, y, s, alignment='center', /data)
>
>> mp
>
> Thanks. how could we use points (beautiful one) instead of line here?
> Cheers,
> Dave
Re: plot [message #80938 is a reply to message #7831] Sat, 21 July 2012 12:59 Go to previous messageGo to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Saturday, July 21, 2012 11:10:23 AM UTC-7, David Fanning wrote:
> dave poreh writes:
>
> &gt; I did something like this, but still not working!!!
> &gt;
> &gt; pro read_several_png
> &gt; cd,&#39;D:\p\&#39;
> &gt; pathName=&quot;D:\p\&quot;
> &gt; List = findfile(pathName+&quot;*.png&quot;)
> &gt; nosFiles=N_ELEMENTS(List)
> &gt; data = ptrarr(nosFiles)
> &gt; outfile = STRARR(nosFiles)
> &gt;
> &gt; for i = 0, nosFiles - 1 do begin
> &gt; x=read_png(list[i],rpal,gpal,bpal)
> &gt; rootname = File_Basename(list[i], &#39;.png&#39;)
> &gt; data[i] = ptr_new(x)
> &gt; endfor
> &gt;
> &gt; ps_start, pagetype=&#39;a4&#39;
> &gt; !p.multi=[0,3,9]
> &gt; for j=0,26 do cgimage, data[j]
> &gt; !p.multi=0
> &gt; ps_end
> &gt; end
>
> I would try dereferencing your pointer. :-)
>
> *data[j]
>
> Also, you may want more or less space between images.
> The MultiMargin keyword to cgImage can be used to
> adjust this to suit you.
>
> Cheers,
>
> David
>
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote&#39;s Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thui. (&quot;Perhaps thou speakest truth.&quot;)

Thanks David, works well:-)
Cheers,
Dave
Re: plot [message #80939 is a reply to message #7831] Sat, 21 July 2012 11:10 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
dave poreh writes:

> I did something like this, but still not working!!!
>
> pro read_several_png
> cd,'D:\p\'
> pathName="D:\p\"
> List = findfile(pathName+"*.png")
> nosFiles=N_ELEMENTS(List)
> data = ptrarr(nosFiles)
> outfile = STRARR(nosFiles)
>
> for i = 0, nosFiles - 1 do begin
> x=read_png(list[i],rpal,gpal,bpal)
> rootname = File_Basename(list[i], '.png')
> data[i] = ptr_new(x)
> endfor
>
> ps_start, pagetype='a4'
> !p.multi=[0,3,9]
> for j=0,26 do cgimage, data[j]
> !p.multi=0
> ps_end
> end

I would try dereferencing your pointer. :-)

*data[j]

Also, you may want more or less space between images.
The MultiMargin keyword to cgImage can be used to
adjust this to suit you.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: plot [message #80940 is a reply to message #7831] Sat, 21 July 2012 11:01 Go to previous messageGo to next message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Saturday, July 21, 2012 6:44:36 AM UTC-7, alx wrote:
> Le samedi 21 juillet 2012 11:04:13 UTC+2, dave poreh a écrit :
> &gt; Folks
> &gt; hi,
> &gt; I need to plot 27 images in an A4 paper,with 9 rows and 3 columns. I have prepered these images in other software, but i need to plot it in IDL.
> &gt; Will you pls give me some tips?
> &gt; Cheers,
> &gt; Dave
>
> for i=0,26 do img = image(images[i], LAYOUT=[9,3,i+1], CURRENT=(i gt 0))
>
> then,
> img.print
> or img.save, &#39;images.ps&#39;
>
> you can furhter control margin, labels, legends, etc... by using keywords, both in &#39;image&#39; and &#39;print&#39; functions. Please read IDL documentation.

hi, David
I did something like this, but still not working!!!

pro read_several_png
cd,'D:\p\'
pathName="D:\p\"
List = findfile(pathName+"*.png")
nosFiles=N_ELEMENTS(List)
data = ptrarr(nosFiles)
outfile = STRARR(nosFiles)

for i = 0, nosFiles - 1 do begin
x=read_png(list[i],rpal,gpal,bpal)
rootname = File_Basename(list[i], '.png')
data[i] = ptr_new(x)
endfor

ps_start, pagetype='a4'
!p.multi=[0,3,9]
for j=0,26 do cgimage, data[j]
!p.multi=0
ps_end
end
Re: plot [message #80941 is a reply to message #7831] Sat, 21 July 2012 06:44 Go to previous messageGo to next message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le samedi 21 juillet 2012 11:04:13 UTC+2, dave poreh a écrit :
> Folks
> hi,
> I need to plot 27 images in an A4 paper,with 9 rows and 3 columns. I have prepered these images in other software, but i need to plot it in IDL.
> Will you pls give me some tips?
> Cheers,
> Dave

for i=0,26 do img = image(images[i], LAYOUT=[9,3,i+1], CURRENT=(i gt 0))

then,
img.print
or img.save, 'images.ps'

you can furhter control margin, labels, legends, etc... by using keywords, both in 'image' and 'print' functions. Please read IDL documentation.
Re: plot [message #80942 is a reply to message #7831] Sat, 21 July 2012 06:14 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
dave poreh writes:

> I need to plot 27 images in an A4 paper,with 9 rows and 3 columns. I have prepered these images in other software, but i need to plot it in IDL.
> Will you pls give me some tips?
>

ps_start, pagetype='a4'
!p.multi=[0,3,9]
for j=0,26 do cgimage, images[j]
!p.multi=0
ps_end

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Plot [message #83222 is a reply to message #7831] Fri, 15 February 2013 05:52 Go to previous message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On Friday, February 15, 2013 2:40:23 PM UTC+1, David Fanning wrote:
> dave poreh writes:
>
>
>
>> I could not plot line x=0 in CGPlot,
>
>> cgPlot, x(0,*),x(1,*),psym=-46, symSize=2
>
>> cgPlot, !X.CRANGE,[0,0],/overplot
>
>>
>
>> this just plots line y=0 for me.
>
>
>
> Maybe you want this. :-)
>
>
>
> cgPlot, [0,0], !Y.CRange, /Overplot
>
>
>
> 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.")

Yes, thanks,
Cheers,
Dave
Re: Plot [message #83223 is a reply to message #7831] Fri, 15 February 2013 05:40 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
dave poreh writes:

> I could not plot line x=0 in CGPlot,
> cgPlot, x(0,*),x(1,*),psym=-46, symSize=2
> cgPlot, !X.CRANGE,[0,0],/overplot
>
> this just plots line y=0 for me.

Maybe you want this. :-)

cgPlot, [0,0], !Y.CRange, /Overplot

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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Plot
Next Topic: call_external

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

Current Time: Wed Oct 08 13:45:41 PDT 2025

Total time taken to generate the page: 0.00636 seconds