pylab

matplotlib.pyplot/pylab not updating figure while isinteractive(), using ipython -pylab

There are a lot of questions about matplotlib, pylab, pyplot, ipython, so I'm sorry if you're sick of seeing this asked. I'll try to be as specific as I can, because I've been looking through people's questions and looking at documentation for pyplot and pylab, and I still am not sure what I'm doing wrong. On with the code: Goal: plot ...

AttributeError while adding colorbar in matplotlib

The following code fails to run on Python 2.5.4: from matplotlib import pylab as pl import numpy as np data = np.random.rand(6,6) fig = pl.figure(1) fig.clf() ax = fig.add_subplot(1,1,1) ax.imshow(data, interpolation='nearest', vmin=0.5, vmax=0.99) pl.colorbar() pl.show() The error message is C:\temp>python z.py Traceback (most re...

Putting newline in matplotlib label with TeX in Python?

How can I add a newline to a plot's label (e.g. xlabel or ylabel) in Matplotlib? For example, plt.bar([1, 2], [4, 5]) plt.xlabel("My x label") plt.ylabel(r"My long label with $\Sigma_{C}$ math \n continues here") Ideally i'd like the y-labeled to be centered too. Is there a way to do this? It's important that the label have both t...

Using PyLab to create a 2D graph from two separate lists

Hey Guys, This seems like a basic problem with an easy answer but I simply cannot figure it out no matter how much I try. I am trying to create a line graph based on two lists. For my x-axis, I want my list to be a set of strings. x_axis_list = ["Jan-06","Jul-06","Jan-07","Jul-07","Jan-08"] y_axis_list = [5,7,6,8,9] Any suggestion...

Possible to use pyplot without DISPLAY?

Hello! I'm working remotely on a machine that's pretty restrictive. I can't install any software, and it won't accept my X11 session, so I have no display. The machine currently has pylab installed, and I'd like to use it to plot something and then save it for viewing on another computer. However, it seems there's no way to even create ...

Easiest way to plot values as symbols in scatter plot?

In an answer to an earlier question of mine regarding fixing the colorspace for scatter images of 4D data, Tom10 suggested plotting values as symbols in order to double-check my data. An excellent idea. I've run some similar demos in the past, but I can't for the life of me find the demo I remember being quite simple. So, what's the e...

Matplotlib and pylab doesn't work in python cgi

Hi all, Matplotlib and pylab doesn't work in python cgi. but it's working properly in python shell.. Any one can help me....... Plz....... Thanks in advance...... #!C:/Python26/python import cgi import cgitb import sys import os cgitb.enable() # set HOME environment variable to a directory the httpd server can write to os.environ[ 'H...

pylab 2d plotting

Hello, im using the pcolor plot in pylab to plot a two dimensional arrays with values between 0 and 1. Some array entries do not make sense and i want some other color for them in the plot meaning they are not valid. I tried to call pcolor two times with a differente color map hoping pylab would overlap them, but that didnt work. How...

color plot animation with play, pause, stop cabability using Tkinter with pylab/matplotlib embedding: can't update figure/canvas ?

I've looked but didn't find previous questions specific enough, so sorry if this is repeated. Goal: GUI to continuously update figure with different matrix data plotted by pylab's pcolor such that there is a running animation. But user should be able to play, pause, stop animation by Tkinter widget buttons. Before I get an answer for ma...

How to plot a figure of my purpose in python?

Hi, in python, I would like to use: from pylab import * Then use plot provided in this module. However, the curves I plot were not what I want: Say two lists: x = [1, 2, 3, 4] y = [1.4, 5.6, 6, 3.5] and I am after a plot method that can plot the following chart: Plot a line that joins the points: (1, 0) and (1, 1.4) Plot a line that join...

Get the list of figures in matplotlib

I would like to: pylab.figure() pylab.plot(x) pylab.figure() pylab.plot(y) # ... for i, figure in enumerate(pylab.MagicFunctionReturnsListOfAllFigures()): figure.savefig('figure%d.png' % i) What is the magic function that returns a list of current figures in pylab? Websearch didn't help... ...

How do I remove the y-axis from a Pylab-generated picture?

import pylab # matplotlib x_list = [1,1,1,1,5,4] y_list = [1,2,3,4,5,4] pylab.plot(x_list, y_list, 'bo') pylab.show() What I want to do is remove the y-axis from the diagram, only keeping the x-axis. And adding more margin to the diagram, we can see that a lot of dots are on the edge of the canvas and don't look good. ...

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 - 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) ...