[Tkinter-discuss] wckgraph double y-axis

dimitri pater dimitri.pater at gmail.com
Thu Apr 21 00:57:29 CEST 2005


Hello again,
inspired by your great help (and eager to help if I can in posts to come), I 
have another question that concerns the (very nice) wckgraph package by 
Fredrik Lundh.
I want to "merge" to graphs, they share the x-axis so I need y-axis1 and 
y-axis2 in one graph. Is this possible?
This is how I create the two graphs:

self.barCanvas2 = Tkinter.Canvas(self.outputFr2)
self.barCanvas2.pack(fill="both", expand=1)

bar1 = wckgraph.GraphWidget(self.barCanvas2)
bar1.pack(fill="both", expand=1)

ydata = []
for i in range(len(fg.data)):
x = int(fg.data[i][1])
ydata.append(x)

xdata = range(len(fg.data)) 
data = xdata, ydata

bar1.add(wckgraph.Axes(data))
bar1.add(wckgraph.BarGraph(data, barwidth=0.3))

# ShoeSize bar
self.barCanvas3 = Tkinter.Canvas(self.outputFr3)
self.barCanvas3.pack(fill="both", expand=1)

bar2 = wckgraph.GraphWidget(self.barCanvas3)
bar2.pack(fill="both", expand=1)

ydata2 = []
for i in range(len(fg.data)):
x = int(fg.data[i][2])
ydata2.append(x)

#xdata2 = range(len(fg.data)) 
data2 = xdata, ydata2

bar2.add(wckgraph.Axes(data2))
bar2.add(wckgraph.ScatterGraph(data2))

Looks very nice, but how can I merge them into one graph? I have read 
something about add(layer) but I am not sure if this is the way to do this.

Thanks,
Dimitri


-- 
Please visit dimitri's website: www.serpia.com <http://www.serpia.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tkinter-discuss/attachments/20050421/c7273fe7/attachment.htm


More information about the Tkinter-discuss mailing list