2011-09-02 89 views
0

串考虑:列表名称在数学

daList=Range[10] 

我需要的是标题是列表的名称,但尝试:

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

似乎并没有工作。

enter image description here

编辑

“daList” 这个称号我想要的。 SORRY对于以前我以前缺乏精确度

编辑

我又不能老是做任何解决方案的工作,但我想我孤立的问题。列表名称是绘图函数参数。我相信,简单的版本复制我的问题是这样的:

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

一个低于我的“真实”代码:

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, [email protected](Max /@ sequenceCountALL[conditionSet])}}, Joined -> True] 

凡plotOptions是一个函数来定制一些选项(标题和颜色)和脚与其他人一起绘制 请知道,即使评估[plotOptions]结果保持不变。

+1

你是什么意思的字符串转换?你寻求的结果是什么? –

+0

您的编辑会增加混淆。你的第一个数字已经有“daList”作为标题。 –

回答

4

试试这个:

ToString[[email protected]] 

所以如

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

enter image description here

+0

它在我当前的设置下不起作用,我有一个绘图函数,它将列表名称(表达式)作为输入:我认为这反映了问题:list = {1,2,3,4};命名[list_]:= ToString [HoldForm [list]];命名[表]有什么想法吗 ? – 500

+0

@ 500这里:'list = {1,2,3,4}; ClearAll [命名]; SetAttributes [naming,HoldFirst]; naming [list_]:= ToString [HoldForm [list]]'即在定义'命名'前添加'SetAttributes [naming,HoldFirst]' – acl

+0

我即将放弃,它嵌套在我的绘图功能。你能从这个语法中看到明显的原因吗? sequenceCountPlot [conditionSet_]:= ListPlot [sequenceCountALL [conditionSet], plotOptions [( “DisplayNo看外面滤光”<> 命名[conditionSet]), “显示的号码”, “过滤半径在CM”,prefCOLORS] , PlotRange - > {{0,10},{0, Max @(Max/@ sequenceCountALL [conditionSet])}},Joined - > True] – 500

0

可能

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

enter image description here

+0

它看起来像所期望的输出是'daList'(字面上)作为标题。也许我误解了这个问题。 – acl

+0

我的不好,对不起纳赛尔。 @acl,我担心你会根据我之前缺乏精确性/关注度做出很好的推论。 ;-) – 500

+0

我把它理解为500想要daList的值作为字符串。 – Nasser

2

另一种可能性:

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

我认为,两种最方便的方式来做到这一点是:

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

其他可能性:

ListPlot[daList, PlotLabel -> MakeBoxes[daList]] 
ListPlot[daList, PlotLabel -> SymbolName[[email protected]]] 
ListPlot[daList, PlotLabel -> ToString[[email protected]]] 
ListPlot[daList, PlotLabel -> ToString[[email protected]]] 
+0

坦克你阿列克谢。 – 500