Tagged Questions
0
votes
1answer
8 views
ipython not producing output graph using matplotlib
SO I have recently started trying to use ipython, I am finding I cannot get it to produce an output graph. I am running the following code in ipython:
from sklearn import linear_model
regr = ...
1
vote
1answer
22 views
pandas multiple plots not working as hists
with a dataframe df in Pandas, I am trying to plot histograms on the same page filtering by 3 different variables; the intended outcome is histograms of the values for each of the three types. The ...
0
votes
0answers
4 views
How to deal with multiple objects listening to motion_notify_events on the same figure
I'm using matplotlib :
Let's say I have an object A, which has two attributes B and C, and a method that draws a figure. Both B and C have methods doing some stuff on the figure on events ...
1
vote
1answer
13 views
Minor ticks in matplotlib's colorbar
I'm currently trying to set minor ticks in the colorbar but simply can't make it work. There are 3 approaches which I've tried (see code below), but all of them didn't appear to be working. Is it ...
1
vote
1answer
24 views
IPython/matplotlib: Return subplot from function
Using Matplotlib in an IPython Notebook, I would like to create a figure with subplots which are returned from a function:
import matplotlib.pyplot as plt
%matplotlib inline
def ...
1
vote
2answers
26 views
Contourplot with 2 different step sizes in matplotlib
This question has probably a totally simple solution but I just can't find it. I'd like to plot a contourf plot where the one part of my data varies in steps of order 1 and the other part varies with ...
1
vote
1answer
16 views
subplots in reverse order
The subplots I am taking are in reverse order.
legend=('data','fit')
mycolor=('b-','r-')
y_label=('4th','5th')
for i in range(2):
for label,color in zip(legend,mycolor):
...
0
votes
1answer
43 views
2D plotting with colors (like spectrograms/magnitude plots)
How to plot, with Python, a 2D matrix A[i,j] like this :
i is the x-axis
j is the y-axis
A[i,j] is a value between 0 and 100 that has to be drawn by a colour (ex : 0=blue, 100=red)
Is there a ...
0
votes
1answer
26 views
How to translate a 2D histogram in matplotlib?
I wish to translate the histogram along a vector, say (2, 2).
axes.imshow(np.transpose(WeightOrDigitalMap),
vmin=constants.FIDELITY_THRESHOLD, vmax=constants.FIDELITY_UPPER_LIMIT,
...
0
votes
1answer
18 views
How can I select which multi-index axis splits the data in a groupby object across different subplots?
I'm working with a pandas.groupby object to which I have applied a function as such:
x = data.groupby(['congruent', 'contrast']).apply(lambda s: s.mean())[['cresp1', 'cresp2']]
Output of print x:
...
1
vote
2answers
33 views
xPython savefig memory leak unresolved with formerly proposed solutions
EDIT: ISSUE STILL NOT SOLVED
That's very surprising. I now moved my savefig() function into an external module, which I import when executing my script. Here is the function:
def ...
1
vote
3answers
29 views
Plotting line segments from the set of startpoints and endpoints
Suppose you have an array a with shape (n,2,2) which consists of coordinates of startpoints and endpoints of n line segmenets. How should one plot these line segments. My code doesn't work although it ...
0
votes
0answers
27 views
Python — Matplotlib return a plot based on user mouse-input
This class sets the P and Q and P+Q=R of an elliptic curve. However, the inputs for a,b, and the others are set in main(). I'd like to set them as user-driven from mouse interaction. So, the user ...
0
votes
1answer
19 views
Using Matplotlib imshow to show GIF image
I need to show a background to a matplotlib plot using ax.imshow(). The background images that I will be using are GIF-images. Despite having PIL installed, the following code results in an error ...
1
vote
0answers
24 views
Stack Spectrograms Python
I am trying to stack 2 spectrograms and I am not able to see the stacked spectrograms.
Here's my code:
Pxx1, freqs, bins, im = specgram(test_data, NFFT=NFFT, Fs=Fs, noverlap=900, cmap=cm.gist_heat)
...
1
vote
2answers
24 views
How to remove gaps between subplots in matplotlib?
The code below produces gaps between the subplots. How do I remove the gaps between the subplots and make the image a tight grid? New user and cannot post image.
for i in range(16):
i = i + 1
...
1
vote
0answers
34 views
Animation based on only updating colours in a plot
I have a plot which consists of great number of lines. At each step the colours of lines should get updated in the animation, but doing a for loop on lines seems to be really costly. Is there any ...
0
votes
1answer
29 views
Shifting the triangles order to match colormap
This question is a sequel of a previous one but regarding this time the colormap and the order of the triangle. I want to interpolate experimental data over a surface so as to enable a continuous ...
0
votes
1answer
31 views
Error while attempting to add color bar
I'm attmbting to create a correlation matrix. creating the matrix works fine, until I attempt to add the color bar.
This is my current code:
def corr_matrix(data):
'''function to find the mean ...
0
votes
1answer
31 views
Draw a rectangle with a shadow on a plot
Currently, to draw a rectangle on my plot in matplotlib, I use:
currentAxis = plt.gca()
rect = mpatch.Rectangle((0.2, 0.420), 5.65, 0.730, edgecolor = None, facecolor = "white", zorder = 3)
...
2
votes
1answer
26 views
ipython terminal : keyboard input perturbed after plotting
I'm using ipython 1.1.0 (installed with macports) and matplotlib 1.3.1 with the qt4agg backend (I'm on a mac, and can't use the 'macosx' backend for other problems). I have a very frustrating problem ...
1
vote
0answers
42 views
format for a graph function?
here´s my function grapher program, which plots graphs:
import wx
import numpy
import matplotlib
from matplotlib.figure import Figure
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg ...
2
votes
1answer
16 views
Matplotlib - Show legend with multiple colours representing the same value
I'm making plots where there are multiple bars displaying the same statistic but over different time periods. I want to create a legend which displays both colours for a particular value in the same ...
0
votes
1answer
28 views
Renderer problems using Matplotlib from within a script
I've narrowed down to this call:
fig.canvas.tostring_argb() #fig=matplotlib.pyplot.figure()
this function raises an AttributeError when I run the code as a python script.
AttributeError: ...
1
vote
1answer
33 views
Python issue with matplotlib Pie Chart Function (erraneous labels)
I am having a strange issue when setting up pie charts using matplotlib. For some reason, it does not seem to be handling my labels argument correctly.
A little background...I am working on a tool ...
1
vote
2answers
32 views
How to adjust the size of matplotlib legend box?
I have a graph whose left upper corner is quite blank. So I decide to put my legend box there.
However, I find the items in legend are very small and the legend box itself is also quite small.
By ...
2
votes
1answer
24 views
How to make markers on lines smaller in matplotlib?
The documentation on matplotlib markers here teaches me I can have several styles of the markers. For example, I may have '-o' for circles on the line, '-*' for stars on the line and '-s' for square ...
1
vote
0answers
20 views
resizing rectangle on multiple axes on mouse motion : on using blit, draw_artist
I have a figure consisting in multiple axes, and on several of them I want to draw N rectangles to highligtht x intervals. There would be N identical rectangles on each panel. On a click, a new ...
0
votes
1answer
39 views
How do I plot the decision boundary of a regression using matplotlib?
How do I add a countour map of the results of the logistic regression to my scatterplot? I want colored 0/1 zones, which delineate the decision boundary of the classifier.
import pandas as pd
import ...
1
vote
1answer
33 views
Matplotlib 1.3.1: plot(matrix(“1,2,3”)) -> RuntimeError: maximum recursion depth exceeded
I am working with python 2.7.5 using
numpy.version: 1.7.1
matplotlib.version: 1.3.1
When I start "ipython2 --pylab" and execute the following code
x = matrix("1,2,3")
plot(x)
I get the error ...
1
vote
2answers
19 views
Matplotlib: change colormap after the fact
I'm charting the progress of a differential equation solver (boundary value problem). Each iteration yields a complete set of function evaluations f(x), which can then be plotted against x. Each graph ...
0
votes
1answer
20 views
missing wedge in matplotlib contourf plot
I'm trying to plot a contour plot in matplotlib and I keep getting a missing "wedge". The following example illustrates what I'm trying to do.
import numpy as np
import matplotlib.pyplot as plt
...
-4
votes
1answer
45 views
I would like to reproduce this graph [on hold]
I am trying to reproduce this figure. Where this case is a heptagon, and the center line until the vertex is a measure between [0-1]. The colored lines would be the result found by an algorithm ...
1
vote
4answers
55 views
Can we draw digital waveform graph with Pyplot in python or Matlab?
I am trying to draw digital signal waveform graph for bits like 01010101010101 using pyplot in python, like
Is it possible with Pyplot?
-2
votes
1answer
38 views
How to visualize 95% confidence interval in matplotlib?
I have learned how to find the 95% confidence interval with scipy.stats.t like so
In [1]: from scipy.stats import t
In [2]: t.interval(0.95, 10, loc=1, scale=2) # 95% confidence interval
Out[2]: ...
0
votes
1answer
34 views
Cosinus graph drawing [duplicate]
I'd like to make a program which draws a cosinus graph in orderd range. But there is an error which I'm not able to repair. Error Message: "AttributeError: program instance has no attribute 'mp'" Here ...
1
vote
2answers
37 views
Cosinus drawing
I'd like to make a program which draws a cosinus graph in orderd range. But there is an error which I'm not able to repair. Error Message: "z = int(self.entry.get())
AttributeError: program instance ...
0
votes
1answer
23 views
How do I display a matplotlib figure window on top of all other windows in Spyder
I am using the Spyder IDE and I find that matplotlib figure windows always get displayed behind other windows. For example, immediately after starting Spyder, if I type plt.plot([0,1],[0,1]) in the ...
0
votes
0answers
10 views
Python pylab ImportError: DLL load failed Windows 7 64 Bit
So far I have done a complete uninstall and reinstall of python, pylab, and numpy. I am running python version 2.5.4.
I'm trying to import pylab and numpy into a Problem Set I am working on for MIT ...
1
vote
0answers
40 views
Python — Matplotlib mouse interaction in chart
Let's say that I have some code that is somewhat similar to this (not taking ownership, just need this to ask the question). So it'll plot a finite-field related math function (elliptic curve) on a ...
1
vote
2answers
42 views
Changing colour scheme of python matplotlib python plots [duplicate]
I want to set a colour scheme for my python plots, so that they don't repeat the same colour like they are for A and H in the top plot shown below. (sorry if its difficult to see).
The code I'm ...
3
votes
1answer
19 views
update an artiste (Line2D) on a figure without re-drawing the whole figure - axes.draw_artist() crashes
I want a line (Line2D) object to move with the current cursor position on several axes of a figure. The way I'm doing it now is to re-draw the whole figure each time the cursor moves, by calling
...
1
vote
1answer
25 views
Modifying number of ticks on Pandas hourly time axis
If I have the following example Python code using a Pandas dataframe:
import pandas as pd
from datetime import datetime
ts = pd.DataFrame(randn(1000), index=pd.date_range('1/1/2000 00:00:00', ...
3
votes
1answer
36 views
Matplotlib FuncAnimation slow
I have created a simple animation of a surface binding process using matplotlib's FuncAnimation. The result however is very slow. I suspect it is because I am redrawing all elements at each frame, but ...
0
votes
2answers
39 views
Python: How to update plot
I created a graphic with matplotlib using subplot, so
self.figure = Figure()
self.axes = self.figure.add_subplot(111)
.
.
.
t = np.arange(0.0, 30.0, 0.01)
self.axes.plot(t)
Now, when I press a ...
2
votes
2answers
87 views
Plot Normal distribution with Matplotlib
please help me to plot the normal distribution of the folowing data:
DATA:
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
h = [186, 176, 158, 180, 186, 168, 168, ...
0
votes
2answers
78 views
Fitting a Normal distribution to 1D data
I have a 1 Dimentional array and I can compute the "mean" and "standard deviation" of this sample and plot the "Normal distribution" but I have a problems:
I want to plot the data and Normal ...
2
votes
2answers
23 views
How to plot an ogive?
I'm wondering if there exists a way to plot a histogram and an ogive using matplotlib in Python.
I have the following for plotting a histogram
a = np.array(values)
plt.hist(a, 32, normed=0, ...
4
votes
1answer
55 views
How to 'turn off' blurry effect of imshow() in matplotlib?
I want to make a color plot of probabilities however imshow generates blurry values for points which have zero probability. How can I get rid of this blurry periphery around real grid points?
...
1
vote
0answers
16 views
Scale axes 3d in matplotlib
I'm facing issues in scaling axes 3d in matplotlib. I have found another questions but somehow the answer it does not seems to work. Here is a sample code:
import matplotlib as mpl
import numpy as np
...