Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Mathematica has very powerful visualization techniques. However, I'm at a loss at how to best make the following chart readable.

BarChart3D[{viewerCount1, viewerCount2, viewerCount3}, 
 ChartLabels -> {Placed[{word1, word2}, None], 
   Placed[filelist, None]}, ChartLayout -> "Grid", 
 BarSpacing -> {0.5, 0}, 
 LabelingFunction -> (Tooltip[Row[Flatten[{#3, #1}], " - "]] &)]

enter image description here

Each row (i.e. each viewerCount) is the number of times a given word appears across a large corpus of files (so if viewerCount1 was the count for the word 'coffee,' the first row would show what files are most relevant for that word at a glance). The goal is that very quickly, an archivist could see what files are best without having to parse textual data, etc. The preprocessing of all this data has taken place in Mathematica so I would like to keep visualizations in there too (as opposed to learning Processing or another language).

There are 385 files being searched here, so each of those is a long list of numbers.

I have terrible handwriting, I'm afraid, but here is what I have been trying to create:

enter image description here

What's different in my 'dream' rather than what I have?

  • Bars are more distinctive, not as flimsy
  • If the value is zero, still see a little flag rectangle that can draw user to tooltip it
  • spacing between the different rows, just to visually distinguish them

I suspect BarChart3D isn't the best command for this, but I've struggled to get other visualization techniques working. Alternatively, perhaps the problem with this visualization lies before the visualization stage itself...

An Appendix for convenience:

viewerCount1={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 1, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 10, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 1, 8, 0, 2, 0, 0, 0, 4, 0, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 9, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 3, 2, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 3, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 1, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}
share|improve this question
1  
Wouldn't something like an ArrayPlot be better? In my field, we consider 3d bar and ribbon charts to be evil. –  Verbeia Feb 17 '12 at 21:09
    
@Verbeia This is an interesting suggestion.. I've never used ArrayPlot. I will check it out shortly to see what I can make of it.. –  programming_historian Feb 17 '12 at 21:41

2 Answers 2

up vote 3 down vote accepted

It seems to me that the zeros take up a lot of space and, if I understand the problem correctly, they aren't very useful in determining which works best match a particular search.

Here is an alternative visualization that allows you to set thresholds on some basic statistics which ultimately allows you to "zoom in" on the works that are a best match under certain criteria. Note that it will drop any works where all word counts are zero (you can of course adjust this).

viewerCount2 = RandomChoice[viewerCount1, Length[viewerCount1]];
viewerCount3 = RandomChoice[viewerCount1, Length[viewerCount1]];

Manipulate[
 BarChart[Map[
   Tooltip[Most[#], Row[{"Work: ", Last[#], " Counts: ", Most[#]}]] &,
    DeleteCases[
    Transpose@{viewerCount1, viewerCount2, viewerCount3, 
      Range[Length[viewerCount1]]}, {x__, w_} /; 
     Max[x] <= max || Mean[{x}] <= mean]], ChartLayout -> "Stacked", 
  ChartLegends -> {"word1", "word2", "word3"}], {max, 0, 20, 
  1}, {mean, 0, 10}]

enter image description here

share|improve this answer
    
This looks really promising! I'm going to plug it into my work and see how it turns out (as soon as I can get back to my office). –  programming_historian Feb 17 '12 at 19:14
    
Accepted! I just want to again thank you for this: it's an approach that I hadn't thought, and the ability to quickly 'zoom into' the information lends itself really well to vividly showing what I want to do. –  programming_historian Feb 17 '12 at 23:46
    
Glad it served your purposes! –  Andy Ross Feb 17 '12 at 23:56

Although Andy's answer is certainly a good fit for your specific purposes, I would like to add some alternatives to illustrate why 3D charts are almost always useless for scientific research purposes. The 3D bar chart in your question is never going to be readable because there will always be issues of bars being obscured by the bars in front. The dimensions of the 3D bars do not convey information and neither does the color of the bar - only the position of the bar and its height. So much of the graphical complexity has no informational purpose.

Even aside from the data-reduction techniques such as Andy used, there are clearer and simpler ways to visualise data of this kind.

Taking your example data from your Appendix and using Andy's approach to generate two additional data sets for other "words":

viewerCount2 = RandomChoice[viewerCount1, Length[viewerCount1]];
viewerCount3 = RandomChoice[viewerCount1, Length[viewerCount1]];

And set:

r = Range@Length[viewerCount1];

Now, consider the following:

You can see the zeros at the bottom of the plot.

 With[{data =  MapThread[
    Tooltip[#1, #2] &, {{viewerCount1, viewerCount2, 
      viewerCount3}, {r, r, r}}, 2]}, 
 ListPlot[data, Filling -> Axis, Frame -> True]]

enter image description here

This one doesn't explicitly show the zeros, but I think it looks better that way. Notice that you have to turn off Ticks on a BarChart where Frame->True. I am not sure why FrameTicks does not fully override in this case.

With[{data = 
   MapThread[
    Tooltip[#1, #2] &, {{viewerCount1, viewerCount2, 
      viewerCount3}, {r, r, r}}, 2]}, 
 BarChart[Transpose@data, ChartLayout -> "Stacked", Frame -> True, 
  ChartStyle -> EdgeForm[], ImageSize -> 500, AspectRatio -> 1/3, 
  PlotRangePadding -> {{1, 1}, {0, 2}}, Ticks -> None, 
  FrameTicks -> {Range[0, 400, 50], Automatic, None, None}]]

enter image description here

MatrixPlot[{viewerCount1, viewerCount2, viewerCount3}, 
 AspectRatio -> 1/5, ImageSize -> 500, PlotRangePadding -> 0]

enter image description here

All of the above three examples show all the data, unobscured, and the first two identify the file number as a tooltip (I am not sure how that would work with MatrixPlot).

For more information, I recommend any of Edward Tufte's books for some good guidelines on how to visualise data clearly. (I have some nice code for "sparklines" if anyone is interested.)

share|improve this answer
    
These are very useful, Verbeia! Thanks very much. I'd love to see the sparkline code. Also, re: Tufte, do you have a favourite one of his? I've been meaning to pick one up (part of me has been hoping he would come up to Canada soon, as you get his books w/ his workshop). –  programming_historian Feb 19 '12 at 19:53
1  
One can't go wrong with Tufte's "Beautiful Evidence" –  Jagra Apr 24 '12 at 17:29
    
@Jagra Speak of the devil - I have just been trying to decide which Tufte book to put an order in for. Would you recommend "Beautiful Evidence" over his earlier two canonical works? –  programming_historian Apr 24 '12 at 22:12
    
I've learned things from all of his books and recommend getting them all, but if I could only take one to a desert island, I'd take "Beautiful Evidence". Tufte has a website with a wide range of interesting discussions: edwardtufte.com/tufte –  Jagra Apr 26 '12 at 16:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.