Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Conveniently display two-dimensional data in a nicely styled grid
ResourceFunction["PrettyGrid"][data] displays the elements of data in an autostyled two-dimensional grid. |
| lists | {expr1,expr2,…} |
| associations | <|k1→v1,k2→v2,…|> |
| matrices | {{expr11,expr12,…},{expr21,expr22,…},…} |
| list of rules | {k1→v1,k2→v2,…} |
| list of lists of rules | {{k11→v11,…},{k21→v21,…},…} |
| list of associations | {<|k11→v11,…|>,<|k21→v21,…|>…} |
| Alignment | Left | horizontal alignment of items |
| "BaseFontSize" | Default | the font size used in BaseStyle of the grid |
| "ColumnHeadings" | Automatic | the headers used for the columns |
| PlotTheme | "Monochrome" | format the grid with a predefined set of styles |
| "RowHeadings" | Automatic | the headers used for the rows |
| Spacings | Automatic | this spec is passed directly to Grid |
![]() | "Monochrome" |
![]() | "Minimal" |
![]() | "Detailed" |
![]() | "Marketing" |
PrettyGrid displays matrices with formatting by default:
| In[1]:= |
| Out[1]= | ![]() |
PrettyGrid accepts mixed lists of lists of rules and associations:
| In[2]:= | ![]() |
| Out[2]= | ![]() |
PrettyGrid works on both rectangular and ragged matrices:
| In[3]:= |
| Out[3]= | ![]() |
PrettyGrid works on certain datasets:
| In[4]:= |
| Out[5]= | ![]() |
PrettyGrid works on ragged arrays:
| In[6]:= |
| Out[6]= | ![]() |
PrettyGrid attempts to infer headings from the table's content:
| In[7]:= | ![]() |
| Out[7]= | ![]() |
PrettyGrid also works with nested associations:
| In[8]:= | ![]() |
| Out[8]= | ![]() |
PrettyGrid takes an Alignment option for controlling horizontal item‐wise alignments:
| In[9]:= | ![]() |
| Out[9]= | ![]() |
PrettyGrid takes an optional list of "ColumnHeadings" and "RowHeadings":
| In[10]:= | ![]() |
| Out[11]= | ![]() |
PrettyGrid has the Spacings option:
| In[12]:= | ![]() |
| Out[12]= | ![]() |
Compare the four available settings for the PlotTheme option:
| In[13]:= | ![]() |
| Out[13]= | ![]() |
For small 2D data, Dataset does similar things, but sometimes does not format as expected:
| In[14]:= |
| Out[12]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License