I have a collection of Nx3 matrices in scipy/numpy and I'd like to
make a 3 dimensional scatter of it, where the X and Y axes are
determined by the values of first and second columns of the matrix,
the height of each bar is the third column in the matrix, and the
number of bars is determined by N.
Also, I am not sure how to use alan's code.
If I try:
ec = empirical_cdf(my_data)
plt.plot(ec)
it doesn't actually look like a cdf
On Fri, Jul 9, 2010 at 10:17 AM, per freem wrote:
> How does Alan's code compare with using cumfreq and then plotting its
> result? Is the
How does Alan's code compare with using cumfreq and then plotting its
result? Is the only difference that cumfreq bins the data?
On Fri, Jul 9, 2010 at 10:12 AM, Robert Kern wrote:
> On 7/9/10 10:02 AM, per freem wrote:
>> I'd like to clarify: I want the empirical cdf,
I'd like to clarify: I want the empirical cdf, but I want it to be
normalized. There's a normed=True option to plt.hist but how can I do
the equivalent for CDFs?
On Fri, Jul 9, 2010 at 9:14 AM, Alan G Isaac wrote:
> On 7/9/2010 12:02 AM, per freem wrote:
>> How can I plot t
How can I plot the empirical CDF of an array of numbers in matplotlib
in Python? I'm looking for the cdf analog of pylab's "hist" function.
One thing I can think of is:
from scipy.stats import cumfreq
a = array([...]) # my array of numbers
num_bins = 20
b = cumfreq(a, num_bins)
plt.plot(b)
Is t
Hi all,
How can I plot a matrix of values as a heatmap where values are shown
from green to red intensities, or blue to yellow intensities, like in
the following figure?
http://www.coriell.org/images/microarray.gif
I want to have the option of doing this with either green-red maps or
blue-yellow
hi all,
two quick questions about labels. first, is there a way to make
subscripts/superscripts *without* using TeX in labels? For example, I
use helvetica in all my labels and I want to plot something like:
plt.xlabel("log10") where "10" is a subscript of "log", but without
doing: plt.xlabel(r"$\
hi all,
I am plotting certain dashed lines in matplotlib, using:
plt.plot(x, y, '--')
I'd like to set the dash size (i.e. length of each dash) and the gap
between the dashes of the plotted line. Is there a way to set this
from matplotlib?
thanks.
---
hi all,
i am using mpl_toolkits.axes_grid.inset_locator.inset_axes to plot an
inset axes inside my figure, as follows:
inset = inset_axes(s,
width="30%", # width = 30% of parent_bbox
height=.5, # height : 1 inch
loc=4
)
i am
Hi all,
To annotate my figures with Greek letters, I use the following:
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['ps.useafm'] = True
rc('font',**{'family':'sans-se
hi all,
i am a *huge fan* of matplotlib and use it for all plotting. one
feature that i would find extremely useful that i believe is missing
(but am very open to being corrected in case i overlooked something)
is a way to define the layout of complex subplots. by this i mean
something like R's "l
n 1/4 the size of the square
plot on the left, and putting that on the right hand panel.
is there a way to do this in matplotlib?
thanks.
On Sat, Dec 26, 2009 at 10:55 PM, Jae-Joon Lee wrote:
> On Thu, Dec 24, 2009 at 3:53 PM, per freem wrote:
>> i want it to eliminate the second
>
hi all,
i am drawing a 2x3 set of subplots. i want it to eliminate the second
subplot of the first row and instead make the first subplot on the
first row take up two plots worth of space, i.e. have it so that the
first subplot takes up 2,3,1 and 2,3,2. In matlab, the command would
be something l
Hi all,
I was hoping someone could point to an example of making "inset
graphs", where a small graph appears inside of a large graph. For
example i want to make a line plot (using "plot") and then embed a bar
graph (using "bar") inside it. how can i do that?
thanks.
-
(or ylabel) command are
> currently ignored.
>
> I don't think set_position command will work also. I f you need to
> place your labels at some specific point, simply use "text" or
> "annotate" command instead.
>
> -JJ
>
>
>
> On Fri, Nov 13
= plt.xlabel('hello x axis')
xlab.set_position((0.2, 0.1))
plt.savefig('test_logscale.pdf')
the xaxis doesn't seem to be moved. any idea what might be wrong here? thanks.
On Fri, Nov 13, 2009 at 1:43 PM, Gökhan Sever wrote:
>
>
> On Fri, Nov 13, 2009 at
hi all,
how can the space between the label (e.g. thing created by
plt.xlabel('mylabel')) and the axes be adjusted? i am not talking
about the space between the ticklabels of the axes and the axes
themselves (which is set by 'xtick.major.pad' or 'ytick.major.pad')
but between the overall axes labe
hi all,
i am trying to adjust the space (padding) between the tickmarks on an
axes and the labels. usually, i can do this by setting
'xtick.major.pad' and 'xtick.minor.pad' (and same for y-axis) in
rcParams. however, when i try to do this with a figure made using the
"SubplotZero" function, it see
or n in invisible:
ax.axis[n].set_visible(False)
plt.savefig('test_logscale.pdf')
if i do this, the bottom x-axis labels disappear.
this only happens with SubplotZero -- which is needed to make the
irrelevant axes invisible, I think -- then the labels of the x-axis
disappear.
hi all,
I am trying to make a simple bar graph that has its yaxis scale set to
log. I use the following code:
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['ps.useafm'
hi all,
i've been using genfromtxt to parse tab separated files for plotting
purposes in matplotlib. the problem is that genfromtxt seems to give
only two ways to access the contents of the file: one is by column,
where you can use:
d = genfromtxt(...)
and then do d['header_name1'] to access the
hi all,
i am trying to plot a series of arrows between points on a scatter
plot, using the following code:
import matplotlib.pyplot as plt
from matplotlib.patches import FancyArrowPatch
from numpy import *
from scipy import *
def plot_arrows(init_val, all_vals, c='k'):
plt.figure()
ax =
hi all,
i would like to draw points on the 3-d simplex, like that of a
dirichlet distribution with 3 parameters. in other words, all i want
to draw are three axes that go from 0 to 1 and make a triangular
shape, such that each point on the triangular region the three axes
form uniquely determines
hi all,
i have a matrix of data and i would like to make a set of subplots,
each subplot with a histgram of one of the columns of the data. the
dataset is an Nx4 matrix containing only numbers between 0 and 1.
i plot it like this:
plt.subplot(2, 2, 1)
# histogram of first column
plt.hist(mydata[
hi all,
i am trying to make horizontal (as opposed to the default vertical)
rotated labels for axes in my subplots. i tried using the
'orientation' optional argument, as follows:
from numpy import *
from scipy import *
from mpl_toolkits.axes_grid.axislines import SubplotZero
import matplotlib.pyp
hi all,
i am trying to share both an axis label (but not the entire axis) and
a figure legend across a set of subplots. that is, i'd like to have a
figure where there is a major enlarged ylabel that is meant to label
the entire row of subplots and a main figure legend, rather than
individual legen
hi all,
i am trying to install the recent matplotlib (0.99.1.1) but i am
getting an error about wxPython not being available. i thought wx is
an optional backend? in any case i would not like to use it. is there
a way to install matplotlib without?
my command was:
python setup.py install --pref
hi all,
i am parsing a csv text file as follows:
data = genfromtxt(filename, delimiter=delimiter, dtype=None, names=True)
this returns an array. sometimes though i want to access the element
that has value x in, say, the first column. i usually do this like
this:
nonzero(data['first_column'] ==
hi all,
i am trying to make a simple stacked bar graphs (just two layers) and
am getting some strange results. i have the following code:
import numpy as np
import matplotlib.pyplot as plt
ind = np.arange(3)
width = 0.35
plt.bar(ind, [5128307, 4305252, 4817425], width, align='center', color='r')
hi all,
i am trying to plot asymmetric yaxis error bars. i have the following code:
import matplotlib.pyplot as plt
a = array([[ 0.5, 1.5],
[ 0.7, 2.2],
[ 2.8, 3.1]])
plt.errorbar([1,2,3],[1,2,3],yerr=a)
where each element in the list represents the -yerror, +yerror, like
the do
hi all,
i have the following simple plot using the 'errorbars' function. when
i plot it, one of the error bars is cut off:
from numpy import *
from scipy import *
from mpl_toolkits.axes_grid.axislines import SubplotZero
fig = plt.figure()
ax = SubplotZero(fig, 3, 2, 1)
fig.add_subplot(ax)
ax.axis
hi all,
i have a 3x2 subplot figure, and i would like to adjust the relative
width of the second column. in other words, if i have:
import matplotlib.pyplot as plt
plt.subplot(3, 2, 1)
# plot stuff
plt.subplot(3, 2, 2)
# plot, etc...
i want to make it so the second column occupies less width in
Helvetica.ttf into:
/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts
and
/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf
then everything worked and i was able to change fonts to helvetica.
thanks.
On Sat, Aug 22, 2009 at 7:12 PM, per freem wrote:
> Hi
Hi all,
the following code used to work for me in matplotlib-0.98 to make a
simple scatter plot and change the font from the default font to
Helvetica (I am using mac os x).
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sa
hi all,
i am trying to install matplotlib-0.99 on a mac os x machine, with the
following python:
Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
using version 10.5.6 of mac os x. when i go to
http://sourceforge.net/projects/matplotlib/ it prompts m
hi all,
thank you for your replies. my original message wasn't detailed
enough. what i am looking for is a hexbin plot, where points are
binned into hexagons and then hexagons are plotted in size
proportional to the points in the bin. i think the links provided are
very relevant for this,
but one
;|S11'),
('myheader2_b', ' wrote:
> On Wed, Aug 12, 2009 at 10:01 AM, Sandro Tosi wrote:
>>
>> On Wed, Aug 12, 2009 at 16:56, per freem wrote:
>> > hi all,
>> >
>> > i have tab-separated text files that i would like to parse into ar
hi all,
i have tab-separated text files that i would like to parse into arrays
in numpy/scipy. i simply want to be able to read in the data into an
array, and then use indexing to get some of the columns, or some of
the rows, etc. the key thing is that these columns might be strings or
might be nu
hi all,
is there a way to plot separated axes in matplotlib? i.e. plots where
the origin (0,0) has no meaning, either because the data on the x axes
is categorical (e.g. you are plotting a histograms for three
categories) or for other reasons. an example of what i mean is this
graph:
http://addic
Hi all,
i am wondering if there is a way or an interface in matplotlib to
design complex plot layouts. what i mean is something analogous to the
'layout' function of R, where you can say what portion of space each
plot will take. i think this allows for more sophisticated layouts
than the usual sq
hi all,
is there a way to make density plots using hexagonal bins in matplotlib?
what i mean is something like the hexbin package for R, where you can make
density plots where hexagons are plotted in size proportion to the number of
points in that hexagonal bin... see
http://www.bioconductor.org/p
hi all,
is there a way in matplotlib to plot lines with errorbars, e.g. using
errorbar(...) but instead of lines just have shaded, partly transparent
regions that represent the error bars? people often use this to show
confidence intervals or error bars... an example is here:
http://eva.nersc.no/
Hi all
i am making a scatter plot and want to label one of the points in the
legend. i run
scatter([x], [y], ..., label="mylabel")
and then run legend as follows
plt.legend(loc='lower right', numpoints=1, pad=0.01, labelsep=.01,
handlelen=.05)
i set numpoints=1 because i want it to show just o
Hi all,
i have a simple scatter plot, where the x axis and y axis are on different
scales starting from 0. the x axis here ranges from 0 to 300 and the y axis
from 0 to 1. i plot it as follows:
my_fig = plt.figure(figsize=(6,5), dpi=100)
x = rand(100)*300
y = rand(100)
plt.scatter(x, y)
plt.rcPar
hi all,
i'm trying to find the function for the pdf of a multivariate normal pdf. i
know that multivariate_normal can be used to sample from the multivariate
normal distribution, but i just want to get the pdf for a given vector of
means and a covariance matrix. is there a function to do this?
th
hi all,
i am plotting two distinct lines, one of the format '-o' the other of the
format '-s' -- i.e. one line with circular markers the other with a square
marker. when i add a legend to the figure, it gives a legend that looks like
this:
o---o label of circular marker line
s---s label of squa
hi all,
i am plotting several lines together in a plot. i'd like some of the lines
to be "behind" the other ones -- i.e., when the two lines intersect, i want
the most recently plotted line to be on top of the previously plotted lines.
in general, this is true but it seems to be violated by plt.a
hi all,
suppose i have am plotting several lines using 'plot', some are dashed
(using '--') and some are ordinary solid lines. i am plotting several solid
and several dashed lines, all in different colors, as in:
for n in num_lines:
# plot dashed line
plot(line_x[n], line_y[n], '--', color=li
hi all,
i'm getting very strange behavior from the matplotlib 'plot' function when
attempting to plot multiple lines. i have a series of x, y data points that
are being generated in a loop and i want to simply plot each of them on the
same plot. my code is:
import matplotlib
matplotlib.use('PDF')
sted an example of this to the
> list<http://www.nabble.com/Where-to-post-examples-%2528specifically%252C-one-that-may-be-useful-for-time-evolution-plots%2529-td23901837.html>.
> The code near the bottom of that thread is a little more general than the
> one at the top and shows, three diffe
Hi all,
i would like to set the colors of the lines i plot (using the plot function)
to go from red to blue, in evenly spaced interval. that is, imagine a color
map from red to green, where i plot n-many lines, each receiving a color
from this color map, starting at the red end and going to green.
27;,'sans-serif':['Helvetica']})
rc('pdf', use14corefonts=True)
then when i open the generated pdf in adobe illustrator i get the error:
"The font "Helvetica-Narrow" contains a bad /BBox." -- then no labels are
shown in the graph, only the nontextual el
10.ttf)
with score of 0.00
any idea what might be wrong here?
On Mon, Jun 29, 2009 at 8:47 AM, Michael Droettboom wrote:
> Are you certain you have Helvetica installed as a TrueType font? If you
> don't, the only way to get the Postscript Helvetica is to set "ps.useafm&qu
a why this might be? could
matplotlib be confusing helvetica with bitstream?
On Sun, Jun 28, 2009 at 11:28 AM, per freem wrote:
> hi,
>
> i am trying to use the Helvetica font on matplotlib. i am using mac os x
> (so i definitely have helvetica installed) with version 0.98.5.2 of
> ma
hi,
i am trying to use the Helvetica font on matplotlib. i am using mac os x (so
i definitely have helvetica installed) with version 0.98.5.2 of matplotlib.
my code is:
from scipy import *
import matplotlib
matplotlib.use('PDF')
from matplotlib import rc
import matplotlib.pyplot as plt
rc('font',
hi all,
i am using matplotlib 0.98.5.2 on Mac OS X. i am plotting a histogram and
then saving it as .pdf. The x and y labels use some symbols from latex, and
i have useTex set to true in my rcParams. The code is:
import matplotlib.pyplot as plt
my_fig = plt.figure(figsize=(5,5)), dpi=100)
plt.his
hello all,
I make my figures in matplotlib and then output them (using savefig) as
.pdf. I am using Fedora linux.
When I try to edit the font in the figure to Helvetica using Illustrator, I
cannot. i am able to select the fonts, e.g. labels on the axes of the
figure, but when i try to change the
ect() call, the plot becomes bigger in the horizontal direction, and
is rectangular.
any ideas how to fix this? thanks again.
On Sun, May 24, 2009 at 9:24 PM, Eric Firing wrote:
> per freem wrote:
>
>> hi all,
>>
>> i have a series of subplots organized in a column (3x1)
hi all,
i have a series of subplots organized in a column (3x1). i noticed that if i
plot them then matplotlib tends to make the x-axis long and the y-axis
short, so the plot is really rectangular. how can i make it more square? if
i do:
f = figure(figsize=(7,6), dpi=100)
p1 = subplot(3,1,1)
plot
hi all,
is there a way to plot the results of hierarchical clustering as a
dendrogram on top and to the sides of a heatmap matrix? for example, like
this figure:
http://www.egms.de/figures/meetings/gmds2006/06gmds075.f1.png
any examples of how to do this in matplotlib would be greatly appreciate
hi all,
i have a set of about 100-500 points that i'd like to color in different
colors. i tried the following, using the c= argument to the scatter command:
x = rand(200)
scatter(x, x, c=xrange(1,201))
however, only a handful of colors seem to be used and the points look very
similar. what i am
hi all,
what's the most efficient / preferred python way of parsing tab separated
data into arrays? for example if i have a file containing two columns one
corresponding to names the other numbers:
col1\t col 2
joe\t 12.3
jane \t 155.0
i'd like to parse into an array() such that i
hi all,
i'm trying to generate a very simple plot, where only the left y axis and
the bottom x axis are present. i.e. there is no top x axis or right y
axis... this is the default for many plotting packages. in matlab, one can
do this as follows:
>> x = rand(1,100);
>> hist(x)
>> set(gca, 'Box',
hi all,
is there a way to plot the results of hierarchical clustering as a
dendrogram on top and to the sides of a heatmap matrix? for example, like
this figure:
http://www.egms.de/figures/meetings/gmds2006/06gmds075.f1.png
any examples of how to do this in matplotlib would be greatly appreciate
hi all,
following my last post, i found what seems to me to be a bug in the legend
handling of scatter plots. suppose i have:
scatter([1,2,3],[1,2,3], label="_nolegend_")
i then want to color some subset of these points in a different color, or
plot them using a different marker size, etc. so i
hi all,
i'm plotting a scatter plot with several kinds of markers and would like to
display a legend for them. if i try the following:
scatter([1,2,3],[1,2,3])
legend('a')
then the legend shows three dots (of the same type used in the scatter plot)
in this strange arc configuration, with the lab
hi all,
i am trying to make scatter plots with marginal histograms shown in the same
plot, using the recently checked in example 'scatter_hist.py'. i want the
scatter plot to have an equal aspect ratio, but when i do this, the scales
of the marginal histograms get out of sync. for example, the cod
b 16, 2009 at 8:22 AM, Manuel Metz wrote:
> Attached is a very simple example that shows how to do something similar
> to scatterhist in matplotlib
>
> Manuel
>
> per freem wrote:
> > hello,
> >
> > is there a way to make a 2d scatter plot that includes (outsid
hi all,
i managed to do linear regression on two vectors x, and y using
linalg.lstsq. what i can't figure out is how to compute the R-squared value
- the correlation of the two vectors - in matplotlib. can someone please
point me to the right function? thank you.
--
hi all,
i have the following plot:
rcParams['xtick.direction'] = 'out'
rcParams['ytick.direction'] = 'out'
scatter(x, y)
this changes the tick directions to be out. how can i make it so only the
ticks on the x axis and y axis appear? i.e. remove the ticks that are in the
top axis (the one parall
hi all,
i am using the tex feature to put some greek symbols in some labels of my
plots. for example,
rcParams['text.usetex'] = True
plot(a, b, 'o')
xlabel('\Delta direction')
the '\Delta' is rendered correctly but that changes the fonts of the tick
labels and of all the text in the labels to te
hi all,
can someone advise on how to make simple venn diagrams, like the one here:
http://en.wikipedia.org/wiki/File:Venn_diagram_cmyk.svg
simply three (or more) intersecting circles, such that one can label every
point of their intersection, and maybe make the circles in size proportion
to the
ormal.
how can i make the bar widths greater in this case?
On Sun, Mar 1, 2009 at 11:41 AM, per freem wrote:
> hi all,
>
> i am reading a set of tab-separated data from a file and i want to put it
> into an array, and then plot some of the columns. i know the number of
> column
hi all,
i am reading a set of tab-separated data from a file and i want to put it
into an array, and then plot some of the columns. i know the number of
columns ahead of time but not the number of rows. i load the array from the
file as follows, which seems to work:
data = []
for line in myfile:
thank you for your reply. when i try either of the first suggestions about
changing the fonts, i get the error:
AttributeError: 'FontProperties' object has no attribute 'get_slant'
any idea what this means?
also, i do not mind setting the position of each tickmark individually but i
cannot find
hi all,
when i make any numeric scatter plot containing floats, the formatted tick
labels always have leading zeros, e.g "0.5" as opposed to ".5" in the
labels.
for example:
x = rand(10)
scatter(x,x)
is there any way to change this to remove the leading zeros? i have tried:
s = subplot(111)
ma
hi all,
two quick questions about plotting: i am trying to very simply reset the
font family to be 'helvetica' for my figure, in particular for the
ticklabels. i have tried using the following:
def axes_square(plot_handle):
plot_handle.axes.set_aspect(1/plot_handle.axes.get_data_ratio())
rcP
hi all,
when plotting a simple scatter plot in matlab, points that overlap will
cross in each other -- if i plot
scatter(randn(1,1000),randn(1,1000))
then no point will be fully "on top" of the other -- if they overlap, then
their edges will cross and they will look like tiny venn diagrams.
in
hi all,
i'm trying to do something extremely simple, namely print a scatter plot of
two random arrays:
import matplotlib.plt as plt
from numpy.random import *
x = rand(1,10)
scatter(x, x)
this fails with the error:
ValueError: Offsets array must be Nx2
what is happening here? are arrays someh
hello,
is there a way to make a 2d scatter plot that includes (outside the axes)
histograms of the marginals of the two variables? like the matlab function
'scatterhist'. see this for an example:
http://www.mathworks.com/access/helpdesk/help/toolbox/stats/index.html?/access/helpdesk/help/toolbox/
hello,
is there a way to make a 2d scatter plot that includes (outside the axes)
histograms of the marginals of the two variables? like the matlab function
'scatterhist'. see this for an example:
http://www.mathworks.com/access/helpdesk/help/toolbox/stats/index.html?/access/helpdesk/help/toolbox/
81 matches
Mail list logo