Tabulate - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

DocumentTools

  

Tabulate

  

insert a worksheet Table from a Matrix, Vector, Array, DataFrame, record, list, or list of lists

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Tabulate( M, opts )

Parameters

M

-

{Array,Matrix,Vector,DataFrame,list,list(list),record}

opts

-

(optional) ; one or more keyword options as described below

Options

• 

alignment: identical(left,right,center):=center ; The horizontal alignment of the Table in the worksheet. The default value is center.

• 

color: {list(nonnegint),symbol,string,appliable}:=[0,0,0] ; The foreground color for text. The passed value can be either a specified color acceptable to ColorTools:-Color, or a procedure which returns such. A list of nonnegative integers is interpreted as RGB values in a 24-bit 3-channel color space. In the case of a supplied procedure the passed arguments will be M, i, j for the cell in row i and column j. The default value is [0,0,0] which corresponds to black.

• 

exterior: identical(all,none):=all ; Indicates how exterior borders are shown.

• 

fillcolor: {list(nonnegint),symbol,string,appliable}:=[255,255,255] ; The background fill color for the Table cells. The passed value can be either a specified color acceptable to ColorTools:-Color, or a procedure which returns such. A list of nonnegative integers is interpreted as RGB values in a 24-bit 3-channel color space. In the case of a supplied procedure the passed arguments will be M, i, j for the cell in row i and column j. If the first argument to Tabulate is not a DataFrame then the default value for fillcolor is [255,255,255] which corresponds to white. If the first argument to Tabulate is a DataFrame then the default value for fillcolor is a procedure which returns [210,230,255] for the first column or row, and [255,255,235] otherwise.

• 

interior: identical(all,none):=all ; Indicates how internal borders are shown.

• 

output: identical(XML,inline); Specifies whether to insert the formatted output or return the raw XML structure.

• 

plotcomponents: truefalse ; Indicates whether plots are inserted within Plot Components. The default is false. When this option is false plot entries that are not part of expression sequences are inlined within individual Table cells.

• 

recordformat: identical(table,section); Specifies the layout format used for records

• 

typesetting: identical(standard,extended); Specifies the typesetting level. By default the current value returned by interface(typesetting) is used.

• 

weights: {list(nonnegint),Vector(nonnegint)} ; Relative weights for the Table's columns' widths. By default all columns have equal weight.

• 

width: And(realcons,nonnegative):=100.0 ; Indicates the displayed width of the Table as a percentage of the worksheet's width in the case of option widthmode=percentage, or as the number or pixels in the case that option widthmode=pixels. The default is 100% of the displayed worksheet's width.

• 

widthmode: identical(percentage,pixels):=percentage ; Whether the width option's value is interpreted as a percentage of the worksheet's width or as a number of pixels.

Description

• 

The Tabulate command constructs and inserts a worksheet Table from a Matrix, Vector, one or two dimensional Array, DataFrame, list, or list of lists.

• 

The return value of the command is the identity of the inserted parent Table, as a string. The display of the returned value can be suppressed by terminating the statement with a full colon.

• 

Calls to the Tabulate command cannot be nested within each other unless used with the option output=XML and other DocumentTools commands to construct your own content.

• 

Expressions are inserted as typeset 2-D Math, and can be operated upon using context-sensitive operations in the Context Panel.

• 

The inserted Tables will be removed by the main menu action Edit->Remove Output. Pasted copies of the inserted Tables are not removed.

• 

This command inserts the assembly of Tables and Embedded Components into the worksheet using the InsertContent facility. The inserted content is placed after any usual output of the Execution Group in which this command is called. Each Execution Group allows for only one inserted result to exist at any given time. Multiple calls to commands which utilize the InsertContent facility made within the same Execution Group will result in each successive inserted assembly replacing any assembly inserted earlier for that Execution Group.

Examples

withDocumentTools:

By default the inserted Table takes 100% of the width of the worksheet.

Tabulatea,b,c,d:

a

b

c

d

 

In the next example the width of the Table is 50% of the width of the worksheet. That width ratio is maintained when the worksheet is maximized or manually resized.

Tabulatea,b,c,d,width=50:

a

b

c

d

 

