[Matplotlib-users] remove white area around

2011-06-13 Thread Andrea Crotti
I found this question asked other times, but trying myself there is no way that I get something working.. So I just want to generate a pdf from a plot with the smallest possible margin, and I was trying for example this: fig = plt.figure(1) fig.frameon = False plt.plot(range(10),

[Matplotlib-users] Turn off autoscale and optional subplots

2011-04-13 Thread Andrea Crotti
I need to generate in some cases a subplot with two plots one on top of the other, and in some other cases just one subplot. So after some attempts I ended up with the ugliest code I've ever written (maybe not) that you see below. Is there a better way to do it? I still didn't fully get how to

[Matplotlib-users] bins and histograms

2011-03-10 Thread Andrea Crotti
I'm having some troubles understanding basic concepts. Suppose I want to do something like this, given a dictionary values = { (0,10) : 0.5, (10, 20) : 0.3 } and so on, where the key is a time slot interval and the value is the value I want to plot. What should be the correct way to

[Matplotlib-users] bins and histograms

2011-03-10 Thread Andrea Crotti
I'm having some troubles understanding basic concepts. Suppose I want to do something like this, given a dictionary values = { (0,10) : 0.5, (10, 20) : 0.3 } and so on, where the key is a time slot interval and the value is the value I want to plot. What should be the correct way to

Re: [Matplotlib-users] Text box adaptable

2011-03-08 Thread Andrea Crotti
Goyo goyod...@gmail.com writes: As Ben explained you need to draw first. So the usual path is: 1. Draw 2. Figure out the size of potentially problematic things (labels, titles...) and the space you need. 3. Adjust subplots or whatever needs adjustment to fit. 4. Draw again. Sort of weird

Re: [Matplotlib-users] Text box adaptable

2011-03-07 Thread Andrea Crotti
Here I am again with the text boxing and scaling. I'm having some troubles to understand the whole picture, since it seems that there are so many actors involved. So suppose I have some text and I want to see how big it is, I thought I could t = matplotlib.text.Text(0, 0, very long string)

Re: [Matplotlib-users] Make the area a bit larger

2011-03-01 Thread Andrea Crotti
Gökhan Sever gokhanse...@gmail.com writes: Hi, You can try: fig, ax = plt.subplots(1,1) ax.plot(range(10)) fig.subplots_adjust(left=0.05, right=0.95, bottom=0.05, top=0.95) If you choose WXAgg as your backend you get a nice config tool to adjust spacing in the figure. Then just pass

Re: [Matplotlib-users] Make the area a bit larger

2011-03-01 Thread Andrea Crotti
Paul Ivanov pivanov...@gmail.com writes: Hi Andrea, I think Gökhan is pointing out a different feature than the one you want. You seem to want to adjust the x and y limits of the plot to be some fraction larger than the data that's plotted. You can do this with: ax = plt.subplot(111)

[Matplotlib-users] Make the area a bit larger

2011-02-28 Thread Andrea Crotti
So since I wanted some space on the borders of my graph, I did this really extremely convoluted thing, which apparently works... I get a 10% more area on each side, but I'm quite sure there's a better way to this, right? I didn't find any function to pass an increment to the size that's why I did

Re: [Matplotlib-users] Text box adaptable

2011-02-27 Thread andrea crotti
2011/2/18 Benjamin Root ben.r...@ou.edu: Automatic layouts are difficult to do in matplotlib.  This was a design decision trade-off made early in its development.  Instead of having matplotlib determining optimal layouts and such, the developers decided that it would be better to give the

[Matplotlib-users] Text box adaptable

2011-02-18 Thread andrea crotti
Hi everyone, and thanks for the amazing library first of all :) Now a short question, I have some graphs and I would like to add some statistical summary as text on the figure. I see how I can add text and it's quite easy, the problem is that the text wants a coordinate to write the graph. And