All Questions

514
votes
16answers
380060 views

How to put the legend out of the plot

I have a series of 20 plots (not subplots) to be made in a single figure. I want the legend to be outside of the box. At the same time, I do not want to change the axes, as the size of the figure ge...
233
votes
11answers
133326 views

Generating a PNG with matplotlib when DISPLAY is undefined

I am trying to use networkx with Python. When I run this program it get this error. Is there anything missing? #!/usr/bin/env python import networkx as nx import matplotlib import matplotlib.pyplot ...
79
votes
5answers
172986 views

How to update a plot in matplotlib?

I'm having issues with redrawing the figure here. I allow the user to specify the units in the time scale (x-axis) and then I recalculate and call this function plots(). I want the plot to simply upda...
85
votes
3answers
212014 views

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I just discovered a logical bug in my code which was causing all sorts of problems. I was inadvertently doing a bitwise AND instead of a logical AND. I changed the code from: r = mlab.csv2rec(datafi...
127
votes
10answers
241070 views

real-time plotting in while loop with matplotlib

I am trying to plot some data from a camera in real time using OpenCV. However the real-time plotting (using matplotlib) doesn't seem to be working. I've isolated the problem into this simple example...
129
votes
7answers
99233 views

Matplotlib 2 Subplots, 1 Colorbar

I've spent entirely too long researching how to get two subplots to share the same y-axis with a single colorbar shared between the two in Matplotlib. What was happening was that when I called the c...
916
votes
13answers
948087 views

How do you change the size of figures drawn with matplotlib?

How do you change the size of figure drawn with matplotlib?
72
votes
3answers
114809 views

Dynamically updating plot in matplotlib

I am making an application in Python which collects data from a serial port and plots a graph of the collected data against arrival time. The time of arrival for the data is uncertain. I want the plot...
126
votes
7answers
148246 views

Generate a heatmap in MatPlotLib using a scatter data set

I have a set of X,Y data points (about 10k) that are easy to plot as a scatter plot but that I would like to represent as a heatmap. I looked through the examples in MatPlotLib and they all seem to a...
22
votes
2answers
4251 views

How to remove relative shift in matplotlib axis

When I try to do a plot against a range with big enough numbers I get an axis with relative shift for all the ticks. For example: plot([1000, 1001, 1002], [1, 2, 3]) I get these ticks on axis of ab...

Previous Next