Tagged Questions
1
vote
1answer
12 views
Matplotlib: change (main) plot legond label text
So far I have been able to label the subplots just fine but I'm having an issue with the main one...
Here's the relevant part of my code:
data_BS_P = data[channels[0]]
data_BS_R = data[channels[1]]
...
0
votes
0answers
17 views
Matplotlib: image.get_window_extent(renderer) produces all zeros
I am finding that the get_window_extent method for an image object gives all zeros.
For example
import numpy as np
import matplotlib.pyplot as plt
im = np.array([[0.25, 0.75, 1.0, 0.75], [0.1, ...
0
votes
0answers
24 views
saving figure using matplotlib
I have multiple plots each displayed in each tab(each tab is a page in wx.Notebook). I have attached the code snippet used to plot the figure in each tab. Everything is fine till I try to save a ...
0
votes
1answer
10 views
Pandas and Matplotlib - how can I change plot area to fit in more x-axis text?
Say I read in this csv file into a pandas dataframe:
File contents:
Strings, Values, Letters
Made up data, 55.0, A
with long text strings for index, 125.5, B
with long text strings for index, 85.5, ...
0
votes
1answer
16 views
Identify and count points inside a user defined segment
I'm trying to identify and count data points that are within a user defined "wedge" selection. The data points each have their own ID number and are being loaded from a CSV catalog file, while the the ...
0
votes
0answers
12 views
Matplotlib excessive memory use
Given below is the code for reading values from a file and plotting them. I am reading about 36000 values. I am using matplotlib to plot them. If the values are below a certain threshold I am deleting ...
-2
votes
0answers
19 views
Error while running the python code on ubunu12.04 LTS [on hold]
Please find the code sample in the first snippet in the below link, am running it as it is
draw grid lines over an image in matplotlib
Error in atexit._run_exitfuncs:
Traceback (most recent call ...
2
votes
2answers
44 views
How to determine if a black-box is polynomial or exponential
I have a problem which essentially reduces to this:
You have a black-box function that accepts inputs of length n.
You can measure the amount of time the function takes to return the answer, but you ...
0
votes
0answers
12 views
Using Mayavi to make 3D graphs, with Matplotlib-style axes
I've been messing around with Mayavi for 3D graphing, and I can graph the scatter plot I want but can't seem to get the Axes to look proper. I found the following previous question that starts to get ...
0
votes
1answer
25 views
Getting unexpected output when plotting with Matplotlib - Cmap - Python
I have a method in my project in which I verify if a pixel has the desired reliability (in terms of its classification as edge or not) and I plot the pixels in the following scheme:
White -> pixel ...
0
votes
2answers
23 views
How to customize axes in 3D hist python/matplotlib
I am trying to plot this data set using 3D bar
B A freq
1 2003 2
1 2003 2
2 2008 1
2 2007 2
2 2007 2
3 2004 1
1 2004 3
1 2004 3
1 ...
0
votes
1answer
18 views
How to plot specific rows and columns of pandas dataframe (based on name of row and name of column) in bar plot with error bars?
I have data in a csv file structured like so:
Subject group Result1 Result2... ResultN
101 a .5 .1 .2
103 b .1 .2 ...
0
votes
2answers
14 views
Standard ASCII File Format For Plotting from Matplotlib
I am working on a large hardware testing project, and one of the things I've run into is that I'd like to plot data coming out of the Python scripts on the systems doing the testing, but they aren't ...
0
votes
1answer
19 views
Use Func animation python
The following code has been taken from here and modified to fit my requirements:
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
import math
import linecache
...
1
vote
0answers
17 views
pylab.imshow() command brings up blank figure
I'm very new to working with Ipython and the Ipynotebook, but I need to for an upcoming class. Using the notebook, I imported pylab, created a data set using a matrix, and tried to display that data ...
1
vote
0answers
36 views
Normalize an Array to Standard Normal Distribution
I think this is a pretty simple question but I wasn't able to find an answer.
I have an array:
array([ 62519, 261500, 1004836, ... , 0, 0])
I would like to convert it to a normal distribution with ...
2
votes
1answer
29 views
Get the background color of a widget - really
I'm having trouble getting the actual background color of widgets.
In my special case I'm having trouble with widgets within a QTabWidget.
This is on Windows7.
So classic widgets have some greyish ...
0
votes
1answer
24 views
How can I calculate frequency axis after FFT
I have a time series data and I capture some part of it then use numpy.fft.rfft command after that I use
plt.plot(2*abs(result)/len(result))
to show rfft result how can I calculate freq axis? My ...
0
votes
0answers
15 views
3d projection of an object that has a shape of circle, square and triangle with Matplotlib
Is it possible to plot object similar to this figure on 3d space with Python Matplotlib and how would you make it?
I found an example, but don't really know, how to move on from this:
...
3
votes
1answer
36 views
How to modify pandas plotting integration?
I'm trying to modify the scatter_matrix plot available on Pandas.
Simple usage would be
Obtained doing :
iris = datasets.load_iris()
df = pd.DataFrame(iris.data, columns=iris.feature_names)
...
0
votes
2answers
40 views
How to plot 3D hist in python
I have dataset that contains accidents in a region with a year.
> Accident_ID Region Year
> 213 1 2003
> 234 2 2001
> 334 2 ...
0
votes
1answer
28 views
Adding error bars to grouped bar plot in pandas
I'm generating a plot in pandas by first generating the following DataFrame:
plotData=resultData.groupby(['student_model','lo_id']).describe().nShots.unstack().reset_index()
plotData['se'] = ...
1
vote
1answer
27 views
How to draw bar in python
I want to draw bar chart for below data:
4 1406575305 4
4 -220936570 2
4 2127249516 2
5 -1047108451 4
5 767099153 2
5 1980251728 2
5 -2015783241 2
6 -402215764 2
7 927697904 2
7 ...
0
votes
1answer
21 views
Plot bar chart from nested dictionary
How can I plot a bar chart from a nested dictionary such as this?
{
Weekly: {
'Gas': '65.22',
'Electricity': '120.01'
},
Monthly: {
'Gas': '171.05',
...
2
votes
1answer
30 views
Can matplotlib errorbars have a linestyle set?
Is is possible to set the same linestyle to matplotlib errorbars than to the datapoints linestyle?
In the example below, two lines are plotted, one of them is dashed because of the ls='-.' ...
0
votes
1answer
24 views
Plotting with more colors in matpltlib
I am trying to plot a scatter plot using matpltlib, i am getting " IndexError: pop from empty list" error and I am not sure how to fix it.
import matplotlib.pyplot as plt
import matplotlib
import ...
3
votes
1answer
28 views
Annotating gracefully pandas plot with texts that do not overlap
I have the below pandas dataframe containing some events and a count that i'm looking to plot and annotate with event details in the chart:
Date Time Time Zone Currency Event Importance ...
1
vote
0answers
17 views
Matplotlib colorbar forces a centered axis to be left aligned
When I use matplotlib colorbars it seems to take what would have been a centered axis and force it to become left align.
I'm adding a colorbar like this:
def colorbar(scalars, colors):
""" ...
1
vote
2answers
33 views
Numpy fft result is unexpected
I used fft.fft(data) and plotted that result I was expecting to the frequency that I gave in data.
I was expecting to see 50 hz but I got something strange.
import numpy as np
import math as m
import ...
3
votes
1answer
24 views
Different behaviour of hexbin and histogram2d
What is the difference between hexbin and histogram2d?
f, (ax1,ax2) = plt.subplots(2)
ax1.hexbin(vradsel[0], distsel[0],gridsize=20,extent=-200,200,4,20],cmap=plt.cm.binary)
H, xedges, yedges ...
0
votes
3answers
20 views
Imshow aspect doesn’t work well
I make numeric simulations and have problems with my plots... My simulation area is 6x35µm with a resolution of 640x1024px.
When I want to plot my simulation data using imshow, and set the aspect ...
1
vote
0answers
16 views
mpl data error with cx_freeze - Linux 13.10
I am new on stack overflow and I hope I am not asking something obvious. In fact, I did quite a search online and I could not find a proper answer/solution to my problem.
I am building an open-source ...
1
vote
1answer
24 views
Display multiple mpld3 exports on a single HTML page
I've found the mpld3 package to be brilliant for exporting a matplolib plot to HTML and displaying this via a flask app.
Each export comes with a lot of JS which seems unnecessary duplication if you ...
0
votes
3answers
23 views
matplotlib equivalent to skimage.io.imread(fname, as_grey=True)?
As this is a really common practice... I was wondering is the a matplotlib equivalent to this function in scikit-learn?
from skimage import io
im = io.imread(fname, as_grey=True)
To read the RGB ...
0
votes
0answers
16 views
Creating a plot with matplotlib in python, calling the python script from php
I am trying to get the following python script here to be called by the following php script
<?php $mystring = system('python scripts/graph.py ...
1
vote
1answer
11 views
Pylab: Bounding box despite frameon=False
When I set the visibility of the axis to false, the axis are replaced by a bounding box. Please would someone be able to help me to remove the bounding frame.
import pylab
x=[0.1,0.2,0.3,0.4]
...
0
votes
1answer
34 views
Would like to use makeaxes to plot 3 plots with 1 colorbar in matplotlib
Edit - I hope this clarifies. Below is code from this post that is very similar to what I'm trying to do.
fig, axes = plt.subplots(nrows=2, ncols=2, sharex=True, sharey=True)
for ax in axes.flat:
...
2
votes
1answer
26 views
Matplotlib annotation detailed documentation
I am sorry but I really tried to find the following in the documentation:
What does armA, armB, angleA, anngleB each mean in the plt.annotate? For example, in:
ax.annotate('arc', xy=(1.5, -1), ...
-6
votes
0answers
32 views
Plotting two files in Python in the same output [on hold]
I want to plot file1 combined with file2 in the same output using Python, Could you please help me I need it for Tomorrow PLEEEEEEEEEEEEEEEEEEEEEEASE
file1: ...
0
votes
1answer
29 views
Colouring edges by weight in networkx
I have only found something similar to what I want here:
Coloring networkx edges based on weight
However I can't seem to apply this to my problem. I have a graph with weighted edges, but the weights ...
0
votes
1answer
28 views
How to change the colors of pylab legend?
How to change colors of the different legends of a graph? I need to do this in the same line of the "pylab.legend", by my own code issues...
For example:
pylab.legend (("Legend1", "Legend2")) #and ...
1
vote
1answer
36 views
python matplotlib plot sparse matrix pattern
Given a sparse binary matrix A (csr, coo, whatever) I want to make a plot such that I can see the position (i,j) = white in the figure if A(i,j) = 1, and (i,j) = black if A(i,j) = 0;
For a dense ...
2
votes
0answers
13 views
bar3d conflicts with plot_surface in matplotlib?
I want to draw bar graph with a map projected onto the xy plane with the following code:
#!/usr/bin/env python
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.cbook ...
0
votes
1answer
14 views
scipy.interpolate.griddata issue with x/y pairs built from numpy.linspace()
I am playing around with the plot_surface function in matplotlib for plotting 3D surfaces.
I have a simple script for plotting a surface where x, y and z coordinates are all based on a randomly ...
2
votes
1answer
17 views
Matplotlib - plotting transparent and overlapping time series
I've been searching for a solution to generate a figure of overlapping time series, i.e., http://grollchristian.files.wordpress.com/2013/04/wpid-224.png?w=604
However, the only script I found online ...
1
vote
1answer
27 views
Don't display labels in subplot
In the following subplot, I want to have labels displayed in the legend; therefore, I need to have labels set, but I don't want them to be displayed. That is, I want the legend only, I don't want ...
0
votes
1answer
24 views
Add a figure object to AxesSubplot Gridspec
I am using Biopython's Phylo module to generate a tree, and further used gcf to save this current tree as a figure object of matplotlib.
tree = Phylo.read("my tree.nwk", "newick")
Phylo.draw(tree)
...
0
votes
1answer
42 views
class labels in Pandas scattermatrix
This question has been asked before, Multiple data in scatter matrix, but didn't receive an answer.
I'd like to make a scatter matrix, something like in the pandas docs, but with differently colored ...
2
votes
1answer
27 views
Matplotlib bug: Data is shown above spine with twinx()
I'm trying to plot two data sets that differ by some orders of magnitude. After some research (it was literally one google search away) I found out about the twinx() function.
However, I've run into ...
1
vote
1answer
22 views
plt.savefig(): ValueError: All values in the dash list must be positive
Running the code at the below link results in the error. As far as having something to do with the image, I don't know what the 'dash list' is.
matplotlib.pyplot as plt
...
...