13
$\begingroup$

I am preparing some data for dissemination. I have a series of plots that look like so, using ListLinePlot:

enter image description here

The background shading is just being added using Mathematica's drawing tools. However, the following visualization (a 3D Histogram) does not offer similar functionality.

Here is the dataset that I am using (I apologize for the length, but hopefully the code box is OK):

dataHistogramSet = {{{1997, 0}, {1997, 0}, {1997, 0}, {1997, 
     0}, {1997, 0}, {1997, 2}, {1997, 0}, {1997, 0}, {1997, 0}, {1997,
      0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 
     0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997,
      0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 
     0}, {1997, 1}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997,
      0}, {1997, 16}, {1997, 0}, {1997, 1}, {1997, 0}, {1997, 
     0}, {1997, 0}, {1997, 5}, {1997, 0}, {1997, 5}, {1997, 0}, {1997,
      0}, {1997, 5}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 
     0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997,
      0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 
     0}, {1997, 2}, {1997, 0}, {1997, 0}, {1997, 3}, {1997, 0}, {1997,
      0}, {1997, 6}, {1997, 0}, {1997, 1}, {1997, 0}, {1997, 
     0}, {1997, 4}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 
     62}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 1}, {1997, 
     0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997, 0}, {1997,
      0}, {1997, 0}}, {{1998, 0}, {1998, 0}, {1998, 0}, {1998, 
     0}, {1998, 0}, {1998, 0}, {1998, 1}, {1998, 19}, {1998, 
     0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998,
      0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998, 
     0}, {1998, 0}, {1998, 1}, {1998, 32}, {1998, 0}, {1998, 
     0}, {1998, 0}, {1998, 0}, {1998, 6}, {1998, 1}, {1998, 2}, {1998,
      0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998, 
     0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998, 3}, {1998, 0}, {1998,
      0}, {1998, 1}, {1998, 0}, {1998, 0}, {1998, 0}, {1998, 
     0}, {1998, 2}, {1998, 0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998,
      0}, {1998, 0}, {1998, 2}, {1998, 0}, {1998, 0}, {1998, 
     0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998, 0}, {1998,
      0}, {1998, 1}, {1998, 0}, {1998, 3}}, {{1999, 0}, {1999, 
     0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999,
      0}, {1999, 0}, {1999, 0}, {1999, 3}, {1999, 0}, {1999, 
     82}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 7}, {1999, 
     0}, {1999, 0}, {1999, 25}, {1999, 9}, {1999, 0}, {1999, 
     0}, {1999, 0}, {1999, 20}, {1999, 0}, {1999, 0}, {1999, 
     0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999,
      0}, {1999, 1}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 
     0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 
     33}, {1999, 0}, {1999, 0}, {1999, 23}, {1999, 0}, {1999, 
     0}, {1999, 0}, {1999, 60}, {1999, 0}, {1999, 11}, {1999, 
     0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999,
      0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 
     0}, {1999, 0}, {1999, 0}, {1999, 3}, {1999, 0}, {1999, 3}, {1999,
      0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 2}, {1999, 
     2}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999, 0}, {1999,
      0}, {1999, 0}}, {{2000, 0}, {2000, 0}, {2000, 0}, {2000, 
     0}, {2000, 0}, {2000, 0}, {2000, 254}, {2000, 4}, {2000, 
     0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 8}, {2000, 0}, {2000,
      0}, {2000, 14}, {2000, 0}, {2000, 0}, {2000, 12}, {2000, 
     72}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 
     0}, {2000, 0}, {2000, 4}, {2000, 0}, {2000, 0}, {2000, 0}, {2000,
      0}, {2000, 0}, {2000, 22}, {2000, 0}, {2000, 0}, {2000, 
     0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000,
      2}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 
     0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 8}, {2000,
      0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 
     8}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000,
      0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 0}, {2000, 
     0}}, {{2001, 0}, {2001, 5}, {2001, 3}, {2001, 0}, {2001, 
     0}, {2001, 23}, {2001, 0}, {2001, 0}, {2001, 1}, {2001, 
     0}, {2001, 0}, {2001, 0}, {2001, 0}, {2001, 4}, {2001, 
     13}, {2001, 0}, {2001, 0}, {2001, 0}, {2001, 0}, {2001, 
     0}, {2001, 0}, {2001, 0}, {2001, 0}, {2001, 0}, {2001, 0}, {2001,
      0}, {2001, 0}, {2001, 16}, {2001, 0}, {2001, 0}, {2001, 
     0}, {2001, 23}, {2001, 0}, {2001, 4}, {2001, 0}, {2001, 
     0}, {2001, 0}, {2001, 9}, {2001, 0}, {2001, 0}, {2001, 0}, {2001,
      0}, {2001, 1}, {2001, 0}, {2001, 3}, {2001, 5}, {2001, 
     0}, {2001, 28}, {2001, 0}, {2001, 0}, {2001, 0}, {2001, 
     0}, {2001, 10}, {2001, 0}, {2001, 0}, {2001, 0}, {2001, 
     71}, {2001, 0}, {2001, 0}, {2001, 51}, {2001, 2}, {2001, 
     0}, {2001, 0}, {2001, 0}, {2001, 0}, {2001, 0}, {2001, 0}, {2001,
      0}, {2001, 0}, {2001, 0}, {2001, 0}, {2001, 0}, {2001, 
     0}}, {{2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 
     0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 6}, {2002, 0}, {2002,
      0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 
     26}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 
     0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002,
      0}, {2002, 2}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 
     0}, {2002, 21}, {2002, 0}, {2002, 15}, {2002, 0}, {2002, 
     0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002,
      5}, {2002, 1}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 
     0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002,
      0}, {2002, 3}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 
     0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002,
      0}, {2002, 5}, {2002, 0}, {2002, 2}, {2002, 1}, {2002, 
     1}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002, 0}, {2002,
      0}, {2002, 0}, {2002, 2}}, {{2003, 0}, {2003, 1}, {2003, 
     0}, {2003, 0}, {2003, 15}, {2003, 0}, {2003, 0}, {2003, 
     0}, {2003, 18}, {2003, 0}, {2003, 0}, {2003, 2}, {2003, 
     0}, {2003, 0}, {2003, 6}, {2003, 0}, {2003, 0}, {2003, 0}, {2003,
      0}, {2003, 6}, {2003, 0}, {2003, 0}, {2003, 0}, {2003, 
     98}, {2003, 0}, {2003, 11}, {2003, 0}, {2003, 0}, {2003, 
     0}, {2003, 2}, {2003, 4}, {2003, 0}, {2003, 0}, {2003, 3}, {2003,
      1}, {2003, 15}, {2003, 3}, {2003, 0}, {2003, 0}, {2003, 
     0}, {2003, 5}, {2003, 0}, {2003, 0}, {2003, 0}, {2003, 0}, {2003,
      26}, {2003, 0}, {2003, 0}, {2003, 0}, {2003, 0}, {2003, 
     0}, {2003, 1}, {2003, 0}, {2003, 0}, {2003, 4}, {2003, 0}, {2003,
      0}, {2003, 0}, {2003, 19}, {2003, 1}, {2003, 0}, {2003, 
     0}, {2003, 0}, {2003, 6}, {2003, 0}, {2003, 0}, {2003, 0}, {2003,
      0}, {2003, 0}, {2003, 0}, {2003, 0}, {2003, 0}, {2003, 
     0}, {2003, 4}, {2003, 0}, {2003, 0}, {2003, 0}, {2003, 0}, {2003,
      0}, {2003, 0}, {2003, 0}, {2003, 0}, {2003, 0}, {2003, 
     0}, {2003, 0}, {2003, 0}, {2003, 0}, {2003, 0}, {2003, 
     7}}, {{2004, 0}, {2004, 0}, {2004, 0}, {2004, 0}, {2004, 
     0}, {2004, 0}, {2004, 0}, {2004, 0}, {2004, 0}, {2004, 
     30}, {2004, 0}, {2004, 0}, {2004, 0}, {2004, 0}, {2004, 
     0}, {2004, 0}, {2004, 0}, {2004, 0}, {2004, 6}, {2004, 
     20}, {2004, 0}, {2004, 0}, {2004, 0}, {2004, 0}, {2004, 
     0}, {2004, 0}, {2004, 4}, {2004, 0}, {2004, 0}, {2004, 0}, {2004,
      2}, {2004, 0}, {2004, 0}, {2004, 1}, {2004, 0}, {2004, 
     2}, {2004, 0}, {2004, 0}, {2004, 2}, {2004, 0}, {2004, 
     46}, {2004, 6}, {2004, 0}, {2004, 0}, {2004, 0}, {2004, 
     107}, {2004, 0}, {2004, 1}, {2004, 0}, {2004, 0}, {2004, 
     0}, {2004, 1}, {2004, 5}, {2004, 0}, {2004, 0}, {2004, 0}, {2004,
      0}, {2004, 5}, {2004, 0}, {2004, 0}, {2004, 0}, {2004, 
     0}, {2004, 0}, {2004, 8}, {2004, 0}}, {{2005, 0}, {2005, 
     0}, {2005, 0}, {2005, 6}, {2005, 0}, {2005, 0}, {2005, 0}, {2005,
      4}, {2005, 0}, {2005, 0}, {2005, 0}, {2005, 23}, {2005, 
     140}, {2005, 0}, {2005, 1}, {2005, 1}, {2005, 0}, {2005, 
     0}, {2005, 0}, {2005, 0}, {2005, 0}, {2005, 0}, {2005, 2}, {2005,
      0}, {2005, 0}, {2005, 0}, {2005, 0}, {2005, 0}, {2005, 
     0}, {2005, 13}, {2005, 0}, {2005, 2}, {2005, 0}, {2005, 
     9}, {2005, 0}, {2005, 0}, {2005, 0}, {2005, 0}, {2005, 0}, {2005,
      2}, {2005, 5}, {2005, 0}, {2005, 9}, {2005, 2}, {2005, 
     2}, {2005, 0}, {2005, 4}, {2005, 0}, {2005, 16}, {2005, 
     0}, {2005, 7}, {2005, 0}, {2005, 0}, {2005, 3}, {2005, 0}, {2005,
      0}, {2005, 0}, {2005, 1}, {2005, 0}, {2005, 0}, {2005, 
     3}, {2005, 0}, {2005, 0}, {2005, 0}, {2005, 3}, {2005, 
     71}, {2005, 0}, {2005, 0}, {2005, 0}, {2005, 0}, {2005, 
     0}}, {{2006, 0}, {2006, 0}, {2006, 0}, {2006, 0}, {2006, 
     0}, {2006, 4}, {2006, 15}, {2006, 7}, {2006, 2}, {2006, 
     1}, {2006, 0}, {2006, 0}, {2006, 3}, {2006, 0}, {2006, 0}, {2006,
      0}, {2006, 0}, {2006, 0}, {2006, 0}, {2006, 2}, {2006, 
     9}, {2006, 0}, {2006, 0}, {2006, 0}, {2006, 0}, {2006, 
     97}, {2006, 0}, {2006, 4}, {2006, 0}, {2006, 0}, {2006, 
     0}, {2006, 0}, {2006, 0}, {2006, 0}, {2006, 0}, {2006, 0}, {2006,
      1}, {2006, 0}, {2006, 0}, {2006, 0}, {2006, 1}, {2006, 
     0}, {2006, 0}, {2006, 0}, {2006, 1}, {2006, 1}, {2006, 0}, {2006,
      0}, {2006, 6}, {2006, 0}, {2006, 1}, {2006, 1}, {2006, 
     8}, {2006, 0}, {2006, 0}, {2006, 0}, {2006, 0}, {2006, 2}, {2006,
      0}, {2006, 0}, {2006, 0}, {2006, 0}, {2006, 0}, {2006, 
     0}, {2006, 5}, {2006, 0}, {2006, 3}, {2006, 0}, {2006, 
     25}}, {{2007, 0}, {2007, 0}, {2007, 0}, {2007, 0}, {2007, 
     6}, {2007, 0}, {2007, 0}, {2007, 0}, {2007, 2}, {2007, 0}, {2007,
      0}, {2007, 254}, {2007, 0}, {2007, 81}, {2007, 0}, {2007, 
     0}, {2007, 0}, {2007, 2}, {2007, 6}, {2007, 18}, {2007, 
     0}, {2007, 0}, {2007, 21}, {2007, 20}, {2007, 0}, {2007, 
     0}, {2007, 7}, {2007, 0}, {2007, 0}, {2007, 0}, {2007, 6}, {2007,
      5}, {2007, 0}, {2007, 0}, {2007, 0}, {2007, 1}, {2007, 
     2}, {2007, 0}, {2007, 0}, {2007, 11}, {2007, 0}, {2007, 
     0}, {2007, 0}, {2007, 2}, {2007, 7}, {2007, 0}, {2007, 0}, {2007,
      5}, {2007, 3}, {2007, 0}, {2007, 0}, {2007, 0}, {2007, 
     0}, {2007, 0}, {2007, 0}, {2007, 0}, {2007, 0}, {2007, 0}, {2007,
      0}, {2007, 0}, {2007, 0}, {2007, 3}, {2007, 0}}, {{2008, 
     0}, {2008, 0}, {2008, 166}, {2008, 10}, {2008, 0}, {2008, 
     0}, {2008, 0}, {2008, 0}, {2008, 12}, {2008, 0}, {2008, 
     0}, {2008, 0}, {2008, 30}, {2008, 0}, {2008, 0}, {2008, 
     14}, {2008, 0}, {2008, 0}, {2008, 0}, {2008, 0}, {2008, 
     0}, {2008, 0}, {2008, 0}, {2008, 2}, {2008, 0}, {2008, 0}, {2008,
      0}, {2008, 4}, {2008, 0}, {2008, 0}, {2008, 0}, {2008, 
     0}, {2008, 0}, {2008, 0}, {2008, 48}, {2008, 0}, {2008, 
     0}, {2008, 6}, {2008, 0}, {2008, 0}, {2008, 0}, {2008, 0}, {2008,
      0}, {2008, 0}, {2008, 2}, {2008, 4}, {2008, 0}, {2008, 
     0}, {2008, 0}, {2008, 0}, {2008, 0}, {2008, 194}, {2008, 
     0}, {2008, 10}, {2008, 218}, {2008, 0}, {2008, 20}, {2008, 
     0}, {2008, 8}, {2008, 2}, {2008, 0}, {2008, 24}, {2008, 
     34}, {2008, 0}, {2008, 0}, {2008, 22}, {2008, 4}, {2008, 
     0}}, {{2009, 1}, {2009, 0}, {2009, 0}, {2009, 0}, {2009, 
     2}, {2009, 0}, {2009, 2}, {2009, 1}, {2009, 2}, {2009, 0}, {2009,
      13}, {2009, 0}, {2009, 0}, {2009, 0}, {2009, 95}, {2009, 
     12}, {2009, 1}, {2009, 0}, {2009, 1}, {2009, 0}, {2009, 
     0}, {2009, 0}, {2009, 13}, {2009, 0}, {2009, 3}, {2009, 
     0}, {2009, 0}, {2009, 0}, {2009, 0}, {2009, 0}, {2009, 0}, {2009,
      0}, {2009, 0}, {2009, 0}, {2009, 0}, {2009, 0}, {2009, 
     6}, {2009, 2}, {2009, 2}, {2009, 19}, {2009, 0}, {2009, 
     0}, {2009, 0}, {2009, 1}, {2009, 6}, {2009, 0}, {2009, 0}, {2009,
      48}, {2009, 4}, {2009, 81}, {2009, 26}, {2009, 0}, {2009, 
     0}, {2009, 0}, {2009, 34}, {2009, 133}, {2009, 0}, {2009, 
     0}, {2009, 0}, {2009, 11}, {2009, 0}, {2009, 1}, {2009, 
     0}, {2009, 0}, {2009, 0}, {2009, 6}, {2009, 19}, {2009, 
     0}, {2009, 0}, {2009, 0}}, {{2010, 0}, {2010, 17}, {2010, 
     0}, {2010, 0}, {2010, 12}, {2010, 0}, {2010, 0}, {2010, 
     32}, {2010, 0}, {2010, 2}, {2010, 1}, {2010, 0}, {2010, 
     47}, {2010, 0}, {2010, 0}, {2010, 0}, {2010, 14}, {2010, 
     0}, {2010, 0}, {2010, 3}, {2010, 0}, {2010, 3}, {2010, 
     185}, {2010, 0}, {2010, 225}, {2010, 0}, {2010, 0}, {2010, 
     0}, {2010, 7}, {2010, 0}, {2010, 0}, {2010, 0}, {2010, 9}, {2010,
      0}, {2010, 0}, {2010, 0}, {2010, 0}, {2010, 2}, {2010, 
     9}, {2010, 15}, {2010, 119}, {2010, 0}, {2010, 0}, {2010, 
     0}, {2010, 5}, {2010, 0}, {2010, 0}, {2010, 0}, {2010, 0}, {2010,
      0}, {2010, 35}, {2010, 0}, {2010, 1}, {2010, 0}, {2010, 
     0}, {2010, 0}, {2010, 0}, {2010, 0}, {2010, 5}, {2010, 0}, {2010,
      1}, {2010, 4}, {2010, 0}, {2010, 0}, {2010, 0}, {2010, 
     0}, {2010, 0}, {2010, 0}, {2010, 0}}};

