Tag Info

Hot answers tagged

7

Try this: Background -> {None, Prepend[Table[Hue[(k - 2)/35], {k, 15}], White]} Pedagogical word of caution: this might not be the best example to give to grade-school students, as the bottom entry has a decibel level of zero; this may naturally lead students to think that the minimum possible decibel level is zero, which is false. Including examples ...


7

Maybe this: icol[r_, c_] := Item[Style[NumberForm[r, {4,3}], c], Background -> GrayLevel[r]]; item[r_Real /; 0 <= r <= 1] := If[r > 0.5, icol[r, Black], icol[r, White]]; Grid[Map[item, RandomReal[1, {4, 4}], {2}], ItemStyle -> "Text", ItemSize -> {5, 5}, Alignment -> {Center, Center}] To add the row and column headers: ...


7

You can avoid Item and do this by referencing the Grid positions directly in Background and ItemStyle: SeedRandom[1]; tmp = RandomReal[{0, 1}, {4, 4}]; Now: Grid[tmp, Alignment -> {Center, Center}, Background -> {None, None,Flatten[MapIndexed[#2 -> GrayLevel[1 - #1] &, tmp, {2}], 1]}, ItemSize -> {10, 5}, ItemStyle -> {None, ...


5

n = 7; mat = Round[RandomReal[{0, 1}, {n, n}], 0.01]; ft = Transpose[{Range[n], Take[CharacterRange["A", "Z"], n]}]; ArrayPlot[ mat, Epilog -> MapIndexed[Text[#1, #2 - 1/2] &, Transpose @ Reverse @ mat, {2}] /. Text[a_, b_] :> Text[Style[PaddedForm[a, {3, 2}], If[a > 0.5, White, Black]], b], FrameTicks -> {ft, ft}, Mesh -> True, ...


4

You need to specify formatting directives for the "Print" style. Adding this cell to the custom style sheet: Cell[StyleData["Print"], FontSize->24, FontColor->RGBColor[1, 0, 0]] Should produce: There is also a "MSG" style for messages: Cell[StyleData["MSG"], FontWeight->"Bold", FontColor->RGBColor[1, 0.5, 0]] Both of these can be ...


4

There are no spacings outside so Spacings -> {0, 0} should work. [...]


3

With data being your input text: col = With[{l = Length[Last /@ data[[2 ;;]]]}, Table[Blend[{Red, Yellow, Green}, x],{x, 0, 1, 1/(l - 1)}]]; Grid[data, Frame -> All, Background -> {None, None, Join[{{{1, 1}, {1, 2}} -> LightGray}, Rule @@@ Thread@{{#, 2} & /@ Range[2, Length@data], col}]}, Alignment -> Left] Or with ...


2

Another way to use Graphics and Raster: ClearAll[rF, tF, lF]; tF = Transpose[{Range[Length@#] - 1/2,Style[#, "Panel", 18] & /@ #}] &; (* in some versions you might need Style[#, "Panel", 18, Background -> Transparent] & *) lF = Text[Style[#, If[# <= .5, White, Black], "Panel", 16, Background -> Transparent],#2 - 1/2] &; rF = ...


2

n=5; p = Array[#1 + #2 &, {n, n}]; Grid[p, ItemStyle -> Join[{Automatic, Automatic}, {Flatten[Table[{i, j} -> {"Subsection", ColorData[3][i + j]}, {i, n}, {j, n}], 1]}]]


1

When needing to style individual items in a Grid, one solution is to wrap them with Item. Grid[{{Item[1, Frame -> True], 2}, {3, Item[4, Frame -> True]}}] Item allows applying Grid-specific styling (i.e. things that don't make sense outside of grid and cannot be easily added with Style) for each grid item separately. Frames, e.g., can be added ...


1

Here is one more option using Grid. data=Round[RandomReal[1,{5,5}],0.01]; colorIt[data_List]:=Module[{style}, style=Item[Style[#,FontColor->ColorNegate@GrayLevel[#]],Background->GrayLevel[#]]&; Map[style,data,{-1}] ] labelIt[label_List][data_List]:=Join[List/@Prepend[label,Null], Join[{label}, data], 2] Grid[ ...



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