# MatrixPlot for DFT in black and white with ContourLabel

I have several data files such as this:

{{0, 2.86088, 4.44366, 50.9516, 3.26578, 3.76921, 10.2211}, {0.382102,
0.399499, 0.633217, 0.458334, 0.772598, 1.04943,
0.245786}, {2.17053, 0.753159, 1.57424, 0.378372, 0.82554, 0.651859,
0.571577}, {50.5039, 3.35749, 1.70239, 0.205699, 2.27276, 1.42459,
7.90045}, {1.47175, 0.712629, 0.842982, 0.220806, 0.294048, 0.21267,
0.166509}, {0.814432, 1.12644, 0.729741, 0.788745, 0.183342,
0.248011, 0.180827}, {10.4399, 1.53087, 1.52872, 8.1604, 0.480033,
0.538012, 1.29091}}


These are discrete fourier transform frequency values. When I plot them with MatrixPlot on mathematica 8.0, I get this:

Now this is what I would like to do and I got the idea from reading about plotting with tooltips and the ContourLabel option in Mathematica:

1. I would like my MatrixPlot to be in black and white/monochrome. This is because I would like to include these plots in journal publications and save money over having color images (It's \$325 per color image on Physics of fluids for instance). I have tired the ColorFunction->"Monochrome" option with MatrixPlot and have also tried ArrayPlot to get black and white spots instead of the orange and yellow spots that I have.

2. Can I have an option like ContourLabel for MatrixPlot so that I can entirely circumvent having a color bar?

3. To those of you who have published with plots from Mathematica 8.0, what would you do?

4. I have access to Mathematica 8.0 right now and for convenience I would like to stick to that.

I have tried to search around here but didn't find an answer that would suit my needs. Having said that, please feel free to yell at me if I didn't search hard enough!

• Use ArrayPlot. Also this: How to save plots in grayscale – rm -rf Mar 18 '13 at 16:03
• @rm-rf I used ArrayPlot. All I get now is dark blobs. I am fine with that as it suits my needs. However, how do I mark individual points on this plot now? – dearN Mar 18 '13 at 16:05
• ArrayPlot@mat should give you mostly white blobs. Using it with ColorFunction -> GrayLevel will give you black blobs. Also, see this answer (and the one under it) for marking individual points on the squares. – rm -rf Mar 18 '13 at 16:06
• @rm-rf Wow this seems ridiculously complicated enough to be a mini project! – dearN Mar 18 '13 at 16:24
• Actually, it's not... it should be pretty simple. You have all the ingredients in the two answers above, and they should all work with mma 8 and older. In any case, if you're trying to make publication quality graphics, better to spend some time getting it right than do a rush job :). BTW, a lot of my journals do not require me to send in a grayscale graphics. They use color for the online version and they do the conversion to B&W for print. You might want to check with yours if they do that. – rm -rf Mar 18 '13 at 16:26

Something like this?

mat = RandomReal[1, {5, 10}]

max = Max[mat]

ArrayPlot[Reverse@mat,
Epilog -> {MapIndexed[{If[#1 < .5 max, Black, White],
Text[#1, Reverse[#2], {1.2, 1.2}]} &, mat, {2}]},
FrameTicks -> True]


Is this what you mean by wanting to add ContourLabels?

• Yes. That is what I meant. – dearN Mar 18 '13 at 18:00
• So this displays numbers for all those values that are less than 0.5 the Maximum of mat? How can I change the number of decimal points? – dearN Mar 20 '13 at 15:30
• @drN This displays numbers for all elements ... just look at the figure, don't all of them have numbers? Regarding your other question, see mathematica.stackexchange.com/questions/8923/… – Szabolcs Mar 20 '13 at 15:32
• clearly, I was not thinking! – dearN Mar 20 '13 at 15:52