1
vote
1answer
20 views

Strange behavior of matplotlib's griddata

I have a .txt file with values x1 y1 z1 x2 y2 z2 etc. With my previous little experience I was trying to draw a contourf, with this code import numpy as np import matplotlib from matplotlib ...
1
vote
1answer
36 views

Error for my plot and calculation of FWHM

I found and copied this code to get the FWHM from Finding the full width half maximum of a peak (2nd to the last answer). My code below uses my own data. The plot generated looks wrong as my data ...
0
votes
0answers
24 views

plot vlines with matplotlib.pyplot

I'm trying to plot vertical lines in a log plot xv1 = 10 plt.semilogy(t,P,'b') plt.semilogy(t,Pb,'r') plt.vlines(xv1,-1,1,color='k',linestyles='solid') plt.xlabel('Time [s]') plt.ylabel('P [Pa]') ...
2
votes
1answer
33 views

How to manually change a colormap in python/matplotlib

I want to use the colormap rainbow in an image using imshow. It works perfectly, but I want to redefine the color for the value 0. Instead of violete, I want to use white. I want to do this only for ...
0
votes
2answers
47 views

Bland-Altman plot in python

The question is pretty straight forward. Is it possible to make a Bland-Altman plot in python ? I can't seem to find anything about it in python. Anyone used this in python ? (another name for it is ...
2
votes
1answer
33 views

Seconds from epoch issues

I am trying to plot time back on the y-axis for a 3D plot after making a grid of it. However the dates come up funny, its supposed to be at least year 2012. I think the seconds from epoch is messing ...
0
votes
0answers
42 views

Animating planetary motion in matplotlib

I'm want to do an animation that will show the movements of planets using matplotlib. Ultimately, I want it to be in 3D, but for now I'm starting with simpler case, just in 2D. I went trough every ...
3
votes
2answers
28 views

Matplotlib logarithmic scale with zero value

I have a very large and sparse dataset of spam twitter accounts and it requires me to scale the x axis in order to be able to visualize the distribution (histogram, kde etc) and cdf of the various ...
0
votes
1answer
31 views

Legend in python without labels

I would like to show a fixed legend in a python matplotlib plot. I am creating a large set of plots, and some of them lack one of the datasets I am using. Let's say I have data1, plotted in green ...
1
vote
0answers
24 views

How to make autoscale_view respect text

fig = plt.figure() ax = fig.add_subplot(111) ax.add_patch(...) # several times ax.text(x,y,"something") # several times ax.autoscale_view() truncates text. I.e. it does not respect text position, ...
0
votes
1answer
37 views

Finding the row/position in a numpy array using a mouse over on a 2D dot plot

I have a 2D dot plot which I generated using matplotlib with 750 points on it. I was trying to use mpldatacursor so that I can mouse over the points to determine the label for a datapoint (i.e. ...
1
vote
1answer
28 views

How to make matplotlib show legend which falls out of figure?

I draw a graph but unfortunately my legend falls out of the figure. How can I correct it? I put a dummy code to illustrate it: from matplotlib import pyplot as plt from bisect import ...
0
votes
1answer
20 views

Force plot to have a special size or to increase the distance between subplots

I am trying to generate a plot by matplotlib that three graphs are in a row and axes have names. Unfortunately the dimension is in a way that labels run into the other graphs. How can I avoid this? ...
1
vote
2answers
37 views

Memory overflow when saving Matplotlib plots in a loop

I am using an iterative loop to plot soame data using Matplotlib. When the code has saved around 768 plots, it throws the following exception. RuntimeError: Could not allocate memory for image My ...
1
vote
1answer
40 views

Matplotlib: Same title for 8 plots plotted using loop

I have the following code which generates 8 plots. I want to put the phases as titles in each plot. So I have succeded to put the phase on the plot. But instead of taking corresponding phase, it is ...
0
votes
1answer
64 views

Plotting two functions simultaneously with matplotlib

basically I want to graph two functions g1 = x*cos(x*pi) g2 = 1 - 0.6x^2 and then plot the intersection, I already have a module that takes inputs close to the two lines intersections, and then ...
-2
votes
1answer
39 views

networkx position specific nodes [closed]

I am using networkx and the spring algorithm to create a network with 34 nodes and directed edges between them. The result is too clustered. I would like to position a few specific nodes (the most ...
2
votes
0answers
38 views

Plot numpy rec array with date

I read pickled numpy array with this structure: >>> h.shape (256,) >>> h[:10] rec.array([(datetime.date(2011, 1, 2), 1, -3, 1014), (datetime.date(2011, 1, 3), 3, -6, 1016), ...
1
vote
1answer
49 views

Histogram in Python Using matplotlib

I am struggling with this really badly. There is something that I'm just not getting. I have a function, which I want to plot a histogram of a dictionary with the keys on the x-axis and the values on ...
2
votes
1answer
22 views

matplotlib figure canvas name

I have a GUI built using PyQt4 where I use matplotlib (FigureCanvas) to plot several plots using multiple canvases (this is intentional rather than using subplots). for each canvas I use method: ...
1
vote
0answers
27 views

Matplotlib on click get node

I want to change color on node that was clicked on def button_press_callback(event): print event.x This is my event that I add to figure: wm.canvas.mpl_connect('button_press_event', ...
3
votes
1answer
25 views

matplotlib + python: figure size for fig.figimage and fig.savefig

I'm trying to add a png image to a plot created with matplotlib in python. Here is my plot code import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt fig = ...
3
votes
1answer
38 views

Create a figure that is reference counted

It seems that the standard way of creating a figure in matplotlib doesn't behave as I'd expect in python: by default calling fig = matplotlib.figure() in a loop will hold on to all the figures ...
0
votes
1answer
31 views

Matplotlib histograms (basic questions)

I am trying to plot a simple histogram using matplotlib. I have for example (I will in practice be using different distance functions) import matplotlib.pyplot as plt import numpy as np import ...
1
vote
1answer
37 views

Drawing from certain probabilities in Gaussian Normal Multivariate Distribution in numpy

I have the code and picture of the output listed below but I want to take random samples from these spheres within the specific standard deviations that have been plotted. The variable sdwith is used ...
0
votes
1answer
31 views

How do I set the compression parameter for PNGs in imsave() (Agg backend)?

I want to disable (or lower as much as possible) the compression for plt.imsave(). I just want to quickly dump out PNG images that are reused almost instantly anyway. Any ideas how to do that? (I am ...
2
votes
3answers
86 views

Create closed polygon from boundary points

I have an array of longitude-latitude points that defines the boundaries of an area. I would like to create a polygon based on these points and plot the polygon on a map and fill it. Currently, my ...
1
vote
1answer
38 views

Is the matplotlib draggable legend not available on Mac OS 10.8?

I have a small python program that takes in data and plots it using matplotlib (v1.3.x). The plot has a draggable legend. It renders fine on Windows, but I get an error on Mac (OS 10.8.3). The code ...
2
votes
1answer
51 views

Plotting data in Python using matplotlib

I'm currently reading "Machine Learning in Action". In the chapter 8 of Regression, p.158 , there are few codes to plot original data point and a fitted line together. import matplotlib.pyplot as ...
3
votes
1answer
45 views

Matplotlib - Wrong normals on 3D bars plot

PROBLEM When using matplotlib and plotting 3d bars on a chart I got wrong normals values on some bar faces. EXAMPLE When I plot a high density bins graph, with 240 bars, I get this result: ...

1 2 3 4 5 108
15 30 50 per page