MatrixPlot for DFT in black and white with ContourLabel

3

1

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:

enter image description here

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!

dearN

Posted 2013-03-18T15:57:58.283

Reputation: 5 283

Use ArrayPlot. Also this: How to save plots in grayscale

– rm -rf – 2013-03-18T16:03:45.180

@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 – 2013-03-18T16:05:33.030

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 – 2013-03-18T16:06:34.637

@rm-rf Wow this seems ridiculously complicated enough to be a mini project! – dearN – 2013-03-18T16:24:34.250

3Actually, 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 – 2013-03-18T16:26:47.653

@rm-rf Thank you for the encouragement and also the vital information that some journals perhaps would do their own color-B&W thingy! – dearN – 2013-03-18T16:28:37.967

Answers

2

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]

Mathematica graphics

Is this what you mean by wanting to add ContourLabels?

Szabolcs

Posted 2013-03-18T15:57:58.283

Reputation: 213 047

Yes. That is what I meant. – dearN – 2013-03-18T18:00:53.780

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 – 2013-03-20T15:30:20.000

@drN This displays numbers for all elements ... just look at the figure, don't all of them have numbers? Regarding your other question, see http://mathematica.stackexchange.com/questions/8923/formatting-a-number-with-fixed-number-of-significant-digits

– Szabolcs – 2013-03-20T15:32:52.670

clearly, I was not thinking! – dearN – 2013-03-20T15:52:07.867