[Date Index]
[Thread Index]
[Author Index]
Re: The new (v.8.0) distribution plots using a numerical
*To*: mathgroup at smc.vnet.net
*Subject*: [mg115754] Re: The new (v.8.0) distribution plots using a numerical
*From*: Darren Glosemeyer <darreng at wolfram.com>
*Date*: Thu, 20 Jan 2011 06:27:22 -0500 (EST)
On 1/19/2011 4:29 AM, Mac wrote:
> Statistical visualisation of data has improved dramatically in v 8.0
> and provide a very useful way of summarising statistical uncertainty
> in measurements or simulations. I've been particularly impressed with
> the types of graphs that can be produced using the BoxWhiskerChart[]
> or DistributionChart[] functions.
>
> Unfortunately I've been frustrated with the lack of support of these
> functions for typical plots of time series or variables which have
> either a numerical or date X-axis. Imagine for instance that you would
> like to plot the distribution of temperatures within a 24 period and
> plot these either in terms of date and/or day of the year, and going
> further compare these to another time series of measurements. It is
> not possible to specify an X-coordinate for each BoxWisker or
> DistributionChart.
>
> In short, what I would like to achieve is something like this
>
> data = Table[RandomReal[ExponentialDistribution[1], 10], {10}];
> DistributionChart[data, ChartStyle -> 47,
> ChartElementFunction -> "PointDensity"]
>
> with an X-axis which is either a number (e.g. day of the year) or even
> better a date. I would anticipate that this can be achieved either
> playing around with the ChartLabel[] function or (more generally)
> using the PlotMarker[] functionality as this would allow the
> superposition of several time series, but I've made little progress
> here.
>
> Your help would be much appreciated.
>
> Mac
>
This can be accomplished by storing the date and list of values for that
date (for instance) together and picking the appropriate parts of the
data. The following labels by day of week.
data = Table[{{2011, 1, i}, RandomReal[ExponentialDistribution[1], 10]},
{i, 10}];
DistributionChart[data[[All, 2]], ChartStyle -> 47,
ChartElementFunction -> "PointDensity",
ChartLabels -> Table[DateString[j, "DayNameShort"], {j, data[[All, 1]]}]]
Your data may need a little processing first to get the individual dates
and associated data, though. For instance, if the measurements are
stored as pairs of dates and numbers, you could first group by date and
then proceed as above. The following does that but labels with month/day
instead of day of week.
(* make a bunch of {date, number} pairs*)
data2 = Table[{{2011, 1, RandomInteger[{1, 10}]},
RandomVariate[ExponentialDistribution[1]]}, {i, 100}];
(* group them by their date coordinates, then construct {date,
listOfValuesForThatDate} pairs and sort to order by the date lists *)
data2 = Sort[Map[{#[[1, 1]], #[[All, 2]]} &, GatherBy[data2, First]]];
DistributionChart[data2[[All, 2]], ChartStyle -> 47,
ChartElementFunction -> "PointDensity",
ChartLabels -> Table[DateString[j, {"MonthShort", "/", "DayShort"}],
{j, data2[[All, 1]]}]]
Darren Glosemeyer
Wolfram Research
Prev by Date:
**Re: moving equations between Mathematica and TeXShop**
Next by Date:
**Re: Using FindRoot on an equation involving Log terms**
Previous by thread:
**Re: DesignerUnits: Gallons divided by km yields an area.**
Next by thread:
**Re: Do I need MathLink to run finite-difference fast enough**
| |