octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Candidate stem-and-leaf plot function


From: Daniel J Sebald
Subject: Re: Candidate stem-and-leaf plot function
Date: Sat, 26 Jan 2013 17:33:37 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 01/26/2013 04:42 PM, Michael D. Godfrey wrote:
Dan,

I thought about the ability to produce a figure in PDF (or other) format.

Attached is a simple function which does this using enscript. I am
not sure if enscript is a current dependency. but if so some other
format conversion program could be used.

I installed enscript. enscript appears to be a GNU program, so the GNU folks probably would be happy it's used. I would say in this case, given the limited nature of stemleaf() at this point that rather than a dependency, do a system check in the script file for the program using the version option

[sebald]$ enscript -V
GNU Enscript 1.6.5.2
Copyright (C) 1995-2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
etc.

So before calling the enscript command, first check for its existence and if the system() command is an error instead of a sensible output about GNU Enscript, then issue a message to the Octave command line about requiring and installing GNU Enscript. If everything checks out, then issue the command via system() as you've done.


 This avoids the complexity
of the full plotting path.

True, but it doesn't offer features such as titles and keys, but yes that would be a bit more of a project than desired at the moment. Regarding Carnë's comment, I would consider it a plot. I can recall the days when dot-matrix printers were used to create even Cartesian plots, as crude as that was. We have histogram plots

 -- Function File:  hist (Y, X, NORM)
     Produce histogram counts or plots.

and the stem-and-leaf plot is similar. One could imagine dual-data plots where next to one another are color coded stems for the different data sets just like a histogram might have color coded, interleaved bins--and a key to go along with it.


 Again, of course, this function could be made
more elaborate. enscript has LOTS of options. These could be passed
as an argument in show_plot(). If this approach lots OK I can add that
or other options, like any of the other output formats provided by
enscript.

I think it is a good start to use Enscript. However, I'd suggest rather than "show_plot()", simply incorporate that code into the "stemleaf" function with option "enscript". Some options would be:

"enscript"
   "text"
   "pdf"
     "trim"
   "ps"
     "trim"
   "eps"
     "trim"

Rather than creating a text, pdf and ps I think just one of formats is fine. Don't want to make things too messy in the user's directory. The "trim" option would put tight bounding boxes around the output. Enscript doesn't appear to have that, but one of the PostScript utilities such as ps2pdf, ps2eps, should.

If you get things to that point, a nice self-contained routine that provides a bit of output, it's a good start.


Also, just to make sure it is noticed I changed the name to: stemleaf()

OK, seems like the natural choice.

Dan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]