and the command:

Histogram3D[dataHistogramSet, FaceGrids -> {Bottom, Front, Left}, 
ChartStyle -> "GrayTones", ViewPoint -> {2.78, 1.3, 1.43}, 
PlotLabel -> "Histogram of Dataset 1"]

enter image description here

I would like to reproduce the shading (as per the years) in this histogram: i.e. between 1997 and 2002, no background shading; between 2002 and 2005, very light shading; between 20005 and 2010, darker shading. I have searched the documentation for Histogram3D and elsewhere to no avail. Can something like this be achieved in Mathematica or do I need to do post-processing elsewhere?

$\endgroup$

4 Answers 4

15
$\begingroup$

Is this what you mean? I put different colors in the background, to make clear what I added:

Show[Histogram3D[dataHistogramSet, FaceGrids -> {Bottom, Front, Left},
   ChartStyle -> "GrayTones", ViewPoint -> {2.78, 1.3, 1.43}, 
  PlotLabel -> "Histogram of Dataset 1"],
 Graphics3D[
  Translate[{EdgeForm[],
    {Red, 
     Polygon[{{1995, 0, 0}, {1995, 0, 100}, {2002, 0, 100}, {2002, 0, 
        0}, {2002, 300, 0}, {1995, 300, 0}}]}, {Orange, 
     Polygon[{{2002, 0, 0}, {2002, 0, 100}, {2005, 0, 100}, {2005, 0, 
        0}, {2005, 300, 0}, {2002, 300, 0}}]}, {Yellow, 
     Polygon[{{2005, 0, 0}, {2005, 0, 100}, {2010, 0, 100}, {2010, 0, 
        0}, {2010, 300, 0}, {2005, 300, 0}}]}}, {0, -3, -3}]]
 ]

