Hot answers tagged

14

Grid ClearAll[labeledGrid] labeledGrid[cs_: "GrayTones", is_: {80, 80}, sty_: Directive["TR", FontSize -> 16, Black]] := Module[{tbl = Map[Item[Pane[Style[If[NumericQ@#, NumberForm[#, 2], #], sty], Alignment -> Center, ImageSize -> is], Background -> If[NumericQ@#, ColorData[cs][(1 + #)/2], None]] &, Prepend[...


9

How about using MatrixPlot? epilog = MapIndexed[Text[Style[Round[#, .01], 10], #2 - 1/2] &, Transpose@Reverse@ccm, {2}]; ticks = Transpose[{Range@Length@mem, mem}]; MatrixPlot[ccm, Epilog -> epilog, FrameTicks -> {ticks, ticks, ticks, ticks}, PlotRangePadding -> None, ColorFunction -> (ColorData["GrayTones"][(1 + #)/2] &), ...


8

Readapting my answer here: DensityPlot with text dim = Dimensions@ccm; temp = Transpose[{mem}~Join~Transpose@Round[ccm, .01]]; table = Prepend[temp, Flatten@{"", mem}]; background = Join[{None, None}, {Flatten[ Table[{i, j} -> ColorData["GrayTones"][table[[i, j]]], {i, 2, 1 + dim[[1]]}, {j, 2, 1 + 3}], 1]}]; Grid[table , Frame -&...


6

ClearAll[abcF, pw] pw = Piecewise[{{"A", # >= 2/3}, {"C", # < 1/3}}, "B"] &; abcF = pw /@ Normalize[Accumulate @ Sort @ #, Last][[Ordering @ Ordering @ #]] &; Example: SeedRandom[1] n = 30; data = Prepend[Table[{"item "~StringJoin~ToString[i], RandomInteger[100]}, {i, 1, n}], {"product name", "profit"}]; Use abcF to assign a label to ...


4

Generate data, leaving off the header. RandomSeed[1234]; data = Table[{"item "~StringJoin~ToString[i], RandomInteger[100]}, {i, 1, 100}]; Sort it on the last column, large to small. sorted = Reverse@SortBy[data, Last]; Get an accumulation of the last column, and the total. accum = Accumulate@sorted[[All, 2]]; tot = Last@accum; Calculate a third of the ...


1

I have to admit that this is a very weird way of storing lists, but maybe you just simplified your real code for providing an example here. Anyway: v[a][b][c] = {1, 5, 9}; v[a][b][c][[2]] Part[v[a][b][c],2] 5 5 Both work for me (mathematica 12 on MacOS) In an example: v[3][1][5] = {1, 5, 9}; v[3][1][5][[2]] 5 If you want to keep it generic ...


1

This may not be efficient but could be a good starting point. It works for data up to 26 columns. If you need more columns, you can modify the function. tableView[data_] := Module[{rowheadings, columnheading, output}, rowheadings = Flatten[{Range[1, Length[data]]}]; columnheading =Flatten[{"", CharacterRange["A", "Z"][[1 ;; Dimensions[data] ...


Only top voted, non community-wiki answers of a minimum length are eligible