Hi Werner,

On Thu, 2010-06-03 at 20:12 +0100, Werner Smekal wrote:
> For so much symbols I would suggest to use the hershey fonts for
> symbols
> with
> 
> pls->dev_hrshsym = 1;
> 
> text will be drawn still nicely. But I'm sure qtwidget should be as
> fast
> as xcairo or close to, so if the 7.5 second are ok for you, I would
> definitely look how text plotting is managed in xcairo and in
> qtwidget.

Thanks for this; it sounded like a sensible idea, but after extensive
trials, the result is mixed. I attach for your amusement the result of a
variety of trials for various different interactive devices (xwin, tk,
xcairo, and qtwidget), plotting various symbols (plus sign, circle,
filled dot) in various sizes (plssym(0.0, scale)), and with
plsc->dev_hrshsym set to 0 (unicode) or 1 (use hershey). I also attach
the code I was playing with to do this, which is a hacked and
stripped-down version of x01c. It was compiled using the Makefile in my
examples/c folder.

Here are some brief conclusions:

For some plot symbols xcairo is faster (by almost a factor of 10) when
using hershey font for them rather than unicode. I guess this is
Werner's experience.

However, the qtwidget is actually slower when the hershey fonts are
invoked (about 50% more time). See the entries with green and blue
backgrounds in the attached spreadsheet. The simple filled dot takes 6
times as long with a hershey font.

Simple circles are an exception to the above and take the same time
regardless of whether the hershey or unicode fonts are used, and this is
true for all the drivers.

Generally, the qtwidget driver is significantly slower than the others,
and I guess the attached results suggest that this is internal to qt.

I also tried plotting to pdf files using cairo and qt. I expected to see
the unicode font containing the symbol in the pdf "properties" list of
fonts, but it isn't. [I removed all the plot labelling which resulted in
a pdf with no fonts required/embeded.]

Steve

-- 
+-------------------------------------------------------------------+
Professor Steven J Schwartz        Phone: +44-(0)20-7594-7660
Head, Space & Atmospheric Physics  Fax:   +44-(0)20-7594-7772
The Blackett Laboratory            E-mail: s.schwa...@imperial.ac.uk
Imperial College London            Office: Huxley 6M67A 
London SW7 2AZ, U.K.               Web: www.sp.ph.ic.ac.uk/~sjs
+-------------------------------------------------------------------+

Attachment: plpoin_timings.xls
Description: MS-Excel spreadsheet

/* SJS Hack from x01c.c
*/

#include "plcdemos.h"

#include "plplotP.h"

#define NPTS 100000

/* Variables and data arrays used by plot generators */

static PLFLT x[NPTS], y[NPTS];
static PLFLT xscale, yscale;

void plot1();

/*--------------------------------------------------------------------------*\
 * main
 *
 * plots lots of points using plpoin for speed check of qtwidget and others
\*--------------------------------------------------------------------------*/

int
main(int argc, const char *argv[])
{

/* Parse and process command line arguments */

    plparseopts(&argc, argv, PL_PARSE_FULL);

/* Initialize plplot */
    plstar(1,1);

/* Set up the data */

    xscale = 6.;
    yscale = 1.;

/* Do a plot */

    plot1();

    plend();
    exit(0);
}

 /* =============================================================== */

void
plot1()
{
  int i;
    PLFLT xmin, xmax, ymin, ymax;

    for (i = 0; i < NPTS; i++) {
   	x[i] = xscale * (i + 1) / (PLFLT)NPTS;
   	y[i] = yscale * pow(x[i], 2.);
    }

    xmin = x[0];
    xmax = x[NPTS-1];
    ymin = y[0];
    ymax = y[NPTS-1];

    x[0] = 3.0; y[0] = 18;  /* show glyph used */

/* Set up the viewport and window using PLENV. */
    plcol0(1);
    plenv(xmin, xmax, ymin, ymax, 0, -1);  /* suppress all labels */
    plcol0(2);
/*    pllab("(x)", "(y)", "#frPLplot Example 1 - y=x#u2"); */

/* Plot the data points; try to force hershey and NOT unicode.
   I assume plsc will point to the active plot stream. From my
   reading of the src files, only one of the following two lines
   should be enough but I'm desperate! */

      plsc->dev_hrshsym = 0;    
/* 	 plsc->dev_unicode = 0;     */
    plcol0(4);

	plssym(0.,2.5); 

    plpoin(NPTS, x, y, 16); /* using code=5 is quicker */

/*	plsym(NPTS,x,y,905); */  /* gives same plot and timings */

/* Draw the line through the data - this is ok and fast */

/*  plcol0(3);
    plline(NPTS, x, y); */

}

 /* =============================================================== */



------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to