matplotlib

Matplotlib coord. sys origin to top left

How can I flip the origin of a matplotlib plot to be in the upper-left corner - as opposed to the default lower-left? I'm using matplotlib.pylab.plot to produce the plot (though if there is another plotting routine that is more flexible, please let me know). I'm looking for the equivalent of the matlab command: axis ij; Also, I've sp...

How to make several plots on a single page using matplotlib?

I have written code that opens 16 figures at once. Currently they all open as separate graphs. I'd like them to open all on the same page. Not the same graph. I want 16 separate graphs on a single page/window. Also for some reason the format of the numbins and defaultreallimits doesn't hold past figure 1. Do I need to use the subplo...

Giving graphs a subtitle in matplotlib

I want to give my graph a title in big 18pt font, then a subtitle below it in smaller 10pt font. How can I do this in matplotlib? It appears the title() function only takes one single string with a single fontsize attribute. There has to be a way to do this, but how? ...

Python with matplotlib - drawing multiple figures in parallel

I'm have functions that contribute small parts of a figure generation. What I'm trying to do is to use these functions to generate multiple figures? So something like this: work with Figure 1 do something else work with Figure 2 do something else work with Figure 1 do something else work with Figure 2 If anyone could help, that'd be ...

plotting in matplotlib

I have to plot 2 graphs in a single screen. x-axis remains the same but y-axis should b different. How can I do it in 'matplotlib' ? ...

Python with matplotlib - reusing drawing functions

I have a follow up question to this question. Is it possible to streamline the figure generation by having multiple python scripts that work on different parts of the figure? For example, if I have the following functions: FunctionA: Draw a histogram of something FunctionB: Draw a box with a text in it FunctionC: Draw a plot ...

Constructing matplotlib Figure from Basemap and PolyCollection

Greetings lords and ladies, I am given a method that returns instances of mpl_toolkits.basemap.Basemap and matplotlib.collections.PolyCollection and I need to construct a matplotlib.figure.Figure out of them. Calling matplotlib.pyplot.gcf() did not help. Can you advise me or point into the right direction? Thank you. ...

matplotlib svg requires plugin to view

I am trying to dymamically render an SVG image from matplotlib and insert it into the HTML document. I am using Cairo.SVG as the matplotlib backend. Now whenever I try to insert it into the <img src="/url_to_graph" /> //or <object data="/url_to_graph" /> I either get nothing or the "Missing Plugins" error from Firefox. FYI I am ...

Matplotlib Legend for Scatter with custom colours

I'm a bit of newbie at this and am trying to create a scatter chart with custom bubble sizes and colours. The chart displays fine but how do I get a legend saying what the colours refer to. This is as far as I've got: inc = [] out = [] bal = [] col = [] fig=Figure() ax=fig.add_subplot(111) inc = (30000,20000,70000) out = (80000,3000...

How can this python function code work?

this is from the source code of csv2rec in matplotlib how can this function work, if its only parameters are 'func, default'? def with_default_value(func, default): def newfunc(name, val): if ismissing(name, val): return default else: return func(val) return newfunc ismissing takes a na...

How does this work?

So I'm trying to comprehend the source file for csv2rec in matplotlib.mlab. It is used to take a csv file and parse the data into certain formats. So it may take a string '234' and convert it to int. or take a date string and make it into python datetimes. def get_converters(reader): converters = None for i, row in enumera...

Octave colorbar and units

In GNU Octave you can make a picture where different colors represent different values in a matrix. You can also add a colorbar, which shows what color corresponds to what value. Is it possible to somehow add units to the values shown in the colorbar? Instead of saying “0.36” it would say “0.36 V/nm”? I know this is possible in Matlab, ...

Compile Matplotlib for Python on Snow Leopard

I've killed half a day trying to compile matplotlib for python on Snow Leopard. I've used the googles and found this helpful page (http://blog.hyperjeff.net/?p=160) but I still can't get it to compile. I see comments from other users on that page, so I know I'm not alone. I already installed zlib, libpng and freetype independently. I...

Pytom matplotlib 3d bar function

Hello! How to add strings to the axes in Axes3D instead of numbers? I just started using the matplotlib. I have used Axes3dD to plot similar to the example given on their website (http://matplotlib.sourceforge.net/examples/mplot3d/bars3d%5Fdemo.html). Note that one must use the last verson (matplotlib 0.99.1), otherwise the axis gets a...

Matplotlib square boxplot

Hi all, I have a plot of two boxplots in the same figure. Due to style reasons, the axis should have the same length, so that the graphic box is squared. I tried to use the set_aspect method, but the axis are too different by means of range and the result is terrific. Is it possible to have 1:1 axis even if they have not the same numbe...

How can I get the (x,y) values of the line that is ploted by a contour plot (matplotlib)?

Hello everybody, Is there an easy way to get the (x,y) values of a contour line that was plotted like this: import matplotlib.pyplot as plt x = [1,2,3,4] y = [1,2,3,4] m = [[15,14,13,12],[14,12,10,8],[13,10,7,4],[12,8,4,0]] cs = plt.contour(x,y,m, [9.5]) plt.show() Cheers, Philipp ...

Histogram in matplotlib gets cropped at top

I have a Python program that generates a histogram using matplotlib. The problem is that the images that are generated sometimes get cropped at the top. First, here's the relevant code excerpt, where plt is matplotlib.pyplot and fig is matplotlib.figure: plt.hist(grades, bins=min(20, maxScore), range=(0,maxScore), figure=fig.Figure(fi...

Please help install matplotlib. It won't work! (Python)

Hi, I downloaded the source. Untarred it. "sudo python setup.py install". And below are the errors I get. Can someone help? By the way, Numpy is installed. Thanks a lot. src/_image.cpp:5:17: error: png.h: No such file or directory src/_image.cpp: In member function 'Py::Object Image::write_png(const Py::Tuple&)': src/_image.cpp:646: ...

plotting time in python with matplotlib

I have an array of timestamps in the format (HH:MM:SS.mmmmmm) and another array of floating point numbers, each corresponding to a value in the timestamp array. Can I plot time on the x axis and the numbers on the y-axis using matplotlib? I was trying to but somehow it was only accepting arrays of floats.How can I get it to plot the tim...

CherryPy, load image from matplotlib, or in general

I am not sure what I am doing wrong, It would be great if you could point me toward what to read. I have taken the first CherryPy tutorial "hello world" added a little matplotlib plot. Question 1: how do I know where the file will be saved? It happens to be where I am running the file. Question 2: I don't seem to be get the image to open...