Thank you for your answer, but I got an error I did it:

x1=[1,2,3,4]
y1=[5,6,7,8]
data = [ Gnuplot.Data(x0 , y0 , title="Nov-09") , Gnuplot.Data(x1 , y1 , title="Dec-09") ]
g.plot(*data)

and I got the following error:

gnuplot> plot "/tmp/tmp8RzST6.gnuplot/fifo" title "Nov-09", "/tmp/tmpLro45i.gnuplot/fifo" title "Dec-09"
                                                          ^
         line 0: Too many columns in using specification

What I need to do is a graphic like this http://www.ibm.com/developerworks/aix/library/au-gnuplot/diskimage.gif in these graphic I have the same x for several y.

Best Regards
             Roberto







On Mon, Feb 20, 2012 at 5:26 PM, <e.pasca@nki.nl> wrote:
As far as I can tell, this line is wrong

g.plot(data using 2:xtic(1) title "Oct-09 data growth(gb)", ''
using 3 title "Nov-09 data growth(gb)", '' using 4 title "Dec-09 data
growth(gb)")

you must create the data like this

data = [ Gnuplot.Data(x0 , y0 , title="Nov-09 etc") ,
        Gnuplot.Data(x1 , y1 , title="Dec-09 etc") ,
      ]

where x0,y0 (etc) are the data arrays, then plot it with

g.plot(*data)


Edo


> -----Original Message-----
> From: Roberto Rodríguez-Rodríguez [mailto:robalrr@gmail.com]
> Sent: Monday, February 20, 2012 5:20 PM
> To: gnuplot-py-users@lists.sourceforge.net
> Subject: [Gnuplot-py-users] Problem working with xtics
>
> Hi, I need to do a bar graph with categories, I found these example
>
> http://www.ibm.com/developerworks/aix/library/au-gnuplot/index.html
>
> I need to do something similar, for many data. I tried to
> replicate the example on python. I wrote the respective code
> I append it at the end of the message.
>
> but I got these error:
>   File "./graph.py", line 119
>     g.plot(data using 2:xtic(1) title "Oct-09 data growth(gb)", ''
> using 3 title "Nov-09 data growth(gb)", '' using 4 title "Dec-09 data
> growth(gb)")
>                     ^
> SyntaxError: invalid syntax
>
> The function fileopen2 is just for parsing the file with the
> data, I got a matrix wich I tried to graph. The problem is
> with the plot command, I don't know how to manage categories
> with gnuplot.py, I have looking in the web in several places
> but all the examples don't touch these part.
>
> these is my code
>
> #! /usr/bin/env python
>
> import Gnuplot, Gnuplot.funcutils, sys
> import sys
> import re
> import math
>
> #*************************************************************
> ******************
> def plot2D(data):
>         print sys.maxint
>         g = Gnuplot.Gnuplot() #persist=1)
>         g.title('Memory writes')
>         g('set terminal png truecolor')
>         g('set grid')
>         g('set style data histograms') # give gnuplot an
> arbitrary command
>         g('set style fill solid 1.00 border -1')
>         g('set xlabel "page_number"')
>         g('set ylabel "number of writes"')
>         g('set autoscale')
>         g.plot(data using 2:xtic(1) title "Oct-09 data growth(gb)", ''
> using 3 title "Nov-09 data growth(gb)", '' using 4 title "Dec-09 data
> growth(gb)")
>         g.hardcopy("blah.png",terminal="png")
>         raw_input('Press enter to continue...\n')
> #*************************************************************
> ******************
>
> #*************************************************************
> ******************
> def file_open2(DataFile):
> #Open the file
> #       print "open"
>         try:
>                 data_file = open(DataFile, "r") #open the file
>                 data_points=data_file.read() #save the file in a list
>                 line_points=data_points.split('\n') #split
> the file by new lines
>                 data_file.close()
>         except IOError, e:
>                 print >> sys.stderr, "File Open Error:", e
>                 sys.exit(2)
>
>         reg_exp=re.compile(r"\s+") #reg_exp for separate each
> token in the list
>         mem=[[]]
>         print "Putting data in an array"
>         for i in range(len(line_points)-1):
>                 mem_line=reg_exp.split(line_points[i])
>                 for j in range(len(mem_line)):
>                         if j==0:
>                                 mem[i].append((mem_line[j]))
>                         else:
>                                 mem[i].append(float(mem_line[j]))
>                 mem.append([])
>         mem.pop()
>         return mem
> #*************************************************************
> ******************
>
> if __name__ == '__main__':
>         plot2D(file_open2(sys.argv[1]))
>
>
> the file that have the data contains:
>
> hdisk2 420 425 410
> hdisk3 700 780 760
> hdisk4 450 450 452
> hdisk5 680 702 690
> hdisk6 320 330 329
> hdisk7 530 515 514
>
> I really appreciate any help. Thank you
>
> --
> Best Regards
>              Roberto
>
> --------------------------------------------------------------
> ----------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft
> developers is just $99.99! Visual Studio, SharePoint, SQL -
> plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future
> releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Gnuplot-py-users mailing list
> Gnuplot-py-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gnuplot-py-users
>