matplotlib

Couple of matplotlib newbie doubts

I am just starting to use 'matplotlib' and I have hit upon 2 major roadblocks, which I can't seem to work around from the docs/examples,etc: Here is Python source: #!/usr/bin/python import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt for i in range(0,301): print "Plotting",i # Reading a single column data ...

Interactive mode in matplolib

Hi, I want to dynamically update the scatter plot based on the y-axis data received from a socket connection. I used python matplot lib in interactive mode to do this, but during dynamic updation if i move the window to a different location or minimize the window then the plot updation stops abruptly. Please let me know how to do this? ...

Matplotlib PyQt-Widget plot() resets autoscale

Hello, i am using a Matplotlib figure as widget, in a PyQt4 programm. Everything works, except "set_autoscale_on(False)". Everytime i call a figure axes to plot something, it forgets its autoscale status. Here some code, with axs a subplot of a figure: print axs.get_autoscale_on() print axs.get_autoscaley_on() p...

Matplotlib: Changing the color of an axis

Is there a way to change the color of an axis (not the ticks) in matplotlib? I have been looking through the docs for Axes, Axis, and Artist, but no luck; the matplotlib gallery also has no hint. Any idea? ...

Vertical xtick labels on top, not bottom

I want to plot a confusion matrix using Pylab. The class labels along the horizontal axis are long, so I want to plot them rotated vertically. However, I also want to plot them on top of the axis, not below. This command can plot vertical labels on bottom: pylab.imshow(confusion_matrix) pylab.xticks(..., rotation='vertical') and this...

draw a border around subplots in matplotlib

Hello... anyone know how to draw a border around an individual subplot within a figure in matplotlib? I'm using pyplot. eg: import matplotlib.pyplot as plt f = plt.figure() ax1 = f.add_subplot(211) ax2 = f.add_subplot(212) # ax1.set_edgecolor('black') ..but Axes objects have no 'edgecolor', and I can't seem to find a way to outline ...

Python Matplotlib rectangular binning

I've got a series of (x,y) values that I want to plot a 2d histogram of using python's matplotlib. Using hexbin, I get something like this: But I'm looking for something like this: Example Code: from matplotlib import pyplot as plt import random foo = lambda : random.gauss(0.0,1.0) x = [foo() for i in xrange(5000)] y = [foo() for i ...

Plot with fewer markers than data points (or a better way to plot CDFs?) [matplotlib, or general plotting help]

I am plotting Cumulative Distribution Functions, with a large number of data points. I am plotting a few lines on the same plot, which are identified with markers as it will be printed in black and white. What I would like are markers evenly spaced in the x-dimension. What I am getting is one marker per data point (and given the number o...

How to plot a graph in Python?

I am new to python. I have installed Matplotlib. I have created 2 lists x and y. I want X axis to have values from 0 to 100 in steps of 10 and Y axis to have values from 0 to 1 in steps of 0.1. How do I plot this graph? ...

Change dynamically the contents of a matplotlib plot.

I while ago, I was comparing the output of two functions using python and matplotlib. The result was as good as simple, since plotting with matplotlib is quite easy: I just plotted two arrays with different markers. Piece of cake. Now I find myself with the same problem, but now I have a lot of pair of curves to compare. I initially tri...

PyPlot reverse Y-Axis

I have a scatter plot graph with a bunch of random x,y coordinates. Currently the Y-Axis starts at 0 and goes up to the max value. I would like the Y-Axis to start at the max value and go up to 0. points = [(10,5), (5,11), (24,13), (7,8)] x_arr = [] y_arr = [] for x,y in points: x_arr.append(x) y_arr.append(y) plt.scatter(x_...

Displaying the axis values for a mouseover event in a chart image

I return a chart image (with axis x and y) to the browser created my matplotlit. Now I want to show the axis values when there is mouseover event. ...

Python web hosting: Numpy, Matplotlib, Scientific Computing

I write scientific software in Numpy/Scipy/Matplotlib. Having developed applications on my home computer, I am now interested in writing simple web applications. Example: user uploads image or audio file, my program processes it using Numpy/Scipy, and output is displayed on the browser using Matplotlib, or perhaps the user can download a...

Python :How to generate a power law graph

I have installed networkx and matplotlib packages. How can I generate a power law graph based on degree correlation i.e. graphs with high or low degree of homophily ...

Matplotlib in Python - Drawing shapes and animating them

So I'm representing a token ring network (doing the simulation in SimPy), I'm a totally newbie to matplotlib, but I was told that it'd be really good for representing my simulation visually. So I googled around and found out how to draw shapes and lines - using add_patch and add_line respectively to the axes (I believe). So now I have t...

Matplotlib with dual scale mouse over

Hello all, I try to plot some curves with matplotlib using the default gui component and have some trouble to select which of the two y-axes that the mouse over functionality should select. The default case seems to be that ax2 gets selected but I would like to use ax1 instead. Is this possible to fix in some easy way? This is the cod...

No plot window in matplotlib

I just installed matplotlib in Ubuntu 9.10 using the synaptic package system. However, when I try the following simple example >>> from pylab import plot; >>> plot([1,2,3],[1,2,3]) [<matplotlib.lines.Line2D object at 0x9aa78ec>] I get no plot window. Any ideas on how to get the plot window to show? ...

using the symbol font for Greek symbols in TeX via matplotlib

To annotate my figures with Greek letters in the matplotlib package of Python, I use the following: import matplotlib matplotlib.use('PDF') import matplotlib.pyplot as plt from matplotlib import rc rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) plt.rcParams['ps.useafm'] = True rc('font',**{'family':'sans-serif','sans-se...

Hiding axis text in matplotlib plots

Hi All, I'm trying to plot a figure without tickmarks or numbers on either of the axes (I use axes in the traditional sense, not the matplotlib nomenclature!). An issue I have come across is where (for example) matplotlib adjusts the x(y)ticklabels by subtracting a value N, then adds N at the end of the axis. This may be vague, but the...

Individually labeled bars for bar graphs in matplotlib / Python

I am trying to create bar graphs of letter frequency in Python. I thought the best way to accomplish this would be matplotlib, but I have been unable to decipher the documentation. Is it possible to label the bars of a matplotlib.pyplot.hist plot with one letter per bar, instead of a numerical axis? I think it must be, but I have not use...