Column Vectors produce a Table with entries stacked vertically.

TabulateVectorcolumna,b,c,d,width=20:

a

b

c

d

 

The initial width can also be specified as pixels, under default zoom. In this case the Table will zoom along with the worksheet, under magnification.

MLinearAlgebra:-RandomMatrix6,2

M

(1)

TabulateM,widthmode=pixels,width=100:

−32

99

−74

29

−4

44

27

92

8

−31

69

67

 

2-D and 3-D plot entries are inlined by default.

Aplotsinxx,Sumfi,i=1..N,plot3dy2sinx,x=π..π,y=2..2:

TabulateA,width=60:

i=1Nfi

 

Plot entries can be inserted optionally within Plot Components, as opposed to being inlined.

TabulateA,width=60,plotcomponents:

i=1Nfi

 

The interior or exterior Table borders can optionally be hidden.

TabulateM,widthmode=pixels,width=100,exterior=none:

−32

99

−74

29

−4

44

27

92

8

−31

69

67

 

TabulateA,width=60,interior=none:

i=1Nfi

 

The fillcolor option can be used to specify a background fill color, including the case of 3-D plot entries.

Tabulateplot3dy2sinx,x=π..π,y=2..2,axis=color=cyan,orientation=55,75,0,fillcolor=black,width=400,widthmode=pixels:

 

The color option can be used to specify a foreground color.

TabulateExample text.,color=red,fillcolor=LightYellow,width=30:

Example text.

 

TabulateExample text.,color=#FF0000,fillcolor=LightYellow,width=30:

Example text.

 

ALinearAlgebra:-RandomMatrix3,4:headera|b|c|d:

Tabulateheader,A,width=40,`=`fillcolor,T,i,jj`if`i=1,cyan,white:

a

b

c

d

−38

33

57

−76

−18

−98

27

−72

87

−77

−93

−2

 

TabulateA,width=40,`=`fillcolor,T,i,j`if`iremj,2=1,cyan,white:

−38

33

57

−76

−18

−98

27

−72

87

−77

−93

−2

 

PColorTools:-GetPalettecss:TtableseqColorDescriptionc=c,c=P,=ColorTools:-ColorWhite:MArrayTools:-ReshapeVectorindicesT,nolist,seq,i=1..36numelemsT,6,3%T

M

(2)

TabulateM&comma;width=60&comma;`=`color&comma;M&comma;i&comma;j`if`0.4<LumaTMi,j&comma;Black&comma;240&comma;240&comma;240&comma;`=`fillcolor&comma;M&comma;i&comma;jToRGB24TMi,j&colon;

Maroon

Green

Orange

Lime

White

Olive

Yellow

Silver

Red

 

Black

Teal

Blue

Navy

Fuchsia

Gray

Aqua

Purple

 

One additional level of nested lists is supported. Note that the middle entry in the following example is represented with an inner Table.

LSome text&comma;y2sinx&comma;x=π..π&comma;y=2..2&comma;plot3dy2sinx&comma;x=π..π&comma;y=2..2&colon;

TabulateL&colon;

Some text

y2sinx

x=π..π

y=−2..2

 

The Table can be inserted as left-aligned in the worksheet. The relative widths of the Table columns can be specified using the weights option.

TabulateL&comma;width=60&comma;alignment=left&comma;weights=3&comma;3&comma;7&colon;

Some text

y2sinx

x=π..π

y=−2..2

 

The level of typesetting of expression entries can be forced.

Tabulateπ&comma;Γ&comma;sqrt2&comma;difffx&comma;x&comma;BesselJ0&comma;x&comma;width=50&comma;typesetting=standard&colon;

π

GAMMA

2

&DifferentialD;&DifferentialD;xfx

BesselJ0&comma;x

 

Tabulateπ&comma;Γ&comma;sqrt2&comma;difffx&comma;x&comma;BesselJ0&comma;x&comma;width=40&comma;typesetting=extended&colon;

π

Γ

2

&DifferentialD;&DifferentialD;xfx

BesselJ0&comma;x

 

The fillcolor has a different default for a DataFrame, which can be overridden.

