MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: [Q] 2D graphic routines and data sets in 2D lists

  • To: mathgroup at
  • Subject: [mg18449] Re: [mg18374] [Q] 2D graphic routines and data sets in 2D lists
  • From: BobHanlon at
  • Date: Wed, 7 Jul 1999 00:11:33 -0400
  • Sender: owner-wri-mathgroup at

In a message dated 6/30/99 11:10:43 PM, dtruong at writes:

>This is an annoyance I've met with many (not all)
>List* graphic routines : data sets cannot be encompassed
>in a single list. I propose a fix, but I'd like to
>know if someone has something cleaner.
>Here's an example:
>It's specified that PercentileBarChart[] uses
>1D lists. So this works:
>x = PercentileBarChart[
>	{1,2,3}, {2,3,4}]
>but this won't:
>x = PercentileBarChart[
>	{ {1,2,3}, {2,3,4} }]
>When data is built elsewhere, this is an annoyance, ie:
>Foo = { {1,2,3}, {2,3,4} };
>One can write the following, but it's not automatable,
>because it's impossible to dynamically build expressions
>with commas (if someone know how to I'm very interrested):
>PercentileBarChart[ Foo[[1]], Foo[[2]] ];
>The solution is to flatten out the outermost list to remove
>it, but it is impossible directly on Foo. My solution is to
>tweak the procedure call after its built:
>It works, but it's ugly, esp. if the graphic routine
>is complex (ie many optional paramters set, etc.), Furthermore
>it's quite akward to code generic routines like that.
>Is there a nicer/cleaner fix than that ? If not, maybe 
>Wolfram people should do something about this in future 
>releases of the toolboxes... :( More so that the { {}, {} }
>are not interpreted therefore do not conflict with any
>other declaration formats.


foo = { {1, 2, 3}, {2, 3, 4} };

To remove the outer brackets just Apply Sequence to foo, i.e., 

PercentileBarChart[Sequence @@ foo];

If you want to avoid having to do this, define modified graphics functions 
such as

myPercentileBarChart[vect__?VectorQ, opts___?OptionQ] := 
    PercentileBarChart[vect, opts];
myPercentileBarChart[vect__List, opts___?OptionQ] := 
    PercentileBarChart[Sequence @@ vect, opts];


Bob Hanlon

  • Prev by Date: RE: Plot vs FindMinimum
  • Next by Date: Extract is slow in Mathematica 4 on PPC
  • Previous by thread: Integration of Oscillating Function
  • Next by thread: Re: [Q] 2D graphic routines and data sets in 2D lists