Jette Krause wrote:
> Hallo,
>
> I need to plot some curves and a data point into one diagram. I can't
> find out how to tell Gnuplot to use different linestyles for different
> items ("lines" for the curves and "points" for data) when plotting from
> a python script.
>
> E.g., if I write
>
> g=Gnuplot.Gnuplot()
> g('set data style lines'),
>
> the plotting command for the point is not executed (naturally...).
> But is there a way to give a data style different from the general on,
> e.g in the plotting command?
>
> I tried things like
> g.plot(a,b,c,k with points)
> where a to c are the curves and k should be the point, but it does not work.
>
> I would be grateful for any help.
I've moved away from gnuplot to matplotlib, but here's some old code which can
get you going:
if 0:
#transcript = utils.TranscriptPrint('transcript_%s.ref' %
max_band,start=True)
print "*** OLDEST (REFERENCE) NATURAL-SCALE IMPLEMENTATION"
all_r = {}
lft_r = {}
#phinsc = poisson._call_nsc_ref(rho,truncate,verbose,all_r,lft_r)
phinsc = poisson._call_nsc_ref(rho,truncate,verbose)
x,pnx = eval_diag(phinsc)
nscref = GP.Data(x,pnx,title='Ref Nat-scale',with='linespoints lt 4')
errornscr= GP.Data(x,abs(pxx-pnx),title='Slow (ref) Nat-scale error',
with='lines lt 4')
gp.replot(errornscr)
#transcript.Stop()
if 0:
# Compare two implementations, which should agree to within roundoff
gp.plot(x,N.absolute(pnx-px))
gp.replot(GP.Func('1e-16',with='lines lt 2'))
if 0:
print "*** REFERENCE 2-SCALE IMPLEMENTATION"
phi2sc = poisson._call_2sc(rho)
x,p2x = eval_diag(phi2sc)
twosc = GP.Data(x,p2x,title='2-scale',with='linespoints lt 5')
error2sc = GP.Data(x,abs(pxx-p2x),title='Two-scale error',
with='lines lt 5')
Cheers,
f
|