Re: Joining points of ListPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg117325] Re: Joining points of ListPlot
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Tue, 15 Mar 2011 06:04:41 -0500 (EST)
I just checked every e-mail I have on this thread, and this is the first time I see an example. It's an attachment, besides, and attachments don't go to the group. Bobby On Mon, 14 Mar 2011 12:53:46 -0500, Antonio Mezzacapo <ant.mezzacapo at gmail.com> wrote: > I send you again an example of my data, as an attachment text; however I > already sent it in a preceeding email. Please pay attention. > > Note that there are crossing functions, in one array of points, that I > want > to join separetely. > > Thank you for care however, > > Antonio > > 2011/3/14 DrMajorBob <btreat1 at austin.rr.com> > >> A short, simple example is worth a thousand words. You're still not >> making >> yourself clear. >> >> Bobby >> >> >> On Mon, 14 Mar 2011 06:01:17 -0500, Antonio Mezzacapo < >> ant.mezzacapo at gmail.com> wrote: >> >> Thank you for answering. >>> >>> I don't have any functional form of this points. I have only this >>> array of >>> points. Points on this array should be distributed *like* two crossing >>> functions as Sin[x] and Cos[x], but I don't know the functional form of >>> these functions. >>> >>> All that I have is an array of points! >>> Because of the fact that these points distribute on the x-y cartesian >>> plane >>> like two crossing functions, I cannot use "joined->true" because it >>> gives >>> me >>> strange results. >>> >>> Thank you >>> Antonio >>> >>> 2011/3/13 Michael Stern <nycstern at gmail.com> >>> >>> Antonio, >>>> >>>> Some points of your question are unclear, but perhaps this will cover >>>> all >>>> relevant cases. >>>> >>>> 1. If you have functions, the simplest way is: >>>> >>>> Plot[{Sin[x], Cos[x]}, {x, 0, 2*Pi}] >>>> >>>> 2. You refer to "joined points," however, which suggests that you may >>>> be >>>> dealing with lists of points rather than functions. If so, you can do >>>> the >>>> same thing as follows: >>>> >>>> (* creating the two lists *) >>>> s1 = Table[Sin[x], {x, 0, 2*Pi, .1}]; >>>> c1 = Table[Cos[x], {x, 0, 2*Pi, .1}]; >>>> >>>> (* plot *) >>>> ListPlot[{s1, c1}, Joined -> True] >>>> >>>> >>>> 3. You refer to the points not being ordered, from which I take that >>>> one >>>> or >>>> both of the lists of plots has cartesian coordinates, not ordered by >>>> the >>>> independent variable. In this case, you can use Sort or SortBy to put >>>> them >>>> in order. >>>> >>>> (* creating two cartesian lists, neither of which is 'ordered' by the >>>> definition above *) >>>> s2 = RotateLeft[Table[{x, Sin[x]}, {x, 0, 2*Pi, .1}]]; >>>> c2 = RotateRight[Table[{x, Cos[x]}, {x, 0, 2*Pi, .1}]]; >>>> >>>> (* plot by sorted versions of these unordered lists *) >>>> ListPlot[{SortBy[s2, First], SortBy[c2, First]}, Joined -> True] >>>> >>>> >>>> Does that help? >>>> >>>> Michael >>>> >>>> >>>> On Mar 13, 2011, at 6:25 AM, Antonio Mezzacapo wrote: >>>> >>>> > Hi, >>>> > here's my problem: >>>> > >>>> > I have an array of data depicting two crossing functions (let's say >>>> like >>>> > Sin[x] and Cos[x]). How can I arrange them and make a joined points >>>> plot, >>>> > that joins only points belonging to the same function? >>>> > I remember you that the points of the two crossing functions are on >>>> the >>>> same >>>> > array and they are non-ordered. >>>> > >>>> > Thank you >>>> > >>>> > Antonio Mezzacapo >>>> > >>>> >>>> >> >> -- >> DrMajorBob at yahoo.com >> -- DrMajorBob at yahoo.com