I have two vectors (plain lists), say a,b, from which I generated a 2d table, say mat. It's not a direct expression like mat[[i,j]] = a[[i]] + b[[j]], rather some more complicated computation that spans much of my code, but each entry $ij$ is essentially just some function of the corresponding a[[i]] and b[[j]]].

I'd like to plot that, perhaps as a contour plot, but I see that Mathematica expects the data to be given as a matrix where each entry $ij$ is a triplet a1[[i]],a2[[j]],mat[[i,j]].

How do I construct this matrix of triplets in a proper Mathematica "way of thinking"? (i.e. without nested loops etc.) Or alternatively, can I use my current data structure and plot it directly?

  • $\begingroup$ See ListContourPlot, it doesn't make any difference how you generated your mat $\endgroup$ – Bob Hanlon Aug 7 '19 at 14:07


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.