Hi Andrew
 
With the wxWidgets driver after applying the patch it uses the values provided by plspage() - I think this should be the default behaviour if plspage() has been called.
 
If plspage() hasn't been called then common_init() calls plspage() with default page size of 800 pixels wide by 600 pixels high and all other params of zero. In this case the page is plotted and only part of the plot is shown if the window is too small - no attempt to resize the plot occurs.
 
Perhaps a better option for wxWidgets would be if the page size hasn't been set by the user with plspage do not make any changes to it in common_init() and instead move this code to the plD_esc_wxwidgets()  PLESC_DEVINIT case (or a virtual function called from here for the different backends).  Until this point the driver doesn't have a canvas to draw on so page dimensions are useless anyway and from this point onwards the driver has access to the actual size of the canvas so can call plspage with sensible values.
 
I'm not sure how the other drivers you list get their canvas - but maybe expected behaviour could be if plspage() is called before plinit() use the user's page size and plot part of the page if the window is too small or if plspage hasn't been called then the driver should call plspage() itself at the earliest opportunity with the actual window dimensions and should not use a "default size".
 
The only problem with this strategy is that calling plspage after setting the device might give odd results? There is a warning however if plspage() is called after plinit() so maybe we could live with this.
 
Phil
 

From: Andrew Ross <andrewross@users.sourceforge.net>
To: phil rosenberg <philip_rosenberg@yahoo.com>
Cc: "plplot-devel@lists.sourceforge.net" <plplot-devel@lists.sourceforge.net>
Sent: Wednesday, 14 November 2012, 10:11
Subject: Re: [Plplot-devel] poor vectors when using wxwidgets


Phil,

Thanks for the patch. Before applying I decided to try the same thing
on other drivers.

xwin - behaves the same as wxwidgets, i.e. it rescales the plot to fit
the page and distorts vectors (also text too so this is not a sensible
thing to do with xwin)

qtwidget - maintains the aspect ratio of the plot and scales it to fit
in the window

xcairo - makes no attempt to rescale the plot, so it may or may not
still fit in the window if the window size is changed.

All this behaviour is rather inconsistent. It would be nice if the
main interactive drivers behaved in a similar way. What should that
behaviour be?

Andrew

On Tue, Nov 13, 2012 at 05:04:10PM -0800, phil rosenberg wrote:
> It turns out I've managed to solve my own problem. The wxWidgets driver was calling plP_setphy with constant values irrespective of the actual width and height of the window. I've replaced the constants with dev->width and dev->height which were assigned from pls->xlength and pls->ylength (which are int turn set by either a user or default call to plspage). I could see an argument for using higher resolution for AGG which has subpixel accuracy, but at least with this patch the distortions have been removed.
> ?
> This fixes the arrows and axes distances.
> ?
> Patch attached - tested on all three wxwidget backends.
> ?
> Phil

>
> ________________________________
>  From: phil rosenberg <philip_rosenberg@yahoo.com>
> To: "plplot-devel@lists.sourceforge.net" <plplot-devel@lists.sourceforge.net>
> Sent: Tuesday, 13 November 2012, 23:20
> Subject: poor vectors when using wxwidgets

>
> Hi
> I've just been looking at using the plvect function to add vectors to a plot. Unfortunately they are not coming out well. Attached is a simple example with [1,1] vectors plotted at every integer from 0-9 in x and y. You can see that the arrow heads are distorted. I've traced this through the code and found that it's because the? plot is scaled independantly in x and y in the wxWidgets driver (in this case in wxPLDevGC::DrawPolyline() ). This scaling AFTER the rotation of the arrow causes distortion.
>
> I'm not fully familiar with the plplot transformations from world to device coordinates, but I thought that this should be performed by plP_wcpcx()? Does anyone have any idea what could be going wrong here so I'm not debugging from scratch? Am I doing something wrong during initialisation?
>
> By the way, I thik this is related to another problem that I've experienced (but hadn't gotten round to reporting) where my y axis title moves further and further away from the y axis as I make my plot window wider.
>
> Any help much appreciated.
>
> Phil


> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov

> _______________________________________________
> Plplot-devel mailing list
> Plplot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/plplot-devel