Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10162

Re: Creating Histogram-Data from X,Y,Z-Data

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Creating Histogram-Data from X,Y,Z-Data
Date 2012-05-20 06:35 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jpa3cd$45i$1@smc.vnet.net> (permalink)
References <201205190947.FAA27157@smc.vnet.net>

Show all headers | View raw


Not sure I understood completely. Perhaps this:

convert[x_?MatrixQ, z : _Integer : 1] :=
 Flatten[Table[Most[#], {Last[#]/z}] & /@ x, 1]

data1 = {{1, 2, 3}, {4, 5, 6}};

cd1 = convert[data1]

{{1, 2}, {1, 2}, {1, 2}, {4, 5}, {4, 5}, {4, 5}, {4, 5}, {4, 5}, {4, 5}}

data2 = {{1, 2, 4}, {4, 5, 6}};

cd2 = convert[data2, 2]

{{1, 2}, {1, 2}, {4, 5}, {4, 5}, {4, 5}}


Bob Hanlon


On Sat, May 19, 2012 at 5:47 AM, Andre Koppel <akoppel@akso.de> wrote:
> Hi All,
> I do have some Data like the following:
> {{1, 2, 3}, {4, 5, 6}}
> To use a histogram-function (like Histogram3D) I need to transform this
> into a list like:
> {{1,2}, {1,2}, {1,2}, {4,5}, {4,5}, {4,5}, {4,5}, {4,5}, {4,5}}
> This means "Create an X/Y-Pair for each Z-Value. Possibly with an
> optional Z-Step. Second Example (Z-Step: 2)
> {{1, 2, 4}, {4, 5, 6}}
> Would result in:
> {{1, 2}, {1, 2}, {4,5}, {4,5}, {4,5}}
> Did anybody know a simple converting-Function?
> Kind regards
> Andre
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Creating Histogram-Data from X,Y,Z-Data Bob Hanlon <hanlonr357@gmail.com> - 2012-05-20 06:35 +0000

csiph-web