I'm looking for visualization ideas for the following data:

  • I have a $10\times 12$ grid of points $(x_i,m_j)$, where the $x_i$ are a set of distances (e.g. 1,2,..., 10 m) and the $m_j$ are the 12 months.

  • At each $(x_i,m_j)$, I have 4 values $q_1,\ldots,q_4$ which total to 1.

  • I'm trying to show how the proportion of $q_i$ varies with $x$ and $m$, so that one can see the changes across the months and distance.

To explain with some dummy data (Mathematica):

data = Table[{x m/12, x Tanh[m/6], x/m, x^2/m^2} ~Normalize~ Total, {x, 10}, {m, 12}];

For a single distance, I could do something like

BarChart[First@data, ChartLayout -> "Stacked"]


Or for a single $q_i$, I could do

BarChart[data[[;; , ;; , 1]], ChartLayout -> "Stacked"]


I could perhaps even compress the bars and stack up the 10 different distances (since it's a small number) along the Y axis to show this, but it seems overcrowded. I'm not certain a 3D bubble chart might help either.

Perhaps the simplest solution might be to have 4 plots, each showing how the respective quantity $q_i$ changes... this is certainly an option for me, but I wanted to ask if there are other better alternatives of visualizing the data.

  • 2
    $\begingroup$ A nice way to visualize three values summing to a constant is ternary scatter-plot. But you have four not three proportions adding up to 1. This makes ternary plot not applicable... but who knows? Maybe there is a way out. Ternary plot can be 3D which allows to add one additional feature. Of course it can also be coloured/poit-sized/matricized to show more continuous or categorical features. $\endgroup$
    – ttnphns
    Sep 8 '13 at 20:41
  • $\begingroup$ @ttnphns I ended up using a ternary plot – I combined two quantities that were logically similar and made it a 3 component plot. It worked out very well and the information from the visualization is quite impressive. Thanks :) $\endgroup$
    – amet
    Sep 11 '13 at 4:57

Each alternative will excel in showing some features of the data, so the "best" view depends on what question you want answered. Or you may need multiple views to answer multiple questions (preferably with software that links them together).

Below are a few alternatives. I'm not a regular Mathematica user (so there is likely a better way to make higher quality plots) and I haven't bothered with labeling or legends.

To see the distribution of each component, a series of heatmaps works well.

Table[MatrixPlot[data[[;; , ;; , q]], ColorFunctionScaling -> False, 
  ColorFunction -> Function[{z}, Hue[1, z, 0.9]]], {q, 4}]

enter image description here

If the data is really this smooth, the contour plots may work better:

Table[ListContourPlot[data[[;; , ;; , q]], ImageSize -> 250, 
  PlotRange -> {0, 1}, ColorFunctionScaling -> False, Contours -> 10, 
  ContourStyle -> None, 
  ColorFunction -> Function[{z}, Hue[1, z, 0.9]]], {q, 4}]

enter image description here

(A smoothed version of the first option, except with the Y axis reversed.)

For more precise value representation (position is more precise that color perceptually), overlaid line plots may work (one per distance value):

Table[ListLinePlot[data[[;; , ;; , q]],  PlotRange -> {0, 0.9}, 
  PlotStyle -> {Thick}, ImageSize -> 250], {q, 4}]

enter image description here

None of the above show proportions. For that you might try a 10 x 12 grid of line charts or bar charts:

Table[ListLinePlot[data[[x, m]], Axes -> None, PlotRange -> {0, 1}, 
  Filling -> Axis, ImageSize -> 35], {x, 10}, {m, 12}]

enter image description here

Table[BarChart[data[[x, m]], Axes -> None, PlotRange -> {0, 1}, 
  ImageSize -> 35, ChartStyle -> "Rainbow", 
  ChartBaseStyle -> EdgeForm[None]], {x, 10}, {m, 12}]

enter image description here

The line charts emphasize the change between consecutive q values while the bar chart has a more categorical connotation.

Finally, a similar grid of pie charts will make it easier to see certain features like whether one component has over 50% of the value at a given cell, at the expense of precision for other values.

Table[PieChart[{x m/12, x Tanh[m/6], x/m, x^2/m^2}, 
  ImageSize -> 30], {x, 10}, {m, 12}]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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