histogram!

$\endgroup$
4
  • $\begingroup$ This is great - I was also hoping to get the background to also extend along the 'floor' of the chart too. Apologies for not being so specific - and thanks for providing this, I'll read up on these docs. $\endgroup$ Commented May 7, 2012 at 21:21
  • $\begingroup$ OK - the trick here is to figure out what the x, y and z axis of the plot are, and then draw polygons in the same way that you probably did with your 2D example. So for the floor coloring, you'd need to make the polygons vary in the first and second coordinate, leaving the third one at 0. $\endgroup$
    – Jens
    Commented May 7, 2012 at 21:23
  • $\begingroup$ Ok, let me give it a try. With the first plots, I cheated with the 'drawing tools,' which are not enabled for Historgram3D apparently. $\endgroup$ Commented May 7, 2012 at 21:32
  • $\begingroup$ I had another suggestion - offset the background a little to avoid intersections with the histogram bars. I'll just add that to my answer and put in the additional polygon corners. $\endgroup$
    – Jens
    Commented May 7, 2012 at 21:37
11
$\begingroup$

I'm sure you'll get more sensible answers, but here's some FaceGrid abuse:

Histogram3D[dataHistogramSet, 
 FaceGrids -> 
  With[{abuse = 
     Table[{k, LightGray}, {k, 2002, 2005, 0.01}]~Join~
      Table[{k, Gray}, {k, 2005, 2010, 0.01}]},
   {{Front, {abuse, None}}, {Bottom, {abuse, None}}, Left}], 
 ChartStyle -> "GrayTones", ViewPoint -> {2.78, 1.3, 1.43}, 
 PlotLabel -> "Histogram of Dataset 1"]

