5
$\begingroup$

I have ListPlot3D's which corresponds to one of 24 surfaces. Since I want to see the effect of change in parameters that shown in every surface, I want to plot these 24 surfaces in one graph but with different colors with also different labels. How can I do that?

This is my sample (2 surfaces) code:

xtime1 = {{8515.172419083505, 8515.172419083057, 8515.172419082499, 8515.17241908209, 8515.172419081428, 8515.172419080951, 8515.172419080476, 8515.172419079952, 
     8515.172419079467, 8515.172419078972, 8515.172419078604}, {9366.68966092754, 9366.689660863265, 9366.689660798713, 9366.689660734246, 9366.689660670076, 
     9366.689660605605, 9366.689660541118, 9366.689660476724, 9366.689660412287, 9366.689660347969, 9366.68966028363}, 
    {10218.206892766451, 10218.206887699582, 10218.206882632945, 10218.206877566105, 10218.206872499166, 10218.206867432376, 10218.20686236543, 10218.206857298796, 
     10218.206852231868, 10218.206847164998, 10218.206842098141}, {11069.72340697668, 11069.72316103375, 11069.722915091466, 11069.722669149676, 
     11069.722423208026, 11069.722177267282, 11069.721931327036, 11069.721685387429, 11069.721439447938, 11069.721193509278, 11069.720947571022}, 
    {11921.21180547675, 11921.204411183342, 11921.197017296367, 11921.189623815857, 11921.182230741704, 11921.174838074008, 11921.16744581267, 11921.1600539575, 
     11921.152662508384, 11921.145271465783, 11921.137880829066}, {12772.067467862695, 12771.929597678101, 12771.791847609327, 12771.654217426412, 
     12771.516706899762, 12771.379315800617, 12771.242043901257, 12771.104890973762, 12770.967856791916, 12770.830941129721, 12770.694143761424}, 
    {13614.750155093725, 13613.207529177631, 13611.67716279349, 13610.158846055578, 13608.652374643507, 13607.157549602198, 13605.67417715123, 13604.202068502762, 
     13602.741039687775, 13601.290911388509, 13599.851508780663}, {14403.051273071842, 14394.218073963495, 14385.687335452832, 14377.43797869228, 
     14369.451112274077, 14361.7097348923, 14354.198487395346, 14346.903444626232, 14339.811939572233, 14332.912413942522, 14326.19429051323}, 
    {15039.961771752312, 15016.919049292968, 14995.381502669063, 14975.162567416077, 14956.10863016614, 14938.091655910168, 14921.003776461459, 14904.753243822732, 
     14889.261353967608, 14874.460073754082, 14860.290185999724}, {15498.381096302599, 15462.470571878843, 15429.447807190993, 15398.8916223735, 
     15370.466227817604, 15343.899656258192, 15318.968591394469, 15295.487445803286, 15273.30033684588, 15252.27508510828, 15232.298653500471}, 
    {15829.310080582787, 15784.697281763523, 15743.89217948242, 15706.31987543982, 15671.524648699615, 15639.139409275103, 15608.864297295146, 15580.451340142008, 
     15553.693227717964, 15528.414951891787, 15504.467478868966}}; 

l1 = ListPlot3D[xtime1, DataRange -> {{0, 1}, {0, 1}}]; 

