From: Dani Marti <daniel.marti@up...>  20060111 20:10:11

Hi all, I'd like to insert two graphs on the same canvas. One is a normal xy graph, and the other is a histogram of the y values. My problem is, how can I insert the histogram rotated 90 degrees clockwise, at the right of the xy graph? In short, is it possible to rotate a graph? The idea I have in mind is to stress the meaning of a histogram as a 'projection' of the number of occurences on the y axis. from pyx import * from random import gauss from scipy import arange, transpose, array, zeros, randn from scipy.stats.stats import histogram c = canvas.canvas() # The first graph #  g = graph.graphxy(width=8, height = 5) mean = 1.0 stddev = 0.2 data = zeros(1000) data = data + mean + stddev * randn(1000) # Maybe this is not necessary, but I can't think of # any easier way data_list = [[i,m] for i,m in enumerate(list(data))] g.plot(graph.data.list(data_list, x=1, y=2)) c.insert(g) # The second graph: a histogram #  # This is probably an awkward way to generate histograms. # It doesn't work, but this is not the matter here. n_bins = 50 histo, bin_min, bin_width, pts_outside = histogram(data[:], numbins=n_bins) x_histo = scipy.arange(bin_min + 0.5 * bin_width, step = bin_width, stop = bin_min + n_bins * bin_width) data_histo = transpose(array([x_histo, histo])) h = graph.graphxy(width = 5, height = 2) h.plot(graph.data.list(data_histo, x=1, y=2), [graph.style.histogram()]) ... And now, I'd like to rotate graph 'h' before inserting it at the right of graph g. I'm sorry if this question does not make any sense. Thanks a lot, guys PS Any advice about how to plot the histogram in this example will also be greatly appreciated. 