0
$\begingroup$

I have a set of values of a function of X and Y defined as sample={{x1, y1, f(x1,y1)},{x2, y2, f(x2,y2)}{x3, y3, f(x3,y3)}...} I want to do a list contour plot of the data in this vector as ListContourPlot[sample, PlotLegends -> Automatic]. The output of this is a blank square, however both sides of the square have the dimensions of X and Y and the legend also has the right values of f(X, Y). Can anybody please tell me what is wrong with this code?

Data and code:

sample = {{0., 0., 2.25}, {0.00202264, 0.00404527, 2.26953}, {0.008085, 
  0.01617, 2.32934}, {0.0181705, 0.036341, 2.42506}, {0.0322514, 
  0.0645029, 2.55508}, {0.0502892, 0.100578, 2.7123}, {0.0722345, 
  0.144469, 2.89297}, {0.098027, 0.196054, 3.08826}, {0.127596, 
  0.255192, 3.29345}, {0.160861, 0.321722, 3.49927}, {0.19773, 
  0.39546, 3.70137}, {0.238102, 0.476204, 3.89137}, {0.281867, 
  0.563734, 4.06654}, {0.328905, 0.65781, 4.22049}, {0.379086, 
  0.758173, 4.35298}, {0.432274, 0.864548, 4.4602}, {0.488322, 
  0.976644, 4.54472}, {0.547077, 1.09415, 4.60527}, {0.608378, 
  1.21676, 4.64685}, {0.672056, 1.34411, 4.67003}, {0.737938, 1.47588,
   4.68126}, {0.805842, 1.61168, 4.6817}, {0.875583, 1.75117, 
  4.67777}, {0.946969, 1.89394, 4.66967}, {1.01981, 2.03961, 
  4.66215}, {1.09389, 2.18778, 4.65288}, {1.16902, 2.33805, 
  4.64344}, {1.245, 2.49, 4.62778}, {1.3216, 2.64321, 
  4.6033}, {1.39863, 2.79727, 4.55967}, {1.47588, 2.95175, 
  4.48985}, {1.55312, 3.10623, 4.37954}, {1.63015, 3.26029, 
  4.21782}, {1.70675, 3.41351, 3.98769}, {1.78273, 3.56546, 
  3.67539}, {1.85786, 3.71572, 3.26354}, {1.93195, 3.86389, 
  2.73331}, {2.00478, 4.00956, 2.10516}, {2.07617, 4.15234, 
  1.55239}, {2.14591, 4.29182, 1.13432}, {2.21381, 4.42763, 
  0.815649}, {2.2797, 4.55939, 0.580065}, {2.34337, 4.68675, 
  0.407037}, {2.40467, 4.80935, 0.283192}, {2.46343, 4.92686, 
  0.1958}, {2.51948, 5.03896, 0.135243}, {2.57267, 5.14533, 
  0.0941795}, {2.62285, 5.24569, 0.0662465}, {2.66988, 5.33977, 
  0.0478592}, {2.71365, 5.4273, 0.0350222}, {2.75402, 5.50804, 
  0.02657}, {2.79089, 5.58178, 0.0200009}, {2.82416, 5.64831, 
  0.0155287}, {2.85372, 5.70745, 0.0114623}, {2.87952, 5.75903, 
  0.00866999}, {2.90146, 5.80292, 0.00584001}, {2.9195, 5.839, 
  0.00405121}, {2.93358, 5.86716, 0.00217192}, {2.94367, 5.88733, 
  0.00124447}, {2.94973, 5.89946, 0.000276389}}

ListContourPlot[sample, PlotLegends -> Automatic]
$\endgroup$
  • $\begingroup$ Add {2.94973, 0,0},{0, 5.89946,0} to your data and plot. You will see that your points are located on one line. $\endgroup$ – yarchik Jun 16 at 10:08
  • $\begingroup$ ListSurfacePlot3D[sample, AxesLabel -> {"X", "Y", "Z"}] or Show[ ListSurfacePlot3D[ sample, AxesLabel -> {"X", "Y", "Z"} ], Graphics3D[{PointSize[Large], Red, Point@sample}] ] is also useful for understanding this data. $\endgroup$ – C. E. Jun 16 at 10:09
  • $\begingroup$ ListPlot3D[sample, PlotRange -> All] $\endgroup$ – cvgmt Aug 1 at 1:44

Your Answer

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

Browse other questions tagged or ask your own question.