# Contour plot a 2d array

I have the calculated data for an interaction potential. My variables are distances (48 values) and angles(15 values) and my energy data is a 2d matrix of 48 x 15 values. How do i plot the energy as a contour? I am not sure how to assign it to a variable or import it as an array(Also it is a huge amount of data). I tried using Table and plotted using ListContourPlot, but i get the error "it is not a valid array". Is there any way to do this?

This is the smaller version of my data:

In:= En = Table[Import["D:\pes\en.txt"]]

Out= "0.00170451   0.00121435  0.00064304
0.00109223  0.0007588   0.00037006
0.00066955  0.00044523  0.00018417
0.00038108  0.00023235  6.00379142E-05"

In:= Dis = List[6.05, 6.2, 6.35, 6.5]

Out= {6.05, 6.2, 6.35, 6.5}

In:= An = List[8.8877, 20.4014, 31.9828]

Out= {8.8877, 20.4014, 31.9828}

In:= ListContourPlot[{Dis, An, En}, InterpolationOrder -> 0.1]

During evaluation of In:= ListContourPlot::arrayerr: {{6.05,6.2,6.35,6.5},{8.8877,20.4014,31.9828},0.00170451  0.00121435  0.00064304
0.00109223  0.0007588   0.00037006
0.00066955  0.00044523  0.00018417
0.00038108  0.00023235  6.00379142E-05} must be a valid array.

Out= ListContourPlot[{{6.05, 6.2, 6.35, 6.5}, {8.8877, 20.4014,
31.9828}, "0.00170451    0.00121435  0.00064304
0.00109223    0.0007588   0.00037006
0.00066955    0.00044523  0.00018417
0.00038108    0.00023235  6.00379142E-05"}, InterpolationOrder -> 0.1]

• We can't know what's wrong without seeing the data. If it involves a lot of data, try to reproduce the problem with a smaller amount of data that you can post here (or so that you can post code that generates the sample data). Oct 23, 2020 at 7:44
• Yes, i have edited my question. Oct 23, 2020 at 9:17
• The first line import the numbers are a string. Try En = Import["D:\pes\en.txt", "Table"] and you should get a matrix instead. Oct 23, 2020 at 10:28

Here is your example3. But it is not clear to which value of "En" which distance and angle to assign. I simply made an assumption. If I am wrong, you may have to swap d2 and d3 in: Flatten[Outer[List, d2, d3], 1].

d1 = ImportString[
"0.00170451   0.00121435  0.00064304 0.00109223  0.0007588   \
0.00037006 0.00066955  0.00044523  0.00018417 0.00038108  0.00023235  \
6.00379142E-05", "Table"][];
d2 = List[6.05, 6.2, 6.35, 6.5];
d3 = List[8.8877, 20.4014, 31.9828];
d4 = Flatten[Outer[List, d2, d3], 1];
ListContourPlot[d5] Thank you so much, I got the proper form of the data to plot. This is the plot i get

ListContourPlot[Pes, ContourLabels -> All, PlotLegends -> Automatic,
ColorFunctionScaling -> False, PlotRange -> {{0, 180}, {6, 11}},
ColorFunction ->
Function[{Enn}, ColorData[{"BlueGreenYellow", {-35, 150}}][Enn]]]


But most of my points don't seem to be distinguished. How do i rescale the color function to graph all the points? 