Tagged Questions
0
votes
0answers
12 views
Matplotlib string xticks
def plot_freq_error(diff,file,possible_frequency):
for foo in range(0, len(diff)):
x = [diff[foo]]
name = comp
color = ['0.1', '0.2', '0.3','0.4','0.5','0.6','0.7','0.8', ...
-1
votes
1answer
18 views
How to get the area under a histogram in python
I have been plotting a histogram. My code looks like this:
x0=-15000
x1=15000
b=np.arange(x0,x1,(x1-x0)/250.)
plt.plot(b[0:-1], plt.hist(non_zeros(-e[0]), bins=b, normed=1, visible=0)[0], color = ...
1
vote
1answer
12 views
Cartopy map fill entire axis
I would like to plot data on a grid (which is in LCC projection) with Cartopy, so that the data fills the entire axis (and also axes, but that is not the issue here).
To make it clearer, here is what ...
-1
votes
0answers
17 views
Setting rectangle colour in matplotlib
For a custom diagram drawing function, I need a way to set colours of rectangles. This some of the code:
# draw many rectangles
for label in labels:
# derive coords...
rect = ...
1
vote
1answer
25 views
python graphing the 1D wave equation (Beginner)
I literally just started learning how to code in Python. I am interested
How to reproduce u[x,t] matrix. I tried return u and it throws me an error.
If the placement of for loops in this code ...
1
vote
2answers
31 views
How to plot in CCDF with a list?
I can very well plot CDF and CCDF when the data is in one column. But I am a little clueless how to plot a CDF or CCDF when the data is in the below given format. The pairs in round brackets () are ...
0
votes
0answers
15 views
Matplotlib_venn: weird output
I have a script that makes a Venn diagram of 3 sets using the matplotlib_venn module, as follows:
union = set_1.union(set_2).union(set_3)
indicators = ['%d%d%d' % (a in set_1, a in set_2, a in set_3) ...
3
votes
0answers
21 views
Matplotlib on Windows - dependency unresolved
I have had problems with using matplotlib after a Windows update. I'm running Windows 7 Service Pack 1 32 bit and I installed Python and matplotlib as part of Python(x,y)-2.7.6.1. The problem appears ...
0
votes
2answers
20 views
matplotlib subplot in a for loop
I have a cluster Ca and coordinates locX and locY
>>> Ca
{0: [0, 13, 14, 17, 19, 22, 30], 20: [1, 15, 18, 20, 24], 37: [4, 8, 9, 33, 37, 40, 47], 41: [3, 5, 7, 28, 32, 34, 36, 39, 41, 42, ...
1
vote
0answers
22 views
Matplotlib, Log color scale on plot but linear colour scale on colorbar legend
I want to plot in log scale, which I have done using:
plt.contourf(cube[0,:,:].data, levels=np.arange(0,6000,10), norm=mplc.LogNorm())
But then I want the colorbar to still be a linear scale...is ...
1
vote
1answer
33 views
Plotting a line plot with error bars and datapoints from a pandas DataFrame
I've been racking my brain to try to figure out how to plot a pandas DataFrame the way I want but to no avail.
The DataFrame has a MultiIndex and it looks like this:
...
0
votes
1answer
15 views
Matplotlib: Getting different colors in data lines with error bars
I am trying to draw two data lines with error bars, each having the same color as the data line. However, I get another thin line with a color I have not specified in each data line when I add an ...
0
votes
0answers
41 views
Read multiple CSV file Python Pandas [on hold]
I try to read multiple CSV files with different names in a directory (ex: Hello.csv, World.csv, ... ). And now I need to save the plot image in a different directory. This is my work
import ...
0
votes
1answer
20 views
Plotting a stacked bar chart with matplotlib using dates as index where there are gaps and missing data
I have a data frame containing several columns for which I have continuous (annual) data since 1971 up to 2012. After that I have some say "predicted" values for 2020, 2025, 2030 and 2035. The index ...
1
vote
1answer
28 views
Reshaping Arrays in Numpy with variables
I'm trying to take an array on numpy, add a line of code, append it to the array, and then reshape the entire array back to the translated r. While I'm attempting to use plt.imshow to display it ...
1
vote
1answer
20 views
Change fonts and line thicknesses on a matplotlib figure that has already been created
Often, I create a figure that I'd like to use in a published article as well as on powerpoint slides. What looks good in print doesn't always look good on a slide. I'd like to create a matplotlib ...
0
votes
0answers
17 views
Error when Importing matplotlib.pyplot
I am having some trouble with python matplotlib.pyplot, I have reinstalled matplotlib and that did not fix the error. Curiously enough matplotlib works fine. Here is the output of the error when I run ...
2
votes
1answer
26 views
Saving all open matplotlib figures in one file at once
I am trying to save an arbitrary number of matplotlib figures that I have already created into 1 file(PDF?).
Is there a way to do it with one command?
0
votes
2answers
32 views
Suppress the plot and only get the result
I am trying to align two signals to get the lag that gives me the best coefficient. I am using the xcorr function in matplotlib. I am only interested in z in the following code.
Is there a way to ...
0
votes
0answers
22 views
Closing a matplotlib window opened by exec()-ing a script in wxpython with Ctrl-W causes a segmentation fault
The graphical user interface to a programming/modeling environment I've created depends heavily on executing arbitrary python code from a wxwidgets gui. Below is a minimal, but typical example of how ...
0
votes
0answers
19 views
Canvas figure not showing title or axis format
I am having a problem when ploting a graph inside my Main Window.
I am using QtDesigner for my Main Window.
Inside one of the horizontal_layout I want to disply a graph.
Here is the code that I am ...
0
votes
0answers
23 views
'ImportError: No module named pytz' when trying to import pylab?
As far as I can tell, I don't even need pytz for what I'm doing.
I'm re-learning python for image processing using the O'Reilly book 'Programming Computer Vision with Python' for work (and I'm also ...
1
vote
1answer
31 views
Additional keyword arguments in seaborn jointplot
I'm trying to find out how matplotlib and seaborn plotting functions are associated. Particularly, I'd like to know what pyplot arguments can be passed into keyword dicts marginal_kws and annot_kws in ...
1
vote
0answers
13 views
How to display a color map as pygame surface generated from an array in real-time?
My goal is to display inside a pygame instance a color map reflecting a real-time input in form of a 49 elements ndarray, ranging from -6 to 2, normalized into values ranging from 0 to 1. As of now, I ...
2
votes
2answers
21 views
plotting multiple plots generated inside a for loop on the same axes python
My code is as follows, the problem is instead of having one plot, I get 242 plots. I tried putting the plt.show() outside the loop, it didn't work.
import numpy as np
import matplotlib.pyplot as plt
...
0
votes
1answer
31 views
Raster to Numpy Array - how to change a default color-scheme of a matplotlib plot
I am trying to change the default color scheme of a matplotlib plot.
So far I have the following code:
import arcpy
import matplotlib.pyplot as plt
import matplotlib.cm
input_Raster = ...
-1
votes
0answers
30 views
Plotting Boxplot from data doesn`t work
I have the following output by working with data (and some more rows) from some csv-files:
(-36.109999999999999, -21.699999999999999, 0.90000000000000002, 10.0, 88.0)
(-14.199999999999999, ...
0
votes
0answers
25 views
Plotting/Saving sepcific Pandas Dataframe columns
I've been trying to learn python, specifically for data analysis extracting data from a table form (cvs, txt or xlsx). So far, I can read the data correctly, groupby 'Location', and plot specific ...
0
votes
1answer
19 views
Turn hist2d output into contours in matplotlib
I have generated some data in Python using matplotlib.hist2d. An example of the data is seen below.
As you can see this data has some contours in it found by tracing the same color throughout the ...
0
votes
0answers
15 views
matplotlib venn plot with repeat elements
I am trying to plot a Venn using matplotlib_venn. However, am I using set() to create unique sets to plot. This means that I lose some of the data that I want to plot to display. I have tried to just ...
0
votes
1answer
20 views
.png file not saving correctly matplotlib
While saving a multiple grid figure in png with 300 as dpi, I lose quality:
However this error does not occur while saving the figure as a pdf.
Here is the small portion of the code that saves the ...
0
votes
0answers
17 views
Why can't matplotlib draw in the window while the main thread is sleeping? [duplicate]
I wanted to do something like below:
from matplotlib import pyplot as plt
from time import sleep
plt.ion()
plt.show()
for i in range(10):
plt.plot([1,2,3], [1,2,3]) # dummy data
sleep(2)
...
1
vote
1answer
26 views
displaying correlation values in seaborn scatter plots
I'm using seaborn's lmplot/regplot to visualize scatter plots. I want to be able to look at the scatter plots and visually see if there is a "significant" relationship between x and y. Labeling the ...
1
vote
1answer
20 views
matplotlib, pyplot : custom color for a specific data value
I am generating a heat map for my data.
everything works fine, but I have a little problem. My data (numbers) are from 0 to 10.000.
0 means nothing (no data) and at the moment the field with 0 just ...
2
votes
1answer
24 views
Example matplotlib.org does not work in Canopy
I am trying to make an animation with matplotlib in python (2.7) with 3 subplots. To see how this works I tried to understand the example on matplolib.org:
...
0
votes
0answers
13 views
Pandas.Dataframe.plot 'barh', add labels to bar segements
I'm about trying to add labels for and to the segments of my vertical barplots. Besides this "workaround": stack barh plot in matplotlib and add label to each section (and suggestions), does somebody ...
0
votes
0answers
30 views
How to update matplotlib plot in while loop? [duplicate]
I am trying to write a script that plots a figure and asks the user to select two points. It then draws a rectangle of which the points are the bottom left and top right corner. The process is then ...
0
votes
1answer
35 views
seaborn jointplot with arrays of different length
I'm trying to draw joint distribution of 2 variables in a package named seaborn (a wrapper over matplotlib). Ultimately, I want to get something like this: ...
2
votes
1answer
45 views
matplotlib scatter plot change distance in x-axis
I want to plot some Data with Matplotlib scatter plot.
I used the following code to plot the Data as a scatter with using the same axes for the different subplots.
import numpy as np
import ...
2
votes
2answers
22 views
pyplot compbine multiple line labels in legend
I have a data that results in multiple line plot, I want to give this lines single label on my legend. I think this can be better demonstrated using the example below,
In [22]: a = np.array([[ 3.57, ...
-3
votes
1answer
29 views
how to show figure from linux terminal in python? [on hold]
I use matplotlib in python 2.7 to display figures. It works fine in spyder env but when trying from terminal nothing happens.
Using code:
py.plot(x)
py.show()
where is the tip?
Thanks darth ...
0
votes
0answers
13 views
No module named Tkinter error while ploting data using matplotlib in python 2.7
I am working on python 2.7 based Vizard 5 platform. Here I tried to plot simple data using matplotlib then I got error as "No module named Tkinter". For exaple i tried following code:-
import ...
0
votes
1answer
21 views
How do I flush a graphics figure from matplotlib.pylab when inside a file input loop?
I am using Python 2.7 and importing libraries numpy and matplotlib. I want to read multiple file names of tab-delimited text files (time, voltage and pressure measurements) and after each one display ...
0
votes
2answers
19 views
Install Matplot Lib Mac - Mavericks - Error pyplot
I have tried installing matplotlib a number of ways and I was successful using - download through github, changing directory to folder, and running sudo python setup.py install. But, pyplot wasn't ...
0
votes
0answers
20 views
stackplot in matplotlib 1.4
The demo stackplot code fails for me since upgrading to matplotlib 1.4.0 It works with 1.2.1
http://matplotlib.org/examples/pylab_examples/stackplot_demo.html
The error is AttributeError: ...
0
votes
0answers
14 views
matplotlib plot yahoo chart api graph plot
i am just starte learn matplotlib. i am try to plot yahoo char api plot stock. i am try this program but it is not working...there is my program
import numpy as np
import matplotlib.pyplot as plt
...
0
votes
1answer
19 views
dynamically plot the optimization result in Matplotlib
I'm doing a numerical optimization, and I want to visualize the loss of the objective function at each iteration, which means I need to add one point when each iteration is done into the plot.
I ...
0
votes
1answer
28 views
Plotting graph without blocking execution in python
I want to plot graph inside a while loop, but execution is blocked after plt.show(G) command and resumes when i manually kill the plot window.
Code:
while True:
print G.edges()
...
0
votes
0answers
16 views
Matplotlib can't print Arial to pdf
Ideally I'd like to make Matplotlib produce plots with Helvetica, I haven't gotten past the infamous Font family ['sans-serif'] not found. Falling back to Bitstream Vera Sans problem (apparently ...
1
vote
0answers
9 views
matplotlib: save fig with bbox_inches='tight' ignores annotation
It appears that the bbox_inches='tight' option in savefig ignores annotations without text. Here is my example code
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_axes([0.2, 0.2, ...