Facegrid abuse

$\endgroup$
5
  • $\begingroup$ (+1) Could it be that your uploaded image isn't quite right? The overhanging bars on the left look wrong - and when I try your code the problem isn't there. $\endgroup$
    – Jens
    Commented May 7, 2012 at 21:59
  • $\begingroup$ @Jens It's what I get with that data. My version gives a histogram with a bin stretching from 2010 to 2011. $\endgroup$
    – wxffles
    Commented May 7, 2012 at 22:31
  • $\begingroup$ Ah, I think you must have been using an earlier edit of the data file... when I looked, there was no 2011 data. It's not important - just looked confusing. $\endgroup$
    – Jens
    Commented May 7, 2012 at 22:40
  • $\begingroup$ There's no 2011 data in what I was using, it's just where it decides the bin should be. $\endgroup$
    – wxffles
    Commented May 8, 2012 at 0:11
  • $\begingroup$ Hmm, does that mean it's a version-dependent difference? I have MMA version 8.0.4 and see the bins ending with 2010. Strange. $\endgroup$
    – Jens
    Commented May 8, 2012 at 0:51
8
$\begingroup$

Here is a solid variation of Jens' method that may prove useful. It is also somewhat more concise.

Show[
  Histogram3D[dataHistogramSet, FaceGrids -> {Bottom, Front, Left},
   ChartStyle -> "GrayTones", PlotLabel -> "Histogram of Dataset 1"], 
  Graphics3D[
   Translate[{EdgeForm[], Opacity[0.1],
    {Red,    Cuboid[{{1995, 0, 0}, {2002, 300, 100}}]},
    {Orange, Cuboid[{{2002, 0, 0}, {2005, 300, 100}}]},
    {Yellow, Cuboid[{{2005, 0, 0}, {2010, 300, 100}}]}}, {0, -3, -3}]]
]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ It shows what Show can do that the built-in plot options can't. $\endgroup$
    – Jens
    Commented May 8, 2012 at 3:42
3
$\begingroup$

Divide your data into 3 sets:

{data97to01, data02to05, data06to10}

or whatever years you want to include in each. Then it goes pretty simply:

Histogram3D[{data97to01, data02to05, data06to10}, 
 FaceGrids -> {Bottom, Front, Left}, 
 ChartStyle -> {Darker[Gray], Gray, White}, 
 ViewPoint -> {2.78, 1.3, 1.43}, PlotLabel -> "Histogram of Dataset"]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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