matplotlib

How do I write text in subscript in the axis labels and the legend?

I have the following axis labels and legend. plt.ylabel("ratio_2") plt.xlabel("n_1") plt.legend(('alpha_1','alpha_2' ), loc = 'best',shadow = True) ...

Matplotlib: Curve touches axis boudary. How to solve this?

I drew this graph using matplotlib using the following code. import matplotlib import matplotlib.pyplot as plt x = [450.0, 450.0, 438.0, 450.0, 420.0, 432.0, 416.0, 406.0, 432.0, 400.0] y = [328.90000000000003, 327.60000000000031, 305.90000000000146, 285.2000000000013, 276.0, 264.0, 244.0, 236.0, 233.5, 236.0] z = [2,4,6,8,10,12,14,1...

Matplotlib, Pylab using TKAgg: encountering PyEval_RestoreThread: NULL tstate when using plt.ion() on win32

EDIT: Bah, finally found a discussion on the Runtime Error, although it focuses on using PythonWin, which I did not have installed at the time. After installing PythonWin and setting up GTK (as per an earlier question), I was still encountering the error. The solution from the discussion board here was to append plt.close() after the ...

Matplotlib + sockets = Hangup!!!???

Hi all, I am trying to plot data that I receive over a socket. I am using "Matplotlib" as the plotting library and "cPickle" to serialize python objects. When I run my code, plot window opens and hangs up. I have tried a couple of ways to get around it, but no help Don't know if this might help, but...I am using "Python 2.7 - 32 bit" on ...

About the image size that generated from matplotlib

Hi, I generated a histogram by using matplotlib import numpy as np import pylab as P mu, sigma = 200, 25 x = mu + sigma*P.randn(10000) P.figure() bins = 10 n, bins, patches = P.hist(x, bins, normed=1, histtype='bar', rwidth=0.8) P.show() I want to make the picture smaller, how could I do that? Thanks for your help ...

How to change text of y-axes on a matplotlib generated picture

The page is "http://matplotlib.sourceforge.net/examples/pylab_examples/histogram_demo_extended.html" Let's look at the y-axis, the numbers there do not make any sense, could we change it to something else that is meaningful? ...

Text box in matplotlib?

Is it possible to display text in a box through Matplotlib, with automatic line breaks? By using pyplot.text(), I was only able to print multi-line text that flows beyond the boundaries of the window, which is annoying. The size of the lines is not known in advance… Any idea would be much appreciated! ...

Matplotlib - Data disappears when I switch to a semilog plot

Hi, I am trying to plot do a basic semilog plot using pyplot and matplotlib, with the y-axis being the logarithmic scale. I am using the following code: pylab.figure(num=None,figsize=(8,6)) pylab.plot(x_loc,var1,x_loc,var2) \#pylab.yscale('log') pylab.xlabel('$y/L_{1/2}$',fontsize=18) pylab.ylabel('$n/n_{max}$',fontsize=18) ...

Reduce left and right margins in matplotlib plot

I'm struggling to deal with my plot margins in matplotlib. I've used the code below to produce my chart: plt.imshow(g) c = plt.colorbar() c.set_label("Number of Slabs") plt.savefig("OutputToUse.png") However, I get an output figure with lots of white space on either side of the plot. I've searched google and read the matplotlib docume...

Detach matplotlib window from sub-process

I've got a script which creates a graph, but the script keeps running in the background until the window is closed. I'd like it to quit as soon as the window is created, so that Ctrl-C in the shell won't kill the window, and so that the user can leave the window open and continue working in the shell without bg-ing it manually. I've seen...

Matplotlib 2d polygone in 3d axes

Hi everybody, I'm using matplotlib to plot some data as 2d curves in a 3d axes. I use the ax=axes3d.Axes3D() to define my axes and ax.plot(x,y, zs='z') to plot my 2d curves in the 3d space. Now I want to add something that looks like what is on this page http://matplotlib.sourceforge.net/examples/mplot3d/polys3d_demo.html, but I want t...