Re: [Plplot-devel] Legends

2010-10-06 Thread David MacMahon
Hi, Bill,

On Oct 6, 2010, at 8:19 , Schwab,Wilhelm K wrote:

> a performance argument is a stretch

I agree, that's why I prefaced my comments with...

>> For the smallish amounts of
>> legend text it probably doesn't matter that much either way

Since plotting is inherently much more number-heavy than text-heavy,  
this may never be an issue for plplot.  On the other hand, if it ever  
did arise, it would be nice to have a single unified approach for  
passing an array of strings instead of two different ways.

Another argument for keeping it char ** would be inertia.  It's  
already written this way ("designer's choice") so don't change it  
unless there is a compelling reason.

Dave


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Legends

2010-10-06 Thread Alan W. Irwin
On 2010-10-05 21:59-0700 David MacMahon wrote:

> Does the library strdup the passed in strings, render them before returning, 
> or just copy the pointers for later rendering?

Hi Dave:

It renders the text with

 plptex( text_x_world + text_justification * text_width0, ty,
0.1, 0.0, text_justification, text[i] );

where i is the index of the entry within the legend.  IOW, pllegend
contains a bit of low-level PLplot C library manipulation to determine
ratios of some units with others, save internal PLplot variables for
later restoration, etc., but most of it is high-level, i.e., it simply
makes calls to ordinary PLplot functionality such as plptex to get the
job done.

Alan
__
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__

Linux-powered Science
__

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Legends

2010-10-06 Thread Schwab,Wilhelm K
Dave,

I'm content to be voted down on this, but a performance argument is a stretch: 
how can one possibly fit enough legend text on a graph to cause a CPU any 
stress at all?  The first real use I made of PLplot was to plot 500,000 sample 
time series; copying a few hundred bytes (max) of text will not make a bit of 
difference by comparison.

Bill



From: David MacMahon [dav...@astro.berkeley.edu]
Sent: Wednesday, October 06, 2010 12:59 AM
To: Alan W. Irwin
Cc: Schwab,Wilhelm K; Plplot-devel@lists.sourceforge.net
Subject: Re: [Plplot-devel] Legends

On Oct 5, 2010, at 21:42 , Alan W. Irwin wrote:

> On 2010-10-05 22:19-0400 Schwab,Wilhelm K wrote:
>
>> I was interested in building it (5.9.7) to try the legend code.
>> Is there a reason for the double pointer?  It seems that
>>
>>   this part\0that part\0...\0and the last part\0\0
>>
>> would do the job just as easily??
>
> I am willing to keep an open mind about changing the
> present approach if we run into trouble interfacing const char **
> text to
> other languages.

FWIW, I vote for keeping it as char**.  For the smallish amounts of
legend text it probably doesn't matter that much either way, but with
more and/or larger strings that might come from different locations,
the cost of copying into one buffer can become significant.  Creating
an array of char* and populating with pointers into a long buffer
containing back-to-back strings is not nearly so onerous (presuming
you know how many strings you have to begin with so you can allocate
a big enough char* array).

Does the library strdup the passed in strings, render them before
returning, or just copy the pointers for later rendering?

Thanks,
Dave (who has obviously not examined the legend implementation!)


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Legends

2010-10-06 Thread Andrew Ross
On Tue, Oct 05, 2010 at 09:59:48PM -0700, David MacMahon wrote:
> 
> On Oct 5, 2010, at 21:42 , Alan W. Irwin wrote:
> 
> > On 2010-10-05 22:19-0400 Schwab,Wilhelm K wrote:
> >
> >> I was interested in building it (5.9.7) to try the legend code.   
> >> Is there a reason for the double pointer?  It seems that
> >>
> >>   this part\0that part\0...\0and the last part\0\0
> >>
> >> would do the job just as easily??
> >
> > I am willing to keep an open mind about changing the
> > present approach if we run into trouble interfacing const char **  
> > text to
> > other languages.
> 
> FWIW, I vote for keeping it as char**.  For the smallish amounts of  
> legend text it probably doesn't matter that much either way, but with  
> more and/or larger strings that might come from different locations,  
> the cost of copying into one buffer can become significant.  Creating  
> an array of char* and populating with pointers into a long buffer  
> containing back-to-back strings is not nearly so onerous (presuming  
> you know how many strings you have to begin with so you can allocate  
> a big enough char* array).
> 
> Does the library strdup the passed in strings, render them before  
> returning, or just copy the pointers for later rendering?

I second keeping it as char **. I think David has made some good points. 
Also, the char ** is a far more standard way of dealing with strings. It
is easy to split into individual strings without having to search through 
the whole array of characters. It is also much more standard and hence 
easier to interfaces with other code and also to link in with our many
language bindings.

Andrew

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Legends

2010-10-05 Thread David MacMahon

On Oct 5, 2010, at 21:42 , Alan W. Irwin wrote:

> On 2010-10-05 22:19-0400 Schwab,Wilhelm K wrote:
>
>> I was interested in building it (5.9.7) to try the legend code.   
>> Is there a reason for the double pointer?  It seems that
>>
>>   this part\0that part\0...\0and the last part\0\0
>>
>> would do the job just as easily??
>
> I am willing to keep an open mind about changing the
> present approach if we run into trouble interfacing const char **  
> text to
> other languages.

FWIW, I vote for keeping it as char**.  For the smallish amounts of  
legend text it probably doesn't matter that much either way, but with  
more and/or larger strings that might come from different locations,  
the cost of copying into one buffer can become significant.  Creating  
an array of char* and populating with pointers into a long buffer  
containing back-to-back strings is not nearly so onerous (presuming  
you know how many strings you have to begin with so you can allocate  
a big enough char* array).

Does the library strdup the passed in strings, render them before  
returning, or just copy the pointers for later rendering?

Thanks,
Dave (who has obviously not examined the legend implementation!)


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


Re: [Plplot-devel] Legends

2010-10-05 Thread Alan W. Irwin
On 2010-10-05 22:19-0400 Schwab,Wilhelm K wrote:

> I was interested in building it (5.9.7) to try the legend code.  Is there a 
> reason for the double pointer?  It seems that
>
>   this part\0that part\0...\0and the last part\0\0
>
> would do the job just as easily??

I guess arranging a string with a bunch of null terminations scattered
through out it to delimit the parts would work, but to me that seems a
less standard approach than simply using an array of pointers to
strings.  My feeling is the present approach will interface well with
standard string handling methods for the various languages we support.
That proved to be the case for python/numpy since that combination has
an object (a numpy array of pointers to strings) which maps quite well
to the present const char ** text. However, that is only one interfacing
case so far, and I am willing to keep an open mind about changing the
present approach if we run into trouble interfacing const char ** text to
other languages.

Alan
__
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__

Linux-powered Science
__

--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel


[Plplot-devel] Legends

2010-10-05 Thread Schwab,Wilhelm K
I started out trying to build the new release and did not get far with the 
instructions on the wiki.  Then I found this:

http://www.linuxquestions.org/questions/linux-newbie-8/unable-to-install-and-build-plplot-5-9-a-789425/

Building plplot-5.9.5 : 1) cd plplot-5.9.5/ , 2) mkdir build
3) cd build/ , 4) cmake .. ( cmake   )
The text output in the terminal will show, what's included in the
configuration / Makefile : tcl/tk , wxwidgets, pyqt4, python, etc.

4) make : will build the binaries and the libraries.

My own addition was then

  sudo make install

which *appears* to have worked.

I was interested in building it to try the legend code.  Is there a reason for 
the double pointer?  It seems that

   this part\0that part\0...\0and the last part\0\0

would do the job just as easily??

Bill


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel