I am trying to plot a bunch of data points (many thousands) in Python using matplotlib so I need each marker to be very small and precise. How do I get the smallest most simple marker possible? I use this command to plot my data:
matplotlib.pyplot( x , y ,'.',markersize=0.1,linewidth=None,markerfacecolor='black')
Then I can look at...
I am trying to position two subplots next to each other (as opposed to under each other). I am expecting to see [sp1] [sp2]
Instead, only the second plot [sp2] is getting displayed.
from matplotlib import pyplot
x = [0, 1, 2]
pyplot.figure()
# sp1
pyplot.subplot(211)
pyplot.bar(x, x)
# sp2
pyplot.subplot(221)
pyplot.plot(x, x)
pyp...
I'm trying to create an image using matplotlib.pyplot.imshow(). However, when I run the program from my console, it doesn't display anything?
This is the code:
import matplotlib.pyplot
myimage = gen_image()
matplotlib.pyplot.gray()
matplotlib.pyplot.imshow(results)
But this shows nothing.
...
I have a script that plots data of some photometry apertures, and I want to plot them in an xy plot. I am using matplotlib.pyplot with python 2.5.
The input data is stored in around 500 files and read. I am aware that this is not the most efficient way of inputting the data but that's another issue...
Example code:
import matplotlib.p...
Hello... anyone know how to draw a border around an individual subplot within a figure in matplotlib? I'm using pyplot.
eg:
import matplotlib.pyplot as plt
f = plt.figure()
ax1 = f.add_subplot(211)
ax2 = f.add_subplot(212)
# ax1.set_edgecolor('black')
..but Axes objects have no 'edgecolor', and I can't seem to find a way to outline ...
I would like to have three plots in single figure. The figure should have a subplot layout of two by two, where the first plot should occupy the first two subplot cells (i.e. the whole first row of plot cells) and the other plots should be positioned underneath the first one in cells 3 and 4. I know that matlab allows this by using the s...
hi
I want to draw graph but to give one list of the point them selves and not two lists of X's and Y's. something like that:
a=[[1,2],[3,3],[4,4],[5,2]]
plt.plot(a,'ro')
(and not [1,3,4,5],[2,3,4,,2])
thanks
...
I am encountering some strange behavior with using the matplotlib.pyplot ginput() function to store clicked points. On the first click, the ranges of the axes of the clicked image change to add 200 on each side. The image remains with this border of whitespace until something new is plotted.
Example code:
import matplotlib.pyplot as pl...
I would like to utilize customer markers in both scatter and line charts. How can I make custom marker out of a PNG file?
...
Basically, when generating plots with matplotlib, The scale on the y-axis goes into the millions. How do I turn on digit grouping (i.e. so that 1000000 displays as 1,000,000) or turn on the decimal separator?
...
Assuming we have a polygon coordinates as polygon = [(x1, y1), (x2, y2), ...], the following code displays the polygon:
import matplotlib.pyplot as plt
plt.fill(*zip(*polygon))
plt.show()
By default it is trying to adjust the aspect ratio so that the polygon (or whatever other diagram) fits inside the window, and automatically changin...
I have a loop that executes the body about 200 times. In each loop iteration, it does a sophisticated calculation, and then as debugging, I wish to produce a heatmap of a NxM matrix. But, generating this heatmap is unbearably slow and significantly slow downs an already slow algorithm.
My code is along the lines:
import numpy
import ma...
Hi probably quite a simple question but..
When plotting a graph using matplotlib.pyplot my Y axis goes from -0.04 to 0.03 which is fine but there are 8 labels for increments (eg 0.03,0.02,0.01 etc.). I need more maybe 16 or so.
Thanks for your help
...
I'd like to plot a 2-d matrix from numpy as a colored matrix in Matplotlib. I have the following 9-by-9 array:
my_array = diag(ones(9))
# plot the array
pcolor(my_array)
I'd like to set the first three elements of the diagonal to be a certain color, the next three to be a different color, and the last three a different color. I'd l...
I am using pcolor with a custom color map to plot a matrix of values. I set my color map so that low values are white and high values are red, as shown below. All of my matrices have values between 0 and 20 (inclusive) and I'd like 20 to always be pure red and 0 to always be pure white, even if the matrix has values that don't span the...
Hello,
I've created a simple hexbin plot with matplotlib.pyplot. I haven't changed any default settings. My x-axis information ranges from 2003 to 2009, while the y values range from 15 to 35. Rather than writing out 2003, 2004, etc., matplotlib collapses it into 0, 1, 2, ... + 2.003e+03. Is there a simple way to force matplotlib to...
I have the following code:
import matplotlib.pyplot as plt
cdict = {
'red' : ( (0.0, 0.25, .25), (0.02, .59, .59), (1., 1., 1.)),
'green': ( (0.0, 0.0, 0.0), (0.02, .45, .45), (1., .97, .97)),
'blue' : ( (0.0, 1.0, 1.0), (0.02, .75, .75), (1., 0.45, 0.45))
}
cm = m.colors.LinearSegmentedColormap('my_colormap', cdict, 1024)
...
I'm trying to plot a log-log graph that shows logarithmically spaced grid lines at all of the ticks that you see along the bottom and left hand side of the plot. I've been able to show some gridlines by using matplotlib.pyplot.grid(True), but this is only showing grid lines for me at power of 10 intervals. So as an example, here is wha...
Hello,
I have two subplots in a figure. I want to set the axes of the second subplot such that it has the same limits as the first subplot (which changes depending on the values plotted). Can someone please help me? Here is the code:
import matplotlib.pyplot as plt
plt.figure(1, figsize = (10, 20))
## First subplot: Mean value in each...
Hi,
I am trying to plot do a basic semilog plot using pyplot and matplotlib, with the y-axis being the logarithmic scale. I am using the following code:
pylab.figure(num=None,figsize=(8,6))
pylab.plot(x_loc,var1,x_loc,var2)
\#pylab.yscale('log')
pylab.xlabel('$y/L_{1/2}$',fontsize=18)
pylab.ylabel('$n/n_{max}$',fontsize=18)
...