matplotlib

Customizing matplotlib image display to add copy/paste

I would like to customize matplotlib image display so that i can type control-c and it will copy the image to the clipboard so then i can copy it to openoffice spreadsheet to organize all of my raw data and image results. Is there any way to do this? Thanks! ...

mplot3d broken ubuntu 10.04

I'm trying to use mplot3d. I installed matibplot using the Ubuntu (lucid) repositories and it seems broken out-of-the-box. Any help would be appreciated. This is the code I'm running: from __future__ import division from mpl_toolkits.mplot3d import Axes3D from random import * from scipy import * import matplotlib.pyplot as plt locA = ...

How do you determine which backend is being used by matplotlib?

Either interactively, such as from within an Ipython session, or from within a script, how can you determine which backend is being used by matplotlib? ...

in Matplotlib, what does "111" means in fig.add_subplot(111)??

hi, I've been reading like crazy the documentation but i cant find an explication for the "111".. sometimes i see a 212. It'd be great if you could explain it to me or give me the link in the documentation that explains it. Thxs! ...

Matplotlib how to show logarithmically spaced grid lines at all ticks on a log-log plot?

I'm trying to plot a log-log graph that shows logarithmically spaced grid lines at all of the ticks that you see along the bottom and left hand side of the plot. I've been able to show some gridlines by using matplotlib.pyplot.grid(True), but this is only showing grid lines for me at power of 10 intervals. So as an example, here is wha...

How do I make bar plots automatically cycle across different colors?

In matplotlib, line plots color cycle automatically. These two line plots would have different colors. axes.plot(x1, y) axes.plot(x2, y) However, bar plots don't. Both these data series will have blue bars. axes.bar(x1, y) axes.bar(x2, y) How do I make bar plots cycle automatically across a predefined set of colors? ...

how to insert a small image on the corner of a plot with matplotlib?

Hi, What i want is really simple. I have a small image file called "logo.png" that i want to display on the upper left corner of my plots. But you cant find any example of that in the examples gallery of matplotlib Im using django, and my code is something like this def get_bars(request) ... fig = Figure(facecolor='#F0F0F0',fig...

Python matplotlib: memory not being released when specifying figure size

I'm using matplotlib to generate many plots of the results of a numerical simulation. The plots are used as frames in a video, and so I'm generating many of them by repeatedly calling a function similar to this one: from pylab import * def plot_density(filename,i,t,psi_Na): figure(figsize=(8,6)) imshow(abs(psi_Na)**2,origin =...

set axis limits in matplotlib pyplot

Hello, I have two subplots in a figure. I want to set the axes of the second subplot such that it has the same limits as the first subplot (which changes depending on the values plotted). Can someone please help me? Here is the code: import matplotlib.pyplot as plt plt.figure(1, figsize = (10, 20)) ## First subplot: Mean value in each...

Matplotlib: multiple y axes, grid lines applied to both?

I've got a Matplotlib graph with two y axes, created like: ax1 = fig.add_subplot(111) ax1.grid(True, color='gray') ax1.plot(xdata, ydata1, 'b', linewidth=0.5) ax2 = ax1.twinx() ax2.plot(xdata, ydata2, 'g', linewidth=0.5) I need grid lines but I want them to apply to both y axes not just the left one. The scales of each axes will diffe...

Matplotlib estimates width of text wrong

When using Matplotlib (Pylab) for rendering Text with the same metrics as AriaL (e.g., Arial itself or Liberation Sans) output looks ok - e.g., the width of the legend box is right. However, when using other fonts it seems that Matplotlib wrongly estimates the expected size of the text. For example, with Bitstream Vera Sans the text see...

matplotlib: format axis offset-values to whole numbers or specific number

I have a matplotlib figure which I am plotting data that is always referred to as nanoseconds(1e-9). On the y-axis, if I have data that is tens of nanoseconds, ie. 44e-9, the value on the axis shows as 4.4 with a +1e-8 as an offset. Is there anyway to force the axis to show 44 with a +1e-9 offset? The same goes for my x-axis where the...

How can I plot points so they appear over top of the spines with matplotlib?

The following generates a plot with three data points, at (0, 0), (0, 0.5), and (1, 1). Only that portion of the plotted points (small circles) which lie inside the plot area is visible, so I see quarter-circles in the corners, and a half circle along the left spine. Is there a trick I can use to make all the points fully visible, so t...

Shading an area between two points in a matplotlib plot

How do you add a shaded area between two points in a matplotlib plot? In the example matplotlib plot below, I manually added the shaded, yellow area using Skitch. I'd like to know how to do this sans-Skitch. ...

Why doesn't the save button work on a matplotlib plot?

I have matplotlib 1.0.0 installed in a Python 2.7 virtualenv on Mac OS X 10.6. I can create plots fine. However, whenever I press the Save button, I can't type text into the save dialog window nor can I save the plot. The only thing I can do is hit cancel. Any thoughts on what's causing this and how to fix it? Matplotlib installation ...

Use py2app with Matplotlib and its Tex formatting? Dvipng not found.

I have an application put together in py2app on OS X 10.6 which uses Matplotlib to generate graphs. (Using py2app version 0.5.3 and matplotlib version 0.99.3, if it matters.) I have the Tex formatting option enabled: ... from matplotlib import rc rc('text', usetex=True) ... The script works fine when executed in the command line, incl...

Reading a file in Python while logging data in screen

Background To capture data from a logic controller, I'm using screen as a terminal emulator and connecting my MacBook via the KeySpan USA-19HS USB Serial Adapter. I've created the following bash script, so that I can type talk2controller <filename> where filename is the name of the data file. #!/bin/bash if [ -z "$1" ]; then echo P...

[matplotlib] customize ticks for AxesImage?

Hi, I have created an image plot with ax = imshow(). ax is an AxesImage object, but I can't seem to find the function or attribute I need to acess to customize the tick labels. The ordinary pyplots seem to have set_ticks and set_ticklabels methods, but these do not appear to be available for the AxesImage class. Any ideas? Thanks ~ ...

Multi-panel time series of lines and filled contours using matplotlib?

If I wanted to make a combined image like the one shown below (original source here), could you point me to the matplotlib objects do I need to assemble? I've been trying to work with AxesImage objects and I've also downloaded SciKits Timeseries - but do I need this, or can is it as easy to use strptime, mktime, and strftime from the t...

how to reverse color map image to scalar values

How do I invert a color mapped image? I have a 2D image which plots data on a colormap. I'd like to read the image in and 'reverse' the color map, that is, look up a specific RGB value, and turn it into a float. For example: using this image: http://matplotlib.sourceforge.net/_images/mri_demo.png I should be able to get a 440x360 ma...