# ListVectorPlot crashes kernel after two evaluations

I am currently trying to produce many plots by using ListVectorPlot, but every time I re-evaluate my code, the kernel crashes. I have set \$HistoryLength=0 and ClearGlobal[] without any result. Even if I reduce the size of the matrix I'm using (say 28 elements), it still crashes. If I quit the kernel before each evaluation it works, but I have many plots to make, so doing this is a pain. I am using the option VectorPoint->All, I don't know if it has to do with anything.

• Please provide a minimal example of code that creates this problem. Also, what version of Mathematica are you using? – bbgodfrey Nov 6 '15 at 4:53
• It's been confirmed as a bug in the answer you got, but next time, please do not add the bugs tag until other people have verified your observation. – J. M. will be back soon Nov 6 '15 at 5:28

I saw this problem recently on the Wolfram Community website and answered it there. I'll copy my answer here (http://community.wolfram.com/groups/-/m/t/603973)

I'm not sure if there's a simple way to prevent the issue. I would do this by basically reconstructing the ListVectorPlot Function from VectorPlot. To make it easy, I'll just make an Interpolation of the x and y values for the vectors separately:

(* Here's some example data *)
data = {WeatherData[#, "Coordinates"],
First[
WeatherData[#,
"WindSpeed"]]*{-Sin[WeatherData[#, "WindDirection"]], -Cos[
WeatherData[#, "WindDirection"]]}} & /@ {"KSPI", "KORD",
"KMDW", "KCMI", "KBMI"};

(* Munging the data into a form acceptable by Interpolation *)
xvals = ReplaceAll[data, {position_, {xval_, yval_}} :> {position, xval}];
yvals = ReplaceAll[ data, {position_, {xval_, yval_}} :> {position, yval}];

(* Create Interpolations of the data *)
xfunc = Interpolation[xvals, InterpolationOrder -> 1];
yfunc = Interpolation[yvals, InterpolationOrder -> 1];

(* These interpolations can be used with VectorPlot *)
VectorPlot[{xfunc[x, y], yfunc[x, y]}, {x, 39, 42}, {y, -89, -87}]


You have to specify the range over which you want VectorPlot to plot. In this case, the range is a bit out of the bounds of the Interpolation, so there are some error messages. We can also get the actual Min/Max values in the dataset and use these.

{xmin, xmax} = MinMax@data[[All, 1, 1]];
{ymin, ymax} = MinMax@data[[All, 1, 2]];

VectorPlot[{xfunc[x, y], yfunc[x, y]}, {x, xmin, xmax}, {y, ymin, ymax}]