3
$\begingroup$

I'm using a Dataset

ds = Dataset@*Map[AssociationThread[{"ID", "Date", "Value1", "Value2", 
    "Value3"} -> #] &]@
{{"C9",SQLDateTime[{2012, 12, 11, 0, 0, 0.}], 1., 31., 37.}, 
{"C9",SQLDateTime[{2013, 1, 22, 0, 0, 0.}], 1., 139., 31.},
{"C9",SQLDateTime[{2013, 2, 19, 19, 30, 0.}], Null, 720., 19.},
{"C9",SQLDateTime[{2013, 3, 8, 19, 40, 0.}], Null, 720., 28.},
{"C9",SQLDateTime[{2013, 4, 2, 21, 50, 0.}], Null, 720., 42.},
{"C10",SQLDateTime[{2012, 12, 12, 0, 2, 0.}], 1., 30., 33.},
{"C10",SQLDateTime[{2013, 1, 28, 9, 25, 0.}], 1., 123.9, 40.},
{"C10",SQLDateTime[{2013, 3, 21, 20, 0, 0.}], Null, 720., 23.},
{"C10",SQLDateTime[{2013, 5, 24, 19, 45, 0.}], Null, 786., 40.},
{"C10",SQLDateTime[{2013, 6, 1, 17, 0, 0.}], Null, 786.2, 35.},
{"C11",SQLDateTime[{2012, 12, 10, 10, 0, 0.}], 1., 30., 27.},
{"C11",SQLDateTime[{2013, 1, 23, 20, 50, 0.}], 1., 139., 32.},
{"C11",SQLDateTime[{2013, 1, 25, 21, 0, 0.}], 2, 720., 41.},
{"C11",SQLDateTime[{2013, 4, 24, 20, 35, 0.}], Null, 732., 42.},
{"C11",SQLDateTime[{2013, 5, 4, 22, 0, 0.}], Null, 786., 18.},
{"C11",SQLDateTime[{2013, 8, 27, 6, 40, 0.}], Null, 720., 28.}}

and produce a group of histograms by

hist = ds[GroupBy[Key["Value1"]], Histogram[#, {15, 45, 5}] &,"Value3"]

enter image description here

I know, that I can display one of these Histograms like here: enter image description here

My question is now, how to compare two of these histograms? For instance via PairedHistogram in order to make them better comparable. But neither with PairedHistogram nor like this: Histogram[{ha,hb}] it works.

Does anybody have an idea?

$\endgroup$
  • $\begingroup$ Histogram is for plotting. To get the data instead, you might want to use HistogramList or BinCounts. $\endgroup$ – Szabolcs Nov 17 '14 at 11:55
  • $\begingroup$ @Szabolcs I reformulated my question. I don't want to get the data, but compare the histograms in a graphical way. $\endgroup$ – Lea Nov 18 '14 at 12:45
4
$\begingroup$

Perhaps

PairedHistogram[Sequence@@#, {15,45,5}]&/@
      Subsets[Normal@(Values@ds[GroupBy[Key["Value1"]],All,"Value3"]),{2}]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you, that works! Even if I did not understand your suggestion in every detail at the moment, I have still a lot to learn. $\endgroup$ – Lea Nov 18 '14 at 19:23
  • $\begingroup$ Especially the Normal did help me a lot, since with its help I can use the data also with more than one datasets in Histogram. $\endgroup$ – Lea Nov 18 '14 at 20:45

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.