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.
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 alan.is...@gmail.com wrote:
On 7/9/2010 12:02 AM, per freem wrote:
How can I plot
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 robert.k...@gmail.com wrote:
On 7/9/10 10:02 AM, per freem wrote:
I'd like to clarify: I want the empirical cdf, but I
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 perfr...@gmail.com wrote:
How does Alan's code compare with using cumfreq and then plotting its
result? Is the only
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
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:
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,
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
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,
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
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 lee.j.j...@gmail.com wrote:
On Thu, Dec 24, 2009 at 3:53 PM, per freem perfr...@gmail.com wrote:
i want
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.
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
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
:
On Fri, Nov 13, 2009 at 12:36 PM, per freem perfr...@gmail.com wrote:
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
the
irrelevant axes invisible, I think -- then the labels of the x-axis
disappear.
any idea how this can be fixed? i want those axes removed but i still
want the labels/ticks of the bottom x-axis to show.
thanks.
On 11/11/09, Gökhan Sever gokhanse...@gmail.com wrote:
On Wed, Nov 11, 2009 at 4:25 PM, per
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
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
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
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
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
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
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
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)
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
i figured out what i did wrong and so am writing it here in case it
helps others.
the basic issue is that the .ttf font was missing in the new
matplotlib directory. to discover this, i ran python with
--verbose-debug as suggested in previous threads by others. then i
copied my version of
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
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
hi all,
thanks for these comments. i tried loadtxt and genfromtxt and am
having similar problems. my data looks like this:
my;header1 myheader-2_amyheader-2_b
a:5-X:b 3;0;5;0;0;0 3.015
c:6-Y:d 0;0;0;0;0;0 2.5
i simply want to read these in, and have all numbers be read in as
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
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
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:
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:
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
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)
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?
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
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
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], '--',
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
-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 different ways to cycle through the colors
of a colormap.
Hope that helps,
-Tony
On Jul 14, 2009, at 9:51 AM, per freem wrote:
Hi
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
?
On Mon, Jun 29, 2009 at 8:47 AM, Michael Droettboom md...@stsci.edu 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 to
True.
Cheers,
Mike
per freem wrote:
I just wanted to add: if i
', 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 elements.
On Mon, Jun 29, 2009 at 4:46 PM, per freem perfr...@gmail.com wrote:
hi all,
I
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
helvetica with bitstream?
On Sun, Jun 28, 2009 at 11:28 AM, per freem perfr...@gmail.com 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
matplotlib. my code is:
from scipy import *
import
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)
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
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)
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 efir...@hawaii.edu wrote:
per freem wrote:
hi all,
i have a series of subplots organized in a column (3x1). i noticed that if
i plot them then matplotlib
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
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
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,
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
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
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,
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
at 8:22 AM, Manuel Metz mm...@astro.uni-bonn.dewrote:
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 (outside the axes)
histograms
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
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
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:
widths greater in this case?
On Sun, Mar 1, 2009 at 11:41 AM, per freem perfr...@gmail.com 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
columns ahead of time but not the number
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
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())
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)
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,
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
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
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:
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:
75 matches
Mail list logo