matplotlib

Trying to position subplots next to each other

I am trying to position two subplots next to each other (as opposed to under each other). I am expecting to see [sp1] [sp2] Instead, only the second plot [sp2] is getting displayed. from matplotlib import pyplot x = [0, 1, 2] pyplot.figure() # sp1 pyplot.subplot(211) pyplot.bar(x, x) # sp2 pyplot.subplot(221) pyplot.plot(x, x) pyp...

place labels between ticks

in matplotlib, how do i place ticks labels between ticks (not below ticks) for example: when plotting a the stock price over time i would like the x axis minor ticks to display months and the years to show up between consecutive x axis major ticks (not just below the major ticks) ---|---|---|---|---|---|---|---|---|---|---|---|---|---|...

matplotlib border width

I use matplotlib 0.99 so, I can`t change width of border of subplot.. how can I do it? code like it: fig = plt.figure(figsize = (4.1, 2.2)) ax = fig.add_subplot(111) and then, ax.patch.set _ linewidth(0.1) or ax.get _ frame().set _ linewidth(0.1) doesn`t work! but legend.get _ frame().set _ linewidth(0.1) works fine. ...

Sharing contour plot attributes between subplots

I'm plotting several contour plots side by side for visualizing the time evolution of certain function. I want each contour's value and color to be shared between all subplots, but each time I add a new subplot, the contour values are recomputed (as shown in the image below), so any comparison between them is meaningless. I've tried s...

matplotlib for R user?

Hi, I regularly make figures (the exploratory data analysis type) in R. I also program in Python and was wondering if there are features or concepts in matplotlib that would be worth learning. For instance, I am quite happy with R - but its image() function will produce large files with pixelated output, whereas Matlab's equivalent figur...

Creating an Infographic In Python

I want to create a simple infographic in python. Matplotlib seems to have a lot of features but nothing that covers off my simple heatmap grid example. The infographic is a simple 5 x 5 grid with numbers inside ranging from 0 to 1. The grid squares would then be coloured in 0=white 1=blue 0.5 being a pale blue. Matplotlib could probabl...

matplotlib multiple figure arrangement

Can we control where matplotlib places figures on the screen? I want to generate four figures (in four separate windows) that do not overlap. Thanks. ...

How to plot an image with non-linear y-axis with Matplotlib using imshow?

How can I plot an 2D array as an image with Matplotlib having the y scale relative to the power of two of the y value? For instance the first row of my array will have a height in the image of 1, the second row will have a height of 4, etc. (units are irrelevant) It's not simple to explain with words so look at this image please (that's...

Arched Relationship Infographic In Python

This is a very specific inforgraphic challange altough the fundemental question is how do you build archs between words using matplotlib, cario or an other python libary. Given a the following data structure. me, you, 7 | me, apple, 9 | apple, you, 1 | bike, me, 5 Names would be displayed horizontally the names with the most relation...

Matplotlib: draw grid lines behind other graph elements

In Matplotlib, I make dashed grid lines as follows: fig = pylab.figure() ax = fig.add_subplot(1,1,1) ax.yaxis.grid(color='gray', linestyle='dashed') however, I can't find out how (or even if it is possible) to make the grid lines be drawn behind other graph elements, such as bars. Changing the order of adding the grid versus addin...

Multiple grids on matplotlib

Hi, I'm making plots in python and matplotlib, which I found huge and flexible, till now. The only thing I couldn't find how to do, is to make my plot have multiple grids. I've looked into the docs, but that's just for line style... I'm thinking on something like two plots each one with a different grid, which will overlap them. So, for...

Quitting matplotlib.pyplot animation gracefully

I have a script that plots data of some photometry apertures, and I want to plot them in an xy plot. I am using matplotlib.pyplot with python 2.5. The input data is stored in around 500 files and read. I am aware that this is not the most efficient way of inputting the data but that's another issue... Example code: import matplotlib.p...

plotting data from postgresql in python

Can you help me with plotting data from postgresql database (postgis) in python with matplotlib? There are .shp polygons in that database. I need to create simple graphic interface to show those polygons. (cant use any other software, only python and matplotlib). Thank you! ...

Microprocessor to RS-232 realtime plot using PySerial/Matplotlib?

Greetings! I'm new to the world of Python and my programming skills are fairly poor but I'm trying to figure a way to use Python to display the output from an EEG circuit (using the OpenEEG circuit http://openeeg.sourceforge.net) The analogue output is amplified and processed via an ADC (in an ATmega8 microcontroller) and is converted ...

Plotting vector fields in python (matplotlib)

I found this code on http://matplotlib.sourceforge.net/examples/pylab%5Fexamples/quiver%5Fdemo.html from pylab import * from numpy import ma X,Y = meshgrid( arange(0,2*pi,.2),arange(0,2*pi,.2) ) U = cos(X) V = sin(Y) #1 figure() Q = quiver( U, V) qk = quiverkey(Q, 0.5, 0.92, 2, r'$2 \frac{m}{s}$', labelpos='W', fontprop...

Problem with the size of the arrows on a vector field plot

I would like to know how can I make it so the arrows have a length of sqrt(2) (as their x and y coordinates have length 1). As you can see for the picture shown bellow, they seem quite small. Thanks! from pylab import * from numpy import ma X = (0, 0, 0) Y = (0, 1, 2) quiver(X, Y, (1, 1, 1), (1, 1, 1)) #axis([0, 1, 0, 3]) show...

how to use matplotlib in django?

Using Django 1.0.1, Python 2.6.2 (linux) From some examples from the internet I made the test code below. It works! ... BUT if I reload the page, the pie will draw itself in the same image. Some parts get darker every time I reload the page. When I restart the the development server, it is reset. How do I draw properly with matplotlib...

Is it possible to make a custom mouse cursor with Python Tkinter? (Using matplotlib with the TkAgg backend)

It's likely that this is just a general Python Tkinter question, not necessarily a matplotlib one. So I'm in the midst of developing a rather large suite of plotting functionality on top of matplotlib using the Matplotlib "TkAgg" backend (Agg rendering to a Tk canvas using TkInter). I'm using some of the default zooming functionality p...

How to disable screen update in matplotlib

I have a loop that is adding a line to a plot on each iteration. Right now this is horribly slow as it seems to redraw the the whole graph each time. Is it possible to disable screen updates for a graph while it is being set up then re-enable them afterwards. Here's the code: for rr,dd in zip(angles,dists): if dd == inf: ...

matplotlib: Controlling pie chart font color, line width

I'm using some simple matplotlib functions to draw a pie chart: f = figure(...) pie(fracs, explode=explode, ...) However, I couldn't find out how to set a default font color, line color, font size – or pass them to pie(). How is it done? ...