[SciPy-user] gplt font question

Arnd Baecker arnd.baecker at web.de
Mon Jul 7 14:37:51 EDT 2003


alright, first let me answer your question within the scipy context
and turn to some more general remarks below.

from scipy import *
g=gplt.current()
#g._send('set mouse;')  # if you want to use the mouse
x=arange(0,10,0.1)
y=sin(x)
gplt.plot(x,y)
g._send('set size 1.0,0.5')
g._send('set term post port enh "Times-Roman" 40')
g._send('set output "test.ps"; replot')
g._send('set out ; set term x11')   # set terminal back to original
                                    # with a recent gnuplot: you can use
                                    # push/pop (see "help set terminal"
                                    # from within gnuplot)


Hope this helps... Somehow I think that there should be
something shorter than the last three lines (of course,
you can always define a function for this job)
- anyone having an idea here ?

((Actually, first, I tried to figure this out by using the built-in help,
but failed miserably (scipy.info("scipy.gplt") does not give anything
and help("scipy.gplt") also does not help...
Fortunately I kept a note of Eric Jones email a while ago on
using the mouse in gplt which contained the
g=gplt.current() trick))

More generally, I am aware of three different possibilities
to access gnuplot:
a) scipy.gplt
b) Gnuplot.py (at sourceforge)
c) via IPython (uses b)+lots of enhancements)

I strongly recommend IPython (not just for plotting ;-).
There you can do:

In [1]: from Numeric import *
In [2]: x=arange(0,10,0.1)
In [3]: y=sin(x)
In [4]: from IPython.GnuplotInteractive import *
*** Type `gphelp` for help on the Gnuplot integration features.
In [5]: plot(x,y)
In [6]: replot("cos(x)")
In [7]: hardcopy("test.ps",fontsize="50",fontname="Times-Roman")
In [8]: ! gv test.ps &


For non-interactive sessions you could use

In [1]: from Numeric import *
In [2]: import IPython.GnuplotRuntime
In [3]: gp=IPython.GnuplotRuntime.gp
In [4]: x=arange(0,10,0.1)
In [5]: y=sin(x)
In [6]: gp.plot(x,y)
In [7]: gp.replot("cos(x)")
In [8]: gp.hardcopy("test.ps",fontsize="50",fontname="Times-Roman")
In [9]: ! gv test.ps

Arnd

On Mon, 7 Jul 2003, Christopher Fonnesbeck wrote:

> How do you make such a change from scipy? I would like to avoid having
> to open gnuplot to fine-tune the plots.
>
> Thanks for your help,
> Chris
>
> On Monday, July 7, 2003, at 01:00 PM, scipy-user-request at scipy.net
> wrote:
>
> > Hi,
> >
> > within gnuplot you can for example use something like
> > gnuplot> set term post enh port "Times-Roman" 20
> > Terminal type set to 'postscript'
> > Options are 'portrait enhanced monochrome blacktext \
> >    dashed dashlength 1.0 linewidth 1.0 defaultplex \
> >    "Times-Roman" 20'
> > If this is not enough information please let me know
> > and I will cook up a small example tomorrow.
> >
> > Arnd
> >
> >
> >
> --
> Christopher J. Fonnesbeck (chris at fonnesbeck dot org)
> GA Coop. Fish & Wildlife Research Unit, University of Georgia
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>




More information about the SciPy-User mailing list