I previously received assistance here in constructing a Manipulate image that allows me to overlay plots of different data sets and toggle them on and off as needed, as shown below.

enter image description here

Since then, I have used TabView in an attempt to do a similar process with histograms, except with a total of 6 plots per 1 data set. Examples are shown below.

enter image description here

enter image description here

Each data set has a tab, with each tab having 2 sub-tabs containing different representations of the data as well as some statistics about the data. This seemed to be a very clean solution to the problem of not being able to work with BarChart and Histogram nicely in Manipulate in my few attempts.

However, I'm now looking to emulate the functionality of the Manipulate plot (figure 1) with the Histogram/BarChart plots (figures 2,3).

Is it possible to add another layer to the TabView to allow the combination of data sets (say I want Proposal 1 and Proposal 3 data at the same time, the histogram/bar chart views would represent the combined data)? Is it something that would need to be re-built from the ground up in Manipulate? If so, does anyone have any ideas? I moved to TabView for the second charts because I couldn't get Manipulate to work as intended in the first place...

I created a very stripped down version of the code with only the histogram calculations, but it is still obnoxiously long so I have paste it into a codepad.org link as plaintext here: http://codepad.org/kBxphb7U

The two sample data sets are the same but really I'm testing if they can be displayed separately as well as combined so I don't think that should be a problem. If the moderators would like, I can paste it here, but it truly is overly long...

Thank you!


1 Answer 1


Here is how I'd do this. This is only a minimal example but enough for you to be able to convert the rest.

I'd make a function out of the procedure to generate plots/grid. A minimal example with one plot:

(*first run code from OP's link*)

λtimehistF[data_] := 
 BarChart[data, PlotRangePadding -> {{.1, 0.3}, {45, Max[data]/4}}, 
  ImageSize -> ImgSize, 
  LabelingFunction -> (Placed[Rotate[#, π/3], Above] &), 
  Frame -> True, 
  FrameLabel -> {Style["λ bins", Bold], 
    Style["Total time (ks)", Bold]}, 
  PlotLabel -> Style["Total Time vs. λ", Bold], 
  ChartStyle -> Darker[Green], BarSpacing -> Medium]

And I'd replace the outer TabView with a TogglerBar + Dynamic[plotsgrid]

  {panes={1},switchFinished=False, data,coordinatesView,pitchView}
, Column[{
        Dynamic[panes, (panes=#/.{}->{1};switchFinished = False )&]
      , {1,2}
    , If[
        Not @ switchFinished
      , data = Join @@ (λtimedata /@ panes)
      ; coordinatesView =λtimehistF[data]
      ; switchFinished=True
    , SynchronousUpdating->False
    , TrackedSymbols:>{switchFinished}
  , Panel@TabView[{
      "Coordinate View"-> Dynamic[
        , Pane[ProgressIndicator[Appearance->"Percolate"]
          , ImgSize{1,1/GoldenRatio}
          , Alignment->Center
        , coordinatesView
      , TrackedSymbols:>{coordinatesView,switchFinished}
    , "Pitch View"->"you can do an analogous thing here too"
    }, ImageSize->All]
, UnsavedVariables:>{data,coordinatesView,pitchView}

enter image description here

DynamicWrapper is used to make a queued controller from TogglerBar, see: How to Initiate a queued evaluation from a Dynamic GUI without using a Button

  • $\begingroup$ As usual, I really appreciate your elegant solution. I've spent some time looking over this and I genuinely would never have gotten to this solution with my working knowledge of mathematica. Thank you so much! $\endgroup$
    – Ed McClain
    Commented Feb 21, 2018 at 17:07

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