## [Plplot-general] making vector plots

 [Plplot-general] making vector plots From: - 2005-04-15 02:59:42 ```Hello, I'd like to make a vector plot where the origins of the vectors are not on a grid. I was able to do this by drawing lines and points on a graph, but I imagine there is a better way. I'm starting with a set of x and y positions that specify each vector's origin and a set of dx & dy values that specify its magnitude and direction. Thanks, -Hazen ```

 [Plplot-general] making vector plots From: - 2005-04-15 02:59:42 ```Hello, I'd like to make a vector plot where the origins of the vectors are not on a grid. I was able to do this by drawing lines and points on a graph, but I imagine there is a better way. I'm starting with a set of x and y positions that specify each vector's origin and a set of dx & dy values that specify its magnitude and direction. Thanks, -Hazen ```
 Re: [Plplot-general] making vector plots From: Arjen Markus - 2005-04-15 06:44:03 ```hbabcockos1@... wrote: > > Hello, > > I'd like to make a vector plot where the origins of the vectors are not on a grid. I was able to do this by drawing lines and points on a graph, but I imagine there is a better way. I'm starting with a set of x and y positions that specify each vector's origin and a set of dx & dy values that specify its magnitude and direction. > > Thanks, > -Hazen > The plarrows() function does not expect anything but an array of x, y coordinates and the u, v components of the vector. Use that instead of plvect(). Alternatively: define a pseudo grid with dimensions Nx1 Regards, Arjen ```
 Re: [Plplot-general] making vector plots From: Andrew Ross - 2005-04-15 07:19:30 ```On Fri, Apr 15, 2005 at 08:43:52AM +0200, Arjen Markus wrote: > hbabcockos1@... wrote: > > > > Hello, > > > > I'd like to make a vector plot where the origins of the vectors are not on a grid. I was able to do this by drawing lines and points on a graph, but I imagine there is a better way. I'm starting with a set of x and y positions that specify each vector's origin and a set of dx & dy values that specify its magnitude and direction. > > > > Thanks, > > -Hazen > > > > The plarrows() function does not expect anything but an array of x, y > coordinates > and the u, v components of the vector. Use that instead of plvect(). > > Alternatively: define a pseudo grid with dimensions Nx1 I'd go with the second option. You get more flexibility in controlling the vectors that way. plarrows is depreciated and will probably be removed at some stage. Also I believe it is not supported in all bindings. Be aware that the autoscaling of vectors will not work well in this case though. This probably wants looking at when I get chance. Andrew ```
 Re: [Plplot-general] making vector plots From: Arjen Markus - 2005-04-15 07:26:22 ```Andrew Ross wrote: > > > > > The plarrows() function does not expect anything but an array of x, y > > coordinates > > and the u, v components of the vector. Use that instead of plvect(). > > > > Alternatively: define a pseudo grid with dimensions Nx1 > > I'd go with the second option. You get more flexibility in controlling > the vectors that way. plarrows is depreciated and will probably be > removed at some stage. Also I believe it is not supported in all > bindings. Be aware that the autoscaling of vectors will not work well > in this case though. This probably wants looking at when I get chance. > You base the autoscaling on the distance between neighbouring cells? What about estimating the average cell size (just the extent of the grid divided by the number of cells). That ought to cover the case of a pseudo-grid too. Regards, Arjen ```
 Re: [Plplot-general] making vector plots From: Andrew Ross - 2005-04-15 11:48:29 ```On Fri, Apr 15, 2005 at 09:26:15AM +0200, Arjen Markus wrote: > Andrew Ross wrote: > > > > > > > > > The plarrows() function does not expect anything but an array of x, y > > > coordinates > > > and the u, v components of the vector. Use that instead of plvect(). > > > > > > Alternatively: define a pseudo grid with dimensions Nx1 > > > > I'd go with the second option. You get more flexibility in controlling > > the vectors that way. plarrows is depreciated and will probably be > > removed at some stage. Also I believe it is not supported in all > > bindings. Be aware that the autoscaling of vectors will not work well > > in this case though. This probably wants looking at when I get chance. > > > > You base the autoscaling on the distance between neighbouring cells? > What about estimating the average cell size (just the extent of the > grid divided by the number of cells). That ought to cover the case of > a pseudo-grid too. There is no guarantee about the positioning or ordering of the vectors. They could be randomly placed. In fact I have had need to do this myself. In this case it is not trivial to decide the appropriate spacing while keeping the algorithm efficient for the normal large grid of regularly spaced vectors. I'm sure I can do better than the current approach though. Andrew ```
 Re: [Plplot-general] making vector plots From: Arjen Markus - 2005-04-18 06:41:15 ```Andrew Ross wrote: > > > There is no guarantee about the positioning or ordering of the vectors. > They could be randomly placed. In fact I have had need to do this > myself. In this case it is not trivial to decide the appropriate spacing > while keeping the algorithm efficient for the normal large grid of > regularly spaced vectors. I'm sure I can do better than the current > approach though. > I propose a very simple algorithm: - Determine a bounding box for the grid points/data points - Divide its area by the total number of points - this gives a raw indication of the average grid cell - Take the square root to get a typical size This ought to be efficient and effective for most situations, except where you have very small clusters. Regards, Arjen ```