matplotlib

wxPython GUI: migrating gnuplot to matplotlib

I currently have a GUI built in wxPython with several sections, one of which displays a .png image of a plot: self.plot = wx.BitmapButton(self.pane_system, -1, wx.Bitmap("/home/myname/projects/newton/plot/src/graph.png", wx.BITMAP_TYPE_ANY)) In another part of the GUI, there is a place where I can edit parameters. The current setup is...

In matplotlib, how to draw a bar graphs of multiple datasets to put smallest bars to front?

I want to put multiple datasets on a bar graph and stop the smaller bars being obscured by the larger ones, and I don't want to offset them. For example, bar(0, 1.) bar(0, 2.) only shows the second bar of height of 2.0, the first bar is hidden. Is there a way to get matplotlib to draw the bars with the smallest on top? NB I don't wan...

Matplotlib: Formatting dates on the x-axis in a 3D Bar graph

Given this 3D bar graph sample code, how would you convert the numerical data in the x-axis to formatted date/time strings? I've attempted using the ax.xaxis_date() function without success. I also tried using plot_date(), which doesn't appear to work for 3D bar graphs. Here is a modified version of the sample code to illustrate what I a...

Date versus time interval plotting in Matplotlib

The pyplot plot_date function expects pairs of dates and values to be plotted with a certain line style. Is there a recommended approach to plot multiple values or interval data against date/time values? ...

Fat error bars wanted

Here's a plot I made using matplotlib. It uses the bar and scatter methods from pylab. I have 3 issues: How to make the error bars fatter? No API in bar for this that I can see. How to specify the axes properly? How to stop the x-axis labels from showing? The first is most important, as I have no idea. I guess one more thing would b...

Irregular matplotlib date x-axis labels?

I currently have date x-axis labels in matplotlib in this format: '..., Oct 08, Nov 08, Dec 08, Jan 09, Feb 09, Mar 09, ...' Is it possible to only show the year number for January for every year instead? '..., Oct, Nov, Dec, Jan 09, Feb, Mar, ...' ...

Matplotlib turn off antialias for text in plot?

Is there any way to turn off antialias for all text in a plot, especially the ticklabels? ...

How can I create stacked line graph with matplotlib?

I would like to be able to produce a stacked line graph (similar to the method used here) with Python (preferably using matplotlib, but another library would be fine too). How can I do this? This similar to the stacked bar graph example on their website, except I'd like the top of bar to be connected with a line segment and the area un...

Animate like Google Finance charts in Matplotlib?

I just started toying around with Matplotlib's Animation capabilities in order to produce a Google Finance looking chart. I combined two examples I found on the project website (Draggable rectangle exercise, api example code: date_demo.py) and tweaked them a bit to come up with the code listed at the bottom. While it doesn't look too b...

render users' equations in Python

Hello all! I am a very new/inexperienced Python programmer. I teach maths and am trying to create a GUI graph-plotting package suitable for schoolchildren. As well as plotting a graph, I would ideally like to render the equation a user enters [eg. y = (x^2)/3] in a nicely formatted style - ideally updating in real-time as the user enter...

Grid lines in parasitic axes in matplotlib

Can you draw the grid lines in a plot with parasitic axes in matplotlib? I try this, based on the samples for grids and for parasitic axes, but grid drawing is not performed: from mpl_toolkits.axes_grid.parasite_axes import SubplotHost import matplotlib.pyplot as plt fig = plt.figure(1) host = SubplotHost(fig, 111) fig.add_subplot(ho...

How to incorporate DRAG feature in wxPython

I want to incorporate DRAG feature in program where in I can drag (hand cursor) the canvas which is placed on a panel. DRAG feature will help me see a full picture if the image is out of bound on the axis or if the image is zoomed in. Currently I am using wxmpl library which is a integration of matplotlib and wxPython. but it seems like...

How to get data in a histogram bin.

I want to get a list of the data contained in a histogram bin. I am using numpy, and Matplotlib. I know how to traverse the data and check the bin edges. However, I want to do this for a 2D histogram and the code to do this is rather ugly. Does numpy have any constructs to make this easier? For the 1D case, I can use searchsorted()....

Trouble importing modules in Python IDEs

Right I'm getting a bit tired of this so hopefully you can help me sort it out once and for all. I'm really confused about what's going on with Python on my MacBook. I'm running OS X 10.6.2 and have installed python from the website (the package that includes IDLE). This works absolutely fine, and in fact IDLE will run everything I want...

Python : How to plot 3d graphs using Python?

I am using matplotlib for doing this from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib import matplotlib.pyplot as plt fig = plt.figure() ax = Axes3D(fig) x = [6,3,6,9,12,24] y = [3,5,78,12,23,56] ax.plot(x, y, zs=0, zdir='z', label='zs=0, zdir=z') plt.show() Now this builds a graph that is horizontal in...

plotting lines without blocking execution

Hi All I am using matplotlib to draw charts and graphs. When I plot the chart using the command show() my code blocks at this command. I would like to refresh my list of values with new data , and than refresh the image on the background. How to do that without closing each time the window with the graph? Below is the code I am using ...

How to plot the lines first and points last in matplotlib

I have a simple plot with several sets of points and lines connecting each set. I want the points to be plotted on top of the lines (so that the line doesn't show inside the point). Regardless of order of the plot and scatter calls, this plot comes out the same, and not as I'd like. Is there a simple way to do it? import math import ...

pyplot.ginput() causes axes to change?

I am encountering some strange behavior with using the matplotlib.pyplot ginput() function to store clicked points. On the first click, the ranges of the axes of the clicked image change to add 200 on each side. The image remains with this border of whitespace until something new is plotted. Example code: import matplotlib.pyplot as pl...

How to use custom marker with plot?

I would like to utilize customer markers in both scatter and line charts. How can I make custom marker out of a PNG file? ...

Plotting only upper/lower triangle of a heatmap

In maptplotlib, one can create a heatmap representation of a correlation matrix using the imshow function. By definition, such a matrix is symmetrical around its main diagonal, therefore there is no need to present both the upper and lower triangles. For example: The above example was taken from this site Unfortunately, I couldn't figu...