genusRubus&comma;Vitis&comma;Fragaria&colon;energy220&comma;288&comma;136&colon;carbohydrates11.94&comma;18.1&comma;7.68&colon;total_tons543421&comma;58500118&comma;4594539&colon;top_producerRussia&comma;China&comma;USA&colon;DFDataFrameenergy|carbohydrates|total_tons|top_producer|genus&comma;columns=Energy&comma;Carbohydrates&comma;`Total Tons`&comma;`Top Producer`&comma;Genus&comma;rows=Raspberry&comma;Grape&comma;Strawberry&comma;datatypes=integer&comma;float&comma;integer&comma;anything&comma;string

DF

(3)

TabulateDF&comma;width=600&comma;widthmode=pixels&colon;

 

Energy

Carbohydrates

Total Tons

Top Producer

Genus

Raspberry

220

11.9399999999999995

543421

Russia

Rubus

Grape

288

18.1000000000000014

58500118

China

Vitis

Strawberry

136

7.67999999999999972

4594539

USA

Fragaria

 

lens4+maxop`~`lengthRowLabelsDF&comma;`~``+`4&comma;` $`&comma;op`~`lengthColumnLabelsDF&colon;

TabulateDF&comma;width=addlens6&comma;widthmode=pixels&comma;weights=lens&comma;`=`fillcolor&comma;M&comma;i&comma;j`if`i=1andj1&comma;LightBlue&comma;`if`j=1andi1&comma;LightGreen&comma;White&colon;

 

Energy

Carbohydrates

Total Tons

Top Producer

Genus

Raspberry

220

11.9399999999999995

543421

Russia

Rubus

Grape

288

18.1000000000000014

58500118

China

Vitis

Strawberry

136

7.67999999999999972

4594539

USA

Fragaria

 

The Tabulate command provides an alternative to plots:-display as a mechanism for displaying Arrays of plots in a tabular form. In particular it provides the additional functionality to specify the visibility of Table borders and the Table dimensions and alignment.

AArrayplotsinx&comma;x=π..π&comma;size=200&comma;200&comma;plotsinx&comma;x=π..π&comma;size=200&comma;200&comma;scaling=constrained&comma;plotcosx&comma;x=π..π&comma;size=200&comma;200&comma;plotcosx&comma;x=π..π&comma;size=200&comma;200&comma;scaling=constrained&colon;

plots:-displayA

TabulateA&comma;width=700&comma;widthmode=pixels&comma;interior=none&colon;

 

The return value of the command is the identity of the inserted Table and this can be used to modify the Table after insertion.

AArrayplotsinx&comma;x=π..π&comma;size=300&comma;200&comma;scaling=constrained&comma;plotcosx&comma;x=π..π&comma;size=300&comma;200&comma;scaling=constrained&colon;

TabulateA&comma;width=700&comma;widthmode=pixels&colon;

 

str1TabulateA&comma;width=700&comma;widthmode=pixels&colon;

 

str1

Tabulate21

(4)

SetPropertystr1&comma;exterior&comma;none&semi;SetPropertystr1&comma;interior&comma;none

The Tabulate command can format nested records

RRecordshape=cube&comma;size&comma;color&colon;

R:-sizeRecordwidth=12&comma;height=16&comma;depth=8&colon;

R:-colorRecordR=CC&comma;G=CC&comma;B=EE&colon;

TabulateR&colon;

shape

cube

size

width

12

height

16

depth

8

color

R

CC

G

CC

B

EE

TabulateR&comma;recordformat=section&colon;

shape

cube

size

width

12

height

16

depth

8

color

R

CC

G

CC

B

EE

 

Compatibility

• 

The DocumentTools[Tabulate] command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

• 

The output and typesetting options were introduced in Maple 2016.

• 

For more information on Maple 2016 changes, see Updates in Maple 2016.

• 

The DocumentTools[Tabulate] command was updated in Maple 2018.

• 

The M parameter was updated in Maple 2018.

• 

The recordformat option was introduced in Maple 2018.

• 

For more information on Maple 2018 changes, see Updates in Maple 2018.

See Also

Array

DataFrame

DataFrame:-Tabulate

list

Matrix

Plot Components

plot/arrayplot

Record

Table

 


Download Help Document