matplotlib

How can I remove the top and right axis in matplotlib?

Instead of the default "boxed" axis style I want to have only the left and bottom axis, i.e.: +------+ | | | | | | ---> | | | | +------+ +------- This should be easy, but I can't find the necessary options in the docs. ...

How to create multiline legends in matplotlib?

Hello, I would like the symbols in matplotlib chart to be organized in several lines. For example, I would like to convert this chart: http://img44.imageshack.us/img44/5082/beforeu.png into something like this: http://img41.imageshack.us/img41/4760/afterw.png ...

matplotlib "DLL load failed" when import pylab

hi all, I'm new to matplotlib. My environment is WinXP, PythonWin 2.6.2, NumPy 1.3.0, matplotlib 0.98.5.3. >>> import matplotlib.pylab as pylab Traceback (most recent call last): File "<interactive input>", line 1, in <module> File "D:\Python26\lib\site-packages\matplotlib\pylab.py", line 253, in <module> from matplotlib.pyplot...

How to modify a NumPy.recarray using its two views.

Hi all. I am new to Python and Numpy, and I am facing a problem, that I can not modify a numpy.recarray, when applying to masked views. I read recarray from a file, then create two masked views, then try to modify the values in for loop. Here is an example code. import numpy as np import matplotlib.mlab as mlab dat = mlab.csv2rec(args...

wavelet plot with python libraries

I know that scipy has some signal processing tools for wavelets in scipy.signal.wavelets and a chart can be drawn using matplotlib, but it seems I can't get it right. I have tried plotting a daub wavelet against a linspace, but it's not what I am looking for. I am highly unskilled about wavelets and math in general . :) ...

Returning MatPotLib image as string

I am using matplotlib in a django app and would like to directly return the rendered image. So far I can go plt.savefig(...), then return the location of the image What I want to do is: return HttpResponse(plt.renderfig(...), mimetype="image/png") Any ideas? ...

What is the best plotting library for Python?

What Python plotting library do you recommend? It should be noted the following considerations: is it cross-OS? speed how clean it's interface? "prettyness" of the resulting plots License etc? In the Python Wiki there is a list, but there is little comparison between them. Interesting SO links (not quite duplicates, but usefull t...

How do I convert (or scale) axis values and redefine the tick frequency in matplotlib?

I am displaying a jpg image (I rotate this by 90 degrees, if this is relevant) and of course the axes display the pixel coordinates. I would like to convert the axis so that instead of displaying the pixel number, it will display my unit of choice - be it radians, degrees, or in my case an astronomical coordinate. I know the conversion f...

dynamic plotting in wxpython

Hi all, I have been developing a GUI for reading continuous data from a serial port. After reading the data, some calculations are made and the results will be plotted and refreshed (aka dynamic plotting). I use the wx backend provided in the matplotlib for this purposes. To do this, I basically use an array to store my results, in whic...

How do I limit the border size on a matplotlib graph?

I'm making some pretty big graphs, and the whitespace in the border is taking up a lot of pixels that would be better used by data. It seems that the border grows as the graph grows. Here are the guts of my graphing code: import matplotlib from pylab import figure fig = figure() ax = fig.add_subplot(111...

Python Matplotlib hangs when asked to plot a second chart (after closing first chart window)

Weird behaviour, I'm sure it's me screwing up, but I'd like to get to the bottom of what's happening: I am running the following code to create a very simple graph window using matplotlib: >>> import matplotlib.pyplot as plt >>> fig = plt.figure() >>> ax = fig.add_subplot(111) >>> ax.plot((1, 3, 1)) [<matplotlib.lines.Line2D object at...

Barchart with vertical labels in python/matplotlib

I'm using matplotlib to generate a (vertical) barchart. The problem is my labels are rather long. Is there any way to display them vertically, either in the bar or above it or below it? Note: The best answer will get a 500 bounty. ...

How to scale matplotlib subplot heights individually

Using matplotlib/pylab.... How do I plot 5 heatmaps as subplots which have the same number of columns but different row counts? In other words, I need each subplot's height to be scaled differently. Perhaps an image better illustrates the problem... I need the data points to all be square, AND the columns to be lined up, so the heig...

Generating a graph with multiple (sets of multiple sets of multiple) X-axis data sets

I am looking for a way to generate a graph with multiple sets of data on the X-axis, each of which is divided into multiple sets of multiple sets. I basically want to take this graph and place similar graphs side by side with it. I am trying to graph the build a graph of the duration (Y-axis) of the same jobs (0-3) with different confi...

Python leaking memory while using PyQt and matplotlib

I've created a small PyQt based utility in Python that creates PNG graphs using matplotlib when a user clicks a button. Everything works well during the first few clicks, however each time an image is created, the application's memory footprint grows about 120 MB, eventually crashing Python altogether. How can I recover this memory afte...

Resize a figure automatically in matplotlib

Is there a way to automatically resize a figure to properly fit contained plots in a matplotlib/pylab image? I'm creating heatmap (sub)plots that differ in aspect ratio according to the data used. I realise I could calculate the aspect ratio and manually set it, but surely there's an easier way? ...

How to skip empty dates (weekends) in a financial matplotlib python graph?

ax.plot_date((dates, dates), (highs, lows), '-') I'm currently using this command to plot financial highs and lows using matplotlib. It works great, but I also need the option to remove the blank spaces in the x-axis left by days without market data, such as weekends and holidays. I have lists of dates, highs, lows, closes and opens....

How to create probability density function graph using csv dictreader, matplotlib and numpy?

I'm trying to create a simple probability density function(pdf) graph using data from one column of a csv file using csv dictreader, matplotlib and numpy... Is there an easy way to use CSV DictReader combined with numpy arrays? Below is code that doesn't work. The error message is TypeError: len() of unsized object, which I'm guessing ...

back-to-back histograms in matplotlib

There is a nice function that draws back to back histograms in Matlab. I need to create a similar graph in matplotlib. Can anyone show a working code example? ...

Show/hide a plot's legend.

I'm relatively new to python and am developing a pyqt GUI. I want to provide a checkbox option to show/hide a plot's legend. Is there a way to hide a legend? I've tried using pyplot's '_nolegend_' and it appears to work on select legend entries but it creates a ValueError if applied to all entries. I can brute force the legend to hid...