I'm trying to get a comparative matrix of features, like attached.

For the life of me I can't find a LaTeX package combination to make this work.

  • I need square cells
  • that I can colour
  • with tight, slanted headings

Basically, I have lots of data I need to see at a glance and I can't figure out what combination of various table packages (tabular, tabularx, tablu), colour and other things works to pull this off.

enter image description here

  • Yes? all of the above.
    – yarbelk
    Commented Jul 7, 2021 at 12:15
  • there are lots and lots of table packages, and i end up with horrible messes when i try and square cells; colourized, and slanted headings working together.
    – yarbelk
    Commented Jul 7, 2021 at 12:23

1 Answer 1


With {NiceTabular} of nicematrix.

  • In order to have square cells, fix the width of the columns to 8 mm (and set tabcolsep which is the length on both sides of a column to 0 pt) and put a strut of total height 8 mm in each row (\rule[-3mm]{0pt}{8mm}).
  • Use \rotatebox of graphicx to rotate the contents of each cell of the first row.
  • In {NiceTabular}, the key hvlines draws all the rules, excepted in the 'first row' and the 'first column' (specified by the corresponding keys).


  {  \rotatebox[origin=c]{80}{#1} }

    & \MyRotate{Feature A}
    & \MyRotate{Feature B}
    & \MyRotate{Feature C}
    & \MyRotate{Feature 1}
    & \MyRotate{Feature 2} \\
Foo & & \cellcolor{blue!15} & & \cellcolor{red!15}{}\\
Bar & & \cellcolor{blue!15} & \cellcolor{blue!15} & \cellcolor{red!15} & \cellcolor{red!15}\\
Baz & \cellcolor{blue!15}\\


You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

Remark: With nicematrix, you will have a good output in all PDF viewers at all levels of zoom.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .