在数学中操纵自定义表格 [英] Manipulate Custom Tabular representation in Mathematica

查看:144
本文介绍了在数学中操纵自定义表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑到以下数据示例:

data ={
       {"a", "b", "c", "d", "e"},
       {1, 2, 3, 4, 5},
       {11, 12, 13, 14, 15}, 
       {21, 22, 23, 24, 25}
      };

以下功能生成自定义表格表示:

(您可以参考 Mr .Wizard可定制的表格表示的广泛解决方案。
最终我也会操纵他现在提供的选项)

(and you can refer to Mr.Wizard extensive solution for customizable tabular representations. Ultimatly I would also manipulate the options he offered, for now )

DataSampleX[data_, linesNumber_, range1_, range2_, color1_, color2_, color3_] :=

Grid[
 Join[
      {Range[range1, range2]}, {Map[Rotate[Text[#], 90 Degree] &,
       data[[1, range1 ;; range2]]]}, 
       data[[2 ;; linesNumber, range1 ;; range2]]
     ],
       Background    -> {{{{color1, color2}}, {1 -> color3}}},
       Dividers      -> {All, {1 -> True, 2 -> True, 3 -> True,0 -> True}},
       ItemSize      -> {1 -> Automatic, Automatic},
       Alignment     -> Top,
       Frame         -> True,
       FrameStyle    -> Thickness[2],
       ItemStyle     -> {Automatic, Automatic, 
                        {{1, 1}, {1, Length[data]}} ->Directive[FontSize -> 
                        15, Black, Bold]}
    ];

我想使用操作或动态,使用上述显示部分数据。
选择要显示的列的范围,要显示的行数以及颜色。

I would like to use Manipulate or Dynamic to display parts of my data using the above. This choosing the range of column I want to display, the number of lines to display as well as colors.

以下是我未完成的尝试。

Below is my unfinished attempt.

PopupMenu[Dynamic[range1], Range[1, Length@data[[1]] - 1, 1]]
PopupMenu[Dynamic[range2], Range[2, Length@data[[1]], 1]]
PopupMenu[Dynamic[linesNumber], Range[2, Length@data[[All, 1]] - 1, 1]]
Dynamic[DataSampleX[data, linesNumber, range1, range2, LightBlue, 
LightGray, LightYellow]]

如何使用setter来更新颜色值?

How could I use setter to update the Color Value ?

是否可以在操作窗口中实际拥有此功能?

Is it possible to actually have this in a Manipulate window ?

欢迎任何其他建议,使这个高效的外观很好。

Any other suggestion to make this efficient look good is welcome.

- 编辑:现在我能够做的是感谢Belisarius解决方案以下:

推荐答案

尝试一下:

colsel = (#->Graphics[{#, Disk[]},ImageSize -> 15])& /@ColorData[1, "ColorList"];
s[x_] := Style[x, Black, Bold, 12];
ct = ControlType -> PopupMenu;

Manipulate[
 DataSampleX[data, linesNumber, range1, range2, color1, color2, color3],
 Row[{
   Column[{
    Control@{{range1,      1, s@"Range1"}, Range[1, Length@data[[1]] - 1],  ct}, 
    Control@{{range2,      2, s@"Range2"}, Range[2, Length@data[[1]] - 1],  ct}, 
    Control@{{linesNumber, 2, s@"Lines"},  Range[2,Length@data[[All, 1]]-1],ct}}],
   Spacer[20],
   Column[{
     Control@{{color1, colsel[[1, 1]], s@"Color 1"}, colsel, ct}, 
     Control@{{color2, colsel[[2, 1]], s@"Color 2"}, colsel, ct}, 
     Control@{{color3, colsel[[3, 1]], s@"Color 3"}, colsel, ct}}]
 }]]

这篇关于在数学中操纵自定义表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