xtime2 = {{7769.719016091892, 7769.719016091892, 7769.719016091892, 7769.719016091892, 7769.719016091892, 7769.719016091892, 7769.719016091892, 7769.719016091892, 
     7769.719016091892, 7769.719016091892, 7769.719016091892}, {8546.690909887839, 8546.690909887839, 8546.690909887839, 8546.690909887839, 8546.690909887839, 
     8546.690909887839, 8546.690909887839, 8546.690909887839, 8546.690909887839, 8546.690909887839, 8546.690909887839}, 
    {9323.66241064788, 9323.66241064788, 9323.66241064788, 9323.66241064788, 9323.66241064788, 9323.66241064788, 9323.66241064788, 9323.66241064788, 
     9323.66241064788, 9323.66241064788, 9323.66241064788}, {10100.62101732763, 10100.62101732763, 10100.62101732763, 10100.62101732763, 10100.62101732763, 
     10100.62101732763, 10100.62101732763, 10100.62101732763, 10100.62101732763, 10100.62101732763, 10100.62101732763}, 
    {10877.306869048272, 10877.306869048272, 10877.306869048272, 10877.306869048272, 10877.306869048272, 10877.306869048272, 10877.306869048272, 
     10877.306869048272, 10877.306869048272, 10877.306869048272, 10877.306869048272}, {11650.317748777798, 11650.317748777798, 11650.317748777798, 
     11650.317748777798, 11650.317748777798, 11650.317748777798, 11650.317748777798, 11650.317748777798, 11650.317748777798, 11650.317748777798, 
     11650.317748777798}, {12394.203758134438, 12394.203758134438, 12394.203758134438, 12394.203758134438, 12394.203758134438, 12394.203758134438, 
     12394.203758134438, 12394.203758134438, 12394.203758134438, 12394.203758134438, 12394.203758134438}, 
    {13029.240468915785, 13029.240468915785, 13029.240468915785, 13029.240468915785, 13029.240468915785, 13029.240468915785, 13029.240468915785, 
     13029.240468915785, 13029.240468915785, 13029.240468915785, 13029.240468915785}, {13497.236827867404, 13497.236827867404, 13497.236827867404, 
     13497.236827867404, 13497.236827867404, 13497.236827867404, 13497.236827867404, 13497.236827867404, 13497.236827867404, 13497.236827867404, 
     13497.236827867404}, {13831.813174764791, 13831.813174764791, 13831.813174764791, 13831.813174764791, 13831.813174764791, 13831.813174764791, 
     13831.813174764791, 13831.813174764791, 13831.813174764791, 13831.813174764791, 13831.813174764791}, 
    {14082.087394806636, 14082.087394806636, 14082.087394806636, 14082.087394806636, 14082.087394806636, 14082.087394806636, 14082.087394806636, 
     14082.087394806636, 14082.087394806636, 14082.087394806636, 14082.087394806636}}; 

l2 = ListPlot3D[xtime2, DataRange -> {{0, 1}, {0, 1}}]; 

Show[l1, l2, PlotRange -> All]; 

Can you help me please to solve my problem? I hope you can understand my problem. Thank you for your time and consideration.

$\endgroup$
  • $\begingroup$ Why not show your code for the 3-surfaces? Most likely a small change to this will allow any number of colors. $\endgroup$ – bill s Aug 15 '16 at 21:07
  • $\begingroup$ There's no reason why this can't be done. You either missed something or made a syntax error, without seeing code, there's no way to know. $\endgroup$ – Feyre Aug 15 '16 at 21:11
  • $\begingroup$ For instance: ListPlot3D[ Table[a - Sin[x y], {a, Range[0, 1.2, 0.2]}, {x, 0, 3, 0.1}, {y, 0, 3, 0.1}], PlotStyle -> {Green, Yellow, Red, Blue, Orange, Black, Purple}] $\endgroup$ – Feyre Aug 15 '16 at 21:15
  • $\begingroup$ I'm now editing my question $\endgroup$ – ecco Aug 15 '16 at 21:19
  • $\begingroup$ So, the example you gave is only for one table I guess, but I want to plot 24 table in the same graph. $\endgroup$ – ecco Aug 15 '16 at 21:28
3
$\begingroup$

You can use Join and PlotLegends

data = Join[{xtime1}, {xtime2}];
ListPlot3D[data, DataRange -> {{0, 1}, {0, 1}}, PlotRange -> All, PlotLegends -> Automatic]

enter image description here

Another option is Animate

Animate[ListPlot3D[data[[i]], DataRange -> {{0, 1}, {0, 1}}, 
  PlotRange -> All, Mesh -> None, 
  ColorFunction -> Function[{x, y, z}, ColorData["Rainbow"][z/Max[xtime2]]], 
  ColorFunctionScaling -> False], {i, 1, 2, 1}]
$\endgroup$
  • $\begingroup$ Thank you, it works again but just for 10 colors I think. Can I just increase the color range or show surfaces with different styles? I have to differentiate them. $\endgroup$ – ecco Aug 15 '16 at 22:16
  • $\begingroup$ @ecco PlotLegends -> Range[24] $\endgroup$ – Young Aug 15 '16 at 22:45
  • $\begingroup$ and PlotStyle -> Table[ColorData[97, c], {c, 1, 24}] $\endgroup$ – Young Aug 15 '16 at 22:47
2
$\begingroup$

Example

legend = SwatchLegend[
       {Red, Blue}, 
       {"Data Set 1" , "Data Set 2"},
       LegendMargins -> 5
       LegendFunction -> (Framed[#, RoundingRadius -> 5] &)
   ];

ListPlot3D[{xtime1, xtime2}, PlotLegends -> legend]

Alternatively

ListPlot3D[{xtime1, xtime2}, PlotLegends -> {"Data Set 1", "Data Set 2"}]

Output

output output 2

Reference

ListPlot3D
PlotLegends

$\endgroup$
  • $\begingroup$ You are welcome, hope it was of any use :) $\endgroup$ – e.doroskevic Aug 16 '16 at 8:15

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.