2
$\begingroup$

in this simplified example I defined several data and plotted them at once to reduce typing work. Unfortunately I cannot find the syntax or option to label/ name each data array, which all belong to their own plot and further let these names be displayed as PlotLabel or be displayed as Epilog Text (it`s the same label for all three), which would be automatically taken from the data list which would be best. The latter would be my preferred option. Any suggestions? Many thanks in advance. (edit: due to the comments i simplified the example again a little)

data1 = {{1, 3, 4, 4, 5}, {1, 3, 4, 5, 5}, {1, 3, 4, 5, 5}, {2, 3, 4, 5, 5}, {2, 3, 4, 5, 5}};
data2 = {{1, 2, 2, 3, 1}, {1, 2, 2, 3, 1}, {1, 2, 2, 4, 1}, {1, 3, 4, 4, 1}, {1, 3, 4, 4, 1}};
data3 = {{3, 4, 4, 4, 4}, {3, 4, 4, 6, 6}, {3, 4, 4, 7, 6}, {4, 4, 4, 7, 6}, {4, 5, 5, 6, 5}};
ListPlot3D[#, PlotLabel -> "name for data1, name for data2"] & /@ {data1, data2, data3}
$\endgroup$
  • $\begingroup$ I think you're looking for Legended, LineLegend and Placed in the documentation. $\endgroup$ – Ymareth Feb 1 '16 at 11:17
  • $\begingroup$ Legended and LineLegend doesn't work here because i don't want to name several data sets for one plot but give the data sets each one name which belong each to an own plot and let the whole plot automatically be named after these names. $\endgroup$ – StephanJ Feb 1 '16 at 11:28
  • $\begingroup$ Please edit your question to make your example minimalistic. Most of the code present does not help to understand your problem, but on the contrary makes it confusing. I have provided an answer that I think answers your question. Please clarify otherwise. $\endgroup$ – rhermans Feb 1 '16 at 12:04
3
$\begingroup$

As far as I know, by the time the function you are mapping is evaluated the symbol names have already been substituted by their value. So an approach would be to work with the list of variable names (Names) and then evaluate them (Symbol)

I think is better to work with a minimal working example, it's easier to follow.

ListPlot3D[Symbol[#], PlotLabel -> #] & /@ Names["data*"]

Mathematica graphics

EDIT


If the labels are available in the format

data1 = {{{1, 4, 5}, {1, 2, 3}, {3, 5, 6}}, "Lactic acid_1000g/l"};
data2 = {{{3, 4, 5}, {3, 5, 3}, {5, 1, 7}}, "Nylon_300g/l"};
data3 = {{{3, 4, 5}, {3, 5, 3}, {5, 1, 7}}, "Polypropylene_100g/l"};

then use

ListPlot3D[First[#], PlotLabel -> Last[#]] & /@ {data1, data2, data3}

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thank you very much for your approach. Here the word data is displayed as labels growing incrementally. But I would like to implement a distinct name for each dataset and have each name displayed as label for the plot they belong to. It would be simple using Plotlabel->”” if I plotted each graph on its own but I hoped for a possibility to do it in this multiple plotting at once for huge data arrays. $\endgroup$ – StephanJ Feb 2 '16 at 9:04
  • $\begingroup$ @StephanJ Where is the name you want for the label defined? I'm afraid I do not understand what you need. If not my answer, why did you accept it? May be somebody else would understand and give you the answer. For myself, I need a more detailed explanation. $\endgroup$ – rhermans Feb 2 '16 at 9:35
  • $\begingroup$ thanks again for the comment. I try to explain it a little more. The names for the data arrays are missing here because i don`t know the syntax to define names for each array. I imagined something like data1={{1,4,5},{1,2,3}...}}, "Lactic acid_1000g/l"}; data2={{3,4,5},{3,5,3}...}}, "Nylon_300g/l"} and then implement an option in the code to have these names automatically be displayed in the label for plot1 (the plot of data 1) and plot2 (plot of data 2). I don´t know if something like this is possible. I hope I could make myself a little clearer. $\endgroup$ – StephanJ Feb 2 '16 at 10:01
  • $\begingroup$ @StephanJ Is this what you need? $\endgroup$ – rhermans Feb 2 '16 at 11:32
  • $\begingroup$ Thats it! Works perfect and also vice versa (first and last replaced). Thanks a lot! $\endgroup$ – StephanJ Feb 2 '16 at 12:47
1
$\begingroup$

Is this what you want

data1 = {{1, 3, 4, 4, 5}, {1, 3, 4, 5, 5}, {1, 3, 4, 5, 5}, {2, 3, 4, 
5, 5}, {2, 3, 4, 5, 5}};
data2 = {{1, 2, 2, 3, 1}, {1, 2, 2, 3, 1}, {1, 2, 2, 4, 1}, {1, 3, 4, 
4, 1}, {1, 3, 4, 4, 1}};
data3 = {{3, 4, 4, 4, 4}, {3, 4, 4, 6, 6}, {3, 4, 4, 7, 6}, {4, 4, 4, 
7, 6}, {4, 5, 5, 6, 5}};
data = {data1, data2, data3};
colors = {{1, Red}, {2, Blue}, {3, Orange}, {4, Yellow}, {5, 
Green}, {6, Purple}, {7, Cyan}};

Table[ListPlot3D[data[[i]], Mesh -> {8}, Axes -> True, 
DataRange -> {{10, 50}, {10, 90}, {0, 10}}, 
Ticks -> {Table[i, {i, 10, 50, 10}], Table[i, {i, 10, 90, 20}], 
Table[i, {i, 0, 7, 1}]}, 
Epilog -> {Text[Style["data" <> ToString[i], FontSize -> 22, Bold], {0.3, 3.15}]}, 
ImageSize -> Large, ColorFunction -> (Blend[colors, #3] &), 
ColorFunctionScaling -> False, 
PlotRange -> {Automatic, Automatic, {0.5, 7.5}}, 
ViewPoint -> {0.8 Pi, -1.7 Pi, 0.7 Pi}, 
ImagePadding -> {{90, 10}, {50, 70}}, 
 PlotLabel -> "data" <> ToString[i]], {i, 1, Length[data]}]
$\endgroup$

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.