Dear Mico,

while we do have a pyxrc facility for some PyX configuration, such  
configuration options will only contain maschine dependend  
information. I'm strongly against using a gobal config file for layout  
adjustments as your PyX scripts would silently become dependend on the  
local configuration.

Instead it is a common practise to use a Python script itself for  
configuration. In your case I suggest to build you a file containing  
stuff like

     from pyx import *

     class myaxis(graph.axis.lin):
         def __init__(self, ...):
             pyx.graph.axis.__init__(self, ...)

You can than use PyX by importing your PyX configuration and use  
mygraph, myaxis, etc.

HTH


André


Am 27.04.2008 um 21:53 schrieb Mico Filós:

> Dear all,
>
> I've been using PyX for some time for my plots, and I am generally
> very satisfied with the results I get.
> The only problem I find with PyX is that the interface is perhaps too
> low level for an ordinary user, although I am aware that one can use
> an intermediate layer that solves this problem (like, e.g., PyXplot or
> PyXgraph). I don't know if this criticism makes sense, perhaps the
> original role of PyX is to provide a well structured framework to
> create EPS and PDF files (which, I think, PyX perfectly does), rather
> than to provide a fast, easy-to-use interface for the creation of
> these files.
>
> My question is
>
> Is there anything similar to an 'init file' where the user can set
> some default values for the axes, stylechangers, etc.?
>
> Some time ago I asked a similar question and the solution I was given
> was to define a class like
>
> class AxisReg(axis.painter.regular):
>    def __init__(self,
>                 labeldist = 0.15 * unit.v_cm,
>                 titledist = 0.15 * unit.v_cm,
>                 outerticklength = axis.painter.ticklength.short,
>                 innerticklength = None,
>                 basepathattrs = [style.linewidth.normal],
>                 tickattrs = [style.linewidth.normal],
>                 labelattrs = [text.size.footnotesize],
>                 titleattrs = [text.size.small],
>                 **kwargs):
>        axis.painter.regular.__init__(self,
>                                      labeldist = 0.15 * unit.v_cm,
>                                      titledist = 0.15 * unit.v_cm,
>                                      outerticklength =
> axis.painter.ticklength.short,
>                                     innerticklength = None,
>                                      basepathattrs =  
> [style.linewidth.normal],
>                                      tickattrs =  
> [style.linewidth.normal],
>                                      labelattrs =  
> [text.size.footnotesize],
>                                      titleattrs = [text.size.small],
>                                      **kwargs)
>
> class AxisRegLik(axis.painter.regular):
>    def __init__(self,
>                outerticklength = axis.painter.ticklength.short,
>                innerticklength = None,
>                 basepathattrs = [style.linewidth.normal],
>                 tickattrs = [style.linewidth.normal],
>                 labelattrs = None,
>                 titleattrs = None,
>                 **kwargs):
>        axis.painter.regular.__init__(self,
>                                      outerticklength =
> axis.painter.ticklength.Short,
>                                     innerticklength = None,
>                                      basepathattrs =  
> [style.linewidth.normal],
>                                      tickattrs =  
> [style.linewidth.normal],
>                                      labelattrs = None,
>                                      titleattrs = None,
>                                      **kwargs)
>
> and then use an instance of this class as a painter of the axis:
>
> regular_axis = AxisReg()
> notext_axis = AxisNoReg()
> x_ax = axis.linear(title="X", painter = regular_axis,
>            density = x_density, min=x_min, max=x_max)
> x_ax_lik = axis.linear(painter = no_text_a, min = x_min, max = x_max)
> y_ax = ...
> y_ax_lik = ..
> ...
> graph.graphxy(x=x_ax, y=y_ax, x2=x_ax_lik, y2=y_ax_lik,...)
>
> Ok, it is fine, it can be done, but many of us will agree that this is
> not an optimal solution. Are there better ways to do this?
>
> Thanks a lot for your attention,
>
> Mico
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save  
> $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> PyX-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pyx-user
>

-- 
by  _ _      _    Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim
    / \ \    / )   [EMAIL PROTECTED], http://www.wobsta.de/
   / _ \ \/\/ /    PyX - High quality PostScript and PDF figures
  (_/ \_)_/\_/     with Python & TeX: visit http://pyx.sourceforge.net/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to