Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.9K Views
|
5 Replies
|
3 Total Likes
View groups...
Share
Share this post:

How to label fields in text format in MatrixPlot?

POSTED BY: Tsai Ming-Chou
5 Replies
Posted 3 years ago

Some options

  1. Use a smaller font size. You could choose a font size based on the length of the label but I think that would look bad
  2. Use an AspectRatio less than 1
  3. Increase ImageSize
  4. Rotate the labels

enter image description here

POSTED BY: Rohit Namjoshi
Posted 3 years ago

Hi Ming-Chou

The ticks need to be paired with an index

ytickValues = Style[#, 22, Bold, Black] & /@ data[[All, 1]];
xtickValues = Style[#, 22, Bold, Black] & /@ Rest@Keys@First@data;

ytick = Transpose[{Range@Length@ytickValues, ytickValues}];
xtick = Transpose[{Range@Length@xtickValues, xtickValues}];

MatrixPlot[Values@data[[All, 2 ;;]], FrameTicks -> {{ytick, None}, {None, xtick}}]

enter image description here

POSTED BY: Rohit Namjoshi

enter image description here

POSTED BY: Tsai Ming-Chou
Posted 3 years ago

Not sure what you mean by

Is it possible to adjust the width of individual cells?

You can use the AspectRatio option to change the relative width and height of the cells.

You can use

Mesh -> All,
MeshStyle -> Directive[Thickness[.005], White],

to add a uniform spacing between cells.

Also not sure what you mean by

For example, the label string length in the last line is greater than the other line

Do you mean that y4 is wider than y1? If so, you could try using a fixed-width font for the labels.

POSTED BY: Rohit Namjoshi

I found that Spacings is not an option for MatrixPlot.
Is it possible to adjust the width of individual cells?
For example, the label string length in the last line is greater than the other line.
3Q~~

POSTED BY: Tsai Ming-Chou
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard