Ric,

I have studied stemplots with Keith Smillie and have developed some
ugly code which has laid dormant from lack of use.

I was unaware of the Rosetta code stemplot. It is quite clean looking,
in contrast to my ugly code. But I find it does not deal well with
negative numbers. For example.

   showStemLeaf _2 4 1 8
┌──┬─────┐
│_1│8    │
│ 0│1 4 8│
└──┴─────┘

Some of the ugliness of my code is an attempt to deal with negative
numbers. A special problem for stemplots in this regard is that not
only are negatives naturally awkward as the example above shows, but
there needs to be both a +0 and a _0 stem if there are any other
negative stems, to make the graphic tell the proper story.

I say all this, but I am reluctant to publicize my ugly code at the link below.

http://www.jsoftware.com/jwiki/BrianSchott/Stemplot




On Wed, Mar 13, 2013 at 1:55 AM, Ric Sherlock <[email protected]> wrote:
> Here are both an explicit and tacit version of a stem and leaf plot verb I
> contributed to RosettaCode.
> http://rosettacode.org/wiki/Stem-and-leaf_plot#J
> On Mar 13, 2013 5:46 PM, "Kip Murray" <[email protected]> wrote:
>
>> Here is strength of materials data taken from a textbook.
>>
>>     data =:       33190 32320 23040 24050
>>     data =: data, 31860 33020 30930 30170
>>     data =: data, 32590 32030 32720 31300
>>     data =: data, 26520 30460 33650 28730
>>     data =: data, 33280 32700 32340 31920
>>
>> And here is a "stemplot" of the data
>>
>>     2 stemplot data
>>  23 0
>>  24 0
>>  25
>>  26 5
>>  27
>>  28 7
>>  29
>>  30 1 4 9
>>  31 3 8 9
>>  32 0 3 3 5 7 7
>>  33 0 1 2 6
>>
>> This is a "histogram" in which the first two data digits are labels and
>> third digits form the bars of the histogram.  The last line, beginning 33,
>> means there are data values beginning with 330 , 331, 332, and 336.  The
>> plot was originally called "stem and leaf" -- "stem" is the two-digit
>> column and "leaves" are the individual third digits.
>>
>> Your mission, should you decide to accept it, is to write verb stemplot.
>>  Above, 2 stemplot data means trim two digits from the data (that's what
>> the 2 is for), then produce the character array shown.  Assume non-negative
>> integer data.  What does your verb do with
>>
>>     _1 stemplot 2 1 4 2 6
>>
>> ?
>>
>> --Kip Murray
>> ------------------------------**------------------------------**----------
>> For information about J forums see 
>> http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/forums.htm>
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



-- 
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to