On 03/01/12 13:57, Andy Canion wrote:
I would like to recreate a plot I made in matlab in the past.  It is essentially
a time series of wind vectors with the vector origins all at the same Y value
and the X origin value corresponding to the date/time.  The vectors are drawn
with the u (East/West) and v (North/South) velocity components.  Does anyone
have any suggestions on how to do this.  I don't think it would be hard if I
could convert the dates to a date number, but I could not find what type of date
numbers are used when I looked in the documentation.  Your help will be much
appreciated!

Hmm... maybe the line widget would be the best to use - it's under the shape menu. There's a special 2D vector field widget, but not a 1D one.

You would need have an X dataset (your date), use a Y dataset of the same value (unfortunately you can't specify a constant, but you can create this with data create and an expression like x*0+myconst). You'd need to compute a length dataset using data create (use expression sqrt(u**2+v**2) ), and an angle dataset (expression would be something like arctan2(u, v)*180/pi, though u and v might be round the wrong way...)

Veusz can read dates from CSV fairly easily - see the format option in data import. The default is ISO YYYY-MM-DD. Natively they're stored as seconds relative to 00:00:00 1st January, 2009, so you could compute this yourself. You'd want to set the date-time mode option for the x axis to show dates on the x axis.

The main problem with the line widget is that the lines aren't clipped to the bounds of the plot and that the axes don't autorange to the lines, unlike the other plotting widgets. This is because it was intended for adding labels to plots, rather than plotting data. It would be helpful to add this functionality.

An alternative way is to use the standard data plotting XY widget, but put nan values into the data to make a series of lines, e.g.

0 0
0.5 0.5
nan nan
1 1
1.2 1.6
nan nan

You'd have to compute the points to do this. There's a Join Element By Element data plugin which would help construct the required datasets.

It might be interesting to write a dataset plugin to compute the required datasets automatically from your input data.

Jeremy

_______________________________________________
Veusz-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/veusz-discuss

Répondre à