need some advice on x y plot

Grant Edwards grante at visi.com
Tue Oct 25 10:29:52 EDT 2005


On 2005-10-24, nephish at xit.net <nephish at xit.net> wrote:
> ok, i am stuck a bit here with this line
>
> gp('set xtics (%s)' % ','.join(ticstrings))
>
> the error code says that it is looking for a closing parenthesis.

Well, what is the value of ticstrings? 

Try passing the parameter debug=1 to Guplot.Gnuplot():

  gp = Gnuplot.Gnuplot(debug=1)

Then it will print out all of the gnuplot commands to stdout.

> that and i am kinda new enough not to really get what %s is
> all about. i know it formats a string.

http://www.google.com/search?hl=en&q=python+string+formatting

Follow the first hit.

> can you simply pass a list to 'set xtics' ?

That depends.  What do you mean by "a list", and what do you
mean "pass it to 'set xtics'"?

> i mean, i got this from the gnuplot site
>
> Syntax:
>
>      set xtics {axis | border} {{no}mirror} {{no}rotate {by <ang>}}
>                {offset <offset> | nooffset}
>                {  autofreq
>                 | <incr>
>                 | <start>, <incr> {,<end>}
>                 | ({"<label>"} <pos> {<level>} {,{"<label>"}...) }
>                { font "name{,<size>}" }
>                { textcolor <colorspec> }
>      unset xtics
>      show xtics
>
> but it does not look like all the options are necessary from
> the docs, i guess i am asking, if i just wanted to pass a list
> of say, 14 tics to the x axis as a list, what of the above is
> necessary ?

Well, you could start up gnuplot at the command line and try a
few "set xtics" commands.  That's how I figur gnuplot commands
out.  The format for the set xtics command that I was using in
my demo was

      set xtics  ("label" pos, "label" pos, "label" pos)

> i built the list by taking time stamps in seconds (the same as
> being plotted for x) took the end time minus the start time
> and divided by 12, incremented each by this amount until i had
> 12 plots (plus of course the first and last). these are all
> stored in plot_times[]..

We can't read your mind.  Unless you show us actual code, we
can't help.  Show us a small example program with Gnuplot's
debug feature enabled that doesn't do what you want it to.

Tell us what it is you wanted the program to do and post the
output from that program.  Do _not_ attempt to re-type the
output from the program.  Either redirect it to a file or
cut/paste it.

-- 
Grant Edwards                   grante             Yow!  PUNK ROCK!! DISCO
                                  at               DUCK!! BIRTH CONTROL!!
                               visi.com            



More information about the Python-list mailing list