0
votes

I've got files with cartesian data - a collection of points each coming with 3 coordinates and 3 magnetic field components. I need to visualize this data as 2D plots with magnetic field lines.

How do I do that? What manipulations do I have to do with the original data to be able to plot those vector lines? And what would the gnuplot commands look like?

1

1 Answers

1
votes

The command to plot the entire data set as vectors is simple:

set style arrow 1 head filled linewidth 0.5
splot 'data' using 1:2:3:4:5:6 with vectors arrowstyle 1

This assumes that the vector components are given in the same units as your axis coordinates; otherwise you would have to add a scale factor (e.g. replace 4:5:6 with ($4 * scale):($5*scale):($6*scale) However this will generate a 3D plot that may well be too complicated to interpret visually in 2D projection. You might simplify it by specifying a projection along the z axis and then filtering to select only the points in a particular slice of z values:

set view map    # projection along z
filter(z) = ((zlow < z && z < zhigh) ? z : NaN)
splot 'data' using 1:2:(filter($3)):4:5:6 with vectors arrowstyle 1

More complicated representations that combine the vectors with contours of an associated magnitude are possible. Have a look at the on-line demo vector dem for an example.