I have the following ListPlot3D , where C is specific Heat , T temperature and n concentration, my list first column present n, second T and third column is for C. I have this code to plot 3D graph from file name "data"

data = PadLeft[Import["E:\\new_n\\T(n).dat", "Table"]];
d = ListPlot3D[data, PlotRange -> Full, AxesLabel -> {n, T, C}, 
   PlotStyle -> Green]

List in the link

Is it possible to get 2D graph from 3d listPlot? Could you please help me?

Any suggestions are very appreciated.

  • $\begingroup$ How do you want to get the 2D plot? Along which axis? What view point? Can you just project onto the XY plane? Onto the XZ plane? We'll need more info to help you $\endgroup$
    – b3m2a1
    Commented Feb 24, 2019 at 11:41
  • $\begingroup$ @b3m2a1 i want to plot T(c) plane xy $\endgroup$ Commented Feb 24, 2019 at 11:56
  • $\begingroup$ Sorry I cannot access data from the link, but Show[d,ViewPoint->{0,0,Infinity}] should work! $\endgroup$ Commented Feb 24, 2019 at 15:44

2 Answers 2

data = PadLeft[Import["E:\\new_n\\T(n).dat", "Table"]];
T = data[[All, 2]]; c = data[[All, 3]];
ListPlot[Table[{c[[i]], T[[i]]}, {i, 1, Length[c]}], 
 AxesLabel -> {"c", "T"}, PlotRange -> All]


Find the maximum values c[n,T] for all n:

k = 0; j = 0; nn = {1}; Do[
 Do[If[n[[i + j]] == n[[i + j + 1]], k = k + 1, Break[]], {i, j + 1, 
   Length[n]}]; k1 = If[k > Length[n], Length[n], k]; 
 nn = Flatten[{nn, k1}]; If[k >= Length[n] - 1, Break[]];, {100}]
m = {}; Do[
 m = Flatten[{m, 
     MaximalBy[Table[data[[i]], {i, nn[[j]], nn[[j + 1]]}], Last]}, 
    1];, {j, 1, Length[nn] - 1}]

Using m we find T[n]

ListPlot[Table[{m[[i, 1]], m[[i, 2]]}, {i, 1, Length[m]}], 
 PlotRange -> All, AxesLabel -> {"n", "T"}]


  • $\begingroup$ Sir @Alex Trounev is there anyway to build it T(n) by selecting maximum value of c every n concentration automatically , if there any suggest are very appreciated , like in this file in like [Link]( drive.google.com/open?id=1sOiO9zR-OL5X5OJ1XdUErfo-Gu5g52vL) $\endgroup$ Commented Feb 24, 2019 at 16:27
  • $\begingroup$ In your file data T[n] with two maximum, I showed how to find one. $\endgroup$ Commented Feb 25, 2019 at 0:10

You may use ListContourPlot. Also, you may want to have a look at the ColorFunction option of these functions.

With data as in OP. Then

 PlotRange -> Full,
 FrameLabel -> {n, T},
 PlotLegends -> Automatic,
 ColorFunction -> ColorData[{"StarryNightColors", "Reverse"}]

Mathematica graphics

Hope this helps.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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