Re: [Q] 2D graphic routines and data sets in 2D lists
- To: mathgroup at smc.vnet.net
- Subject: [mg18449] Re: [mg18374] [Q] 2D graphic routines and data sets in 2D lists
- From: BobHanlon at aol.com
- Date: Wed, 7 Jul 1999 00:11:33 -0400
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 6/30/99 11:10:43 PM, dtruong at irisa.fr 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} }; >PercentileBarChart[Foo]; > >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: > >Flatten[PercentileBarChart[Foo],1,List]; > >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. > Needs["Graphics`Graphics`"]; 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]; myPercentileBarChart[foo]; Bob Hanlon