Tagged Questions
0
votes
0answers
2 views
DateFormatter returning wrong dates - Matplotlib/Pandas
I am trying to plot some data using matplotlib and pandas. However when using the DateFormatter, dates are being rendered incorrectly depending on what I filter out of the DataFrame:
The dates in ...
0
votes
1answer
10 views
remove x ticks but keep grid lines
I have a Pyplot plot, which I want to add gridlines to. I did this using:
plt.grid(True)
I then removed my x ticks using:
ax1.xaxis.set_visible(False)
My x ticks were removed, but so were the x ...
1
vote
0answers
6 views
Overlaying the numeric value of median/variance in boxplots
When using box plots in Python, is there any way to automatically/easily overlay the value of the median & variance on top of each box (or at least the numerical value of the median)?
E.g. in the ...
0
votes
0answers
4 views
Match colors between matplotlib and LaTeX
I'm plotting something using matplotlib and I'm using the matplotlib.cm.rainbow colormap. I need to match the same colors in my LaTeX document, but I'm having a difficult time making the colors match ...
1
vote
1answer
25 views
Xaxis Labels not matching Data Points - Pandas/Matplotlib
I have a TimeSeries in Pandas that I want to plot. I have 336 records in the TimeSeries. I only want to show the date/time (index of the TimeSeries) on the x-axis once per every 20 or so data ...
1
vote
0answers
30 views
How can I paint the faces of a cube?
I have done a cube that can be rotated on python but now I want to colour the faces for me to identify each face when it's rotated. The code below:
from mpl_toolkits.mplot3d import Axes3D
import ...
1
vote
0answers
21 views
how to move the tick and label position of the secondary x and y axes in python
I want to plot multiple axes using matplotlib in python. I have done it using twinx().twin(y) but I am not able to move the tick postion and the axis label with the spines of the new axes.please help ...
1
vote
1answer
32 views
How to plot comparison between two categorical (Nominal) series with pandas and matplotlib
I am trying to compare two different classification of a serie of elements. Suppose I want to obtain a graphic like this:
Obtained with the following iPython session:
In [1]: df
Out[1]:
<class ...
0
votes
1answer
24 views
ipython notebook and ginput
I am trying to create an interactive plot in ipython notebook. I am attempting to run the sample code from matplotlib's website as below.
t = arange(10)
plot(t, sin(t))
print("Please click")
x = ...
0
votes
1answer
39 views
problems low contrast image(contrast stretching) in matplotlib
When reading a low-contrast image it automatically take this example:
In [1]: from PIL import Image
In [2]: import numpy as np
In [3]: import matplotlib.pyplot as plt
In [4]: img = ...
2
votes
2answers
31 views
matplotlib contour input array order
Question: what order does the contour from matplotlib expect for the input 2D array?
Elaborate: Matplotlib contour documentation says that the routine call is
x_axis = np.linspace(10,100,n_x)
...
1
vote
1answer
27 views
How to set ffmpeg for matplotlib in mac os x
I want to animate some plots with matplotlib. The version I have is the Enthough Canopy distribution (Version: 1.1.0.1371), running in a mac os x 10.8 (Mountain Lion). I have used the FuncAnimation ...
0
votes
2answers
30 views
Why does plt.savefig() performance decrease when calling in a loop?
I wrote the following code to test the performance of matplotlib's savefig()function:
import matplotlib.pyplot as plt
import numpy as np
from numpy.random import rand
import time
for i in ...
0
votes
1answer
29 views
Matplotllib plot scatter with circle sizes proportional from distance to mean
I would like to plot a scatter of values distances from mean in a scatter plot.
Here is my code for this:
import numpy as np
import matplotlib.pyplot as plt
x=[5,6,2,6,9]
y=[2,4,5,1,10]
...
1
vote
1answer
26 views
How to change the line colour for different lines in a subplot
I'm looking to be able to change the colours of lines to ones that I specify on a plot using matplotlib.
Below is the relevant code (it's part of a function) that I'm using. The variable ...
0
votes
2answers
38 views
Find the x value corresponding to a histogram max
I re-worded this to confirm to the idea of S.O. (thanks Michael0x2a)
I have been trying to find the x value associated with the maximum of a histogram plotted in matplotlib.pyplot. At first I had ...
0
votes
1answer
16 views
Change visual of histogram from image using matplotlib in Python
I would like to present a histogram from an image in Python.
Doing some research, I found a way of doing it using matplotlib. So, I just do this:
im = plt.array(Image.open('Mean.png').convert('L'))
...
0
votes
1answer
26 views
Plot 3D Contour from an Image using extent with Matplotlib
As I present here (in 2D), I'm wondering if how I could "scale" an image input to be plotted to a range in the plot. To be more clear, this is what I need:
I have a 400 * 400 image that is generated ...
1
vote
1answer
25 views
Matplotlib 'bold' font
Following this example:
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
for i, label in enumerate(('A', 'B', 'C', 'D')):
ax = fig.add_subplot(2,2,i+1)
ax.text(0.05, ...
0
votes
2answers
32 views
Manipulate xticks, need every second xtick to just be the decimal and smaller font
So, as a beginner python user, I can not even BEGIN to work out how to do this. It is very difficult to search for help online, as it just turns up lots of junk results.
But basically I have a plot ...
0
votes
0answers
31 views
C++ runtime error pythonw
I have been trying to run a script to generate a mandelbrot image using matplotlib however I am getting a very peculiar error. I am running the script through IDLE, running it for the first time does ...
1
vote
1answer
45 views
Edge detection of histogram - python
Basically I have some data that I have made a histogram from. No great difficulty there, just use matplotlib.pyplot.hist(data,bins=num)
However, I want to do a kind-of Sobel edge detection where ...
2
votes
1answer
64 views
Normalizing audio signal
I want to reliably convert both recorded audio (through microphone) and processed audio (WAV file) to the same discretized representations in Python using specgram.
My process is as follows:
get ...
2
votes
2answers
31 views
how to show tick labels on top of matplotlib plot?
In matplotlib what is the way to have tick labels both at the bottom and in the top x axis? I have searched a lot and still can't find how to do it.
0
votes
1answer
32 views
setting xlim and ylim while using matplotlib (something strange)
# the first plot DOES NOT set the xlim and ylim properly
import numpy as np
import pylab as p
x = np.linspace(0.0,5.0,20)
slope = 1.0
intercept = 3.0
y = slope*x + intercept
p.set_xlim = ...
0
votes
1answer
32 views
Matplotlib multiProcessing
I am trying to make it so that I can run an infinite loop asking for user input as well as running a matplotlib simple diagram. Any suggestions how this can work? Currently I have for my code:
def ...
1
vote
2answers
37 views
Changing marker style in scatter plot according to third variable
Hi stack overflow community,
I am dealing with a multi-column dictionary. I want to plot two columns and subsequently change color and style of the markers according to a third and fourth column.
I ...
0
votes
2answers
28 views
Animation with pcolormesh routine in matplotlib, how do I initialize the data?
I am trying to animate a pcolormesh in matplotlib. I have seen many of the examples using the package animation, most of them using a 1D plot routine, and some of them with imshow().
First, I wan to ...
0
votes
1answer
21 views
Using Matplotlib and iPython, How to reset x and y axis limits to Autoscale?
Using matplotlib and iPython, I have a bunch of plots that I am trying to view (one after the other). Some plots only contain values from 0 to 1 and some contain values in the millions.
After ...
0
votes
1answer
21 views
Python Pyplot: How to scale x-axis independant from number of list-elements?
Just want to plot a list with 50 (actually 51) elements: The list indices from 0 to 50 should represent meters from 0 to 10 meters on the x-axis, while the index of every further element increases by ...
0
votes
2answers
37 views
Fits image input to a range in plot - Python
I'm wondering if I could "scale" a image input to be plotted to a range in the plot.
To be more clear, this is what I need:
I have a 400 * 400 image that is generated based on a function which ...
3
votes
2answers
51 views
Can you plot live data in matplotlib?
I'm reading data from a socket in one thread and would like to plot and update the plot as new data arrives. I coded up a small prototype to simulate things but it doesn't work:
import pylab
import ...
1
vote
0answers
29 views
How to plot a heatmap of a big matrix with matplotlib (45K * 446)
I am trying to plot a heatmap of a big microarray dataset (45K rows per 446 columns).
Using pcolor from matplotlib I am unable to do it because my pc goes easily out of memory (more than 8G)..
I'd ...
-3
votes
0answers
15 views
stackable barcharts in 3D in matplotlib
How does one plot vertical stackable bars in 3D using Matplotlib? I know how to plot
stackable bars in Matplotlib in 2D or in pandas.
I have data for 15 years. Each year can be represented by a ...
1
vote
2answers
30 views
Rotate a 3d object in python
I have done this 3D plot of 2 cubes. But now I want it to rotate, so How can I rotate the cube that is inside? I want to rotate horizontally up to 90º degrees!
Thank you!
enter image description ...
-1
votes
1answer
47 views
matplotlib superimpose polar and cartesian gridded data
How do I superimpose a polar grid and a Cartesian grid with matplotlib?
It is important to note that both origin and scales have to match.
In my application, I want to combine weather radar data ( ...
1
vote
3answers
41 views
matplotlib set color, style in oo fashion
I can set the color and style of a plot in matplotlib in the following way:
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot([1,2,3],[1,2,3], 'r-')
plt.show()
...
1
vote
2answers
30 views
Combining two 2D arrays into one image plot
I have two 2D arrays, each of them representing a property on a map. One of them represents hail probability (0%-100%) and the othe one hail severity (0-No Hail, 1-Low, 2-Medium, 3-High).
I can plot ...
1
vote
1answer
18 views
imshow when you are plotting data, not images. Realtion between aspect and extent?
I am plotting a 2D data array with imshow in matplotlib. I have a problem trying to scale the resulting plot. The size of the array is 30x1295 points, but the extent in units are:
extent = ...
0
votes
0answers
37 views
ImportError:libpng16.so.16 cannot open shared object file
After installing matplotlib successfully on my Fedora19,I tested my code written by python.
Unfortunately,I got this ImportError .
$ python ren.py
Traceback (most recent call last):
File ...
0
votes
1answer
29 views
python: scatter plot logarithmic scale
In my code, I take the logarithm of two data series and plot them. I would like to change each tick value of the x-axis by raising it to the power of e (anti-log of natural logarithm).
In other ...
0
votes
1answer
36 views
How to change axis limits for time in Matplotlib?
I have a data set stored in a Pandas dataframe object, and the first column of the dataframe is a datetime type, which looks like this:
0 2013-09-09 10:35:42.640000
1 2013-09-09 10:35:42.660000
...
0
votes
0answers
32 views
Right-to-left Support in Python Networkx and matplotlib
I have tried to draw lexicographic graphs with python33 networkx and matplotlib running on Linux Fedora 19 KDE, 64 bits. When feeding English script as input data, the graphs are drawn well. However, ...
3
votes
1answer
45 views
Contour irregular data within polygon
I need to create filled contour plots of sea surface temperature (SST) data within a polygon, however I am not sure the best way to do this. I have three 1D arrays containing data for X, Y, and SST ...
0
votes
1answer
18 views
Python Pyplot error: “ValueError: x and y must have same first dimension”
Can't get my simple intention of plotting 2 lists working. The length of the 1dim-lists are both the same and the list-values are simple floats with just digits after the comma. The long variable ...
-3
votes
1answer
32 views
Stuck colored filled area in bar chart, python [on hold]
everyone,
I want to create a bar chart but with a filled background.
For example:
for 0 to 1 in y axis the background must be black
for >1 to <2 in y axis the background must be red.
In other ...
1
vote
1answer
37 views
Density plots from matlab to matplotlib
Since some years ago I use matlab for my plots (mostly density plots), but now I want to change to matplotlib. I have a problem trying to figure out how to get analogous plots in matplotlib. I have to ...
1
vote
1answer
26 views
triangulation without long triangles
In python, for a set of points, With
import matplotlib.tri as tri
triang = tri.Triangulation(x, y)
How I can make a mask for eliminate the triangles with long edges ?
5
votes
2answers
37 views
Fixing matplotlib plot
In matplotlib I like to customize my plots by shifting the spines from the origin, for example:
plot(range(10), marker='o', ms=20)
#customize axes
axes = gca()
axes.spines['right'].set_color('none')
...
2
votes
2answers
34 views
Make contour of scatter
In python, If I have a set of data
x, y, z
I can make a scatter with
import matplotlib.pyplot as plt
plt.scatter(x,y,c=z)
How I can get a plt.contourf(x,y,z) of the scatter ?