开发者

List name to String in Mathematica

Considering :

 daList=Range[10]

What I need is the title to be the list name but trying :

ListPlot[daList, PlotLabel -> ToString[daList]]

does not seem to work.

List name to String in Mathematica

EDIT

"daList" is the Title I want. SORRY for previous my previous lack of precision

EDIT

I yet can`t make any solution work but I think I isolated the problem. The list name is a plotting Function argument. I believe the simple version replicating my problem is like :

list = {1, 2, 3, 4};
naming[list_] := ToString[HoldForm[list]];
naming[list]

an below my "real" code :

sequenceCountPlot[conditionSet_] :=
ListPlot[sequenceCountALL[conditionSet],
plotOptions[
("DisplayNo looking outside filter" <> (ToString[HoldForm[conditionSet]])), 
"Number of Display", 
"Filter Radius in Cm", 
 prefCOLORS], 
 PlotRange -> {{0, 10}, {0, Max@(Max /@ sequenceCountALL[conditionSet])}}, Joined -> True]

Where plotOptions is a function to customize some options (Titles and Colors) and feet the plot with other. Please know that Even with 开发者_开发问答Evaluate[plotOptions] the results remain the same.


Try this:

ToString[HoldForm@daList]

so eg

ListPlot[daList, PlotLabel -> ToString[HoldForm@daList]]

List name to String in Mathematica


I believe that two the most convenient ways to do this are:

daList = Range[10];
ListPlot[daList, PlotLabel -> "daList"]
ListPlot[daList, PlotLabel -> HoldForm[daList]]

Other possibilities:

ListPlot[daList, PlotLabel -> MakeBoxes[daList]]
ListPlot[daList, PlotLabel -> SymbolName[Unevaluated@daList]]
ListPlot[daList, PlotLabel -> ToString[Unevaluated@daList]]
ListPlot[daList, PlotLabel -> ToString[HoldForm@daList]]


Another possibility:

ListPlot[daList, PlotLabel -> ToString[Unevaluated[daList]]]


may be

ListPlot[daList, PlotLabel -> StringJoin[Map[ToString, daList]]]

List name to String in Mathematica

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