[Matplotlib-users] plotting 3D scatter plots in matplotlib

2011-03-30 Thread per freem
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.

Each matrix represents a different data group and I want each to be
plotted with a different color, and then set a legend for the entire
figure.

I have the following code:

fig = pylab.figure()
s = plt.subplot(1, 1, 1)
colors = ['k', #B3C95A, 'b', '#63B8FF', 'g', #FF3300,
  'r', 'k']
ax = Axes3D(fig)
plots = []
index = 0

for data, curr_color in zip(datasets, colors):
p = ax.scatter(log2(data[:, 0]), log2(data[:, 1]),
   log2(data[:, 2]), c=curr_color, label=my_labels[index])

s.legend()
index += 1

plots.append(p)

ax.set_zlim3d([-1, 9])
ax.set_ylim3d([-1, 9])
ax.set_xlim3d([-1, 9])

The issue is that ax.scatter plots things with a transparency and I'd
like that remove. Also, I'd like to set the xticks and yticks and
zticks -- how can I do that?

Finally, the legend call does not appear, even though I am calling
label= for each scatter call. How can I get the legend to appear?

thanks very much for your help.

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread per freem
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 the empirical CDF of an array of numbers in matplotlib
  in Python?


 I recalled David Huard posted the below,
 which apparently was once in the sandbox...
 hth,
 Alan Isaac

 def empiricalcdf(data, method='Hazen'):
     Return the empirical cdf.

     Methods available (here i goes from 1 to N)
         Hazen:       (i-0.5)/N
         Weibull:     i/(N+1)
         Chegodayev:  (i-.3)/(N+.4)
         Cunnane:     (i-.4)/(N+.2)
         Gringorten:  (i-.44)/(N+.12)
         California:  (i-1)/N

     :see:
 http://svn.scipy.org/svn/scipy/trunk/scipy/sandbox/dhuard/stats.py
     :author: David Huard
     
     i = np.argsort(np.argsort(data)) + 1.
     nobs = len(data)
     method = method.lower()
     if method == 'hazen':
         cdf = (i-0.5)/nobs
     elif method == 'weibull':
         cdf = i/(nobs+1.)
     elif method == 'california':
         cdf = (i-1.)/nobs
     elif method == 'chegodayev':
         cdf = (i-.3)/(nobs+.4)
     elif method == 'cunnane':
         cdf = (i-.4)/(nobs+.2)
     elif method == 'gringorten':
         cdf = (i-.44)/(nobs+.12)
     else:
         raise 'Unknown method. Choose among Weibull, Hazen, Chegodayev,
 Cunnane, Gringorten and California.'
     return cdf




 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread per freem
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 want it to be
 normalized.  There's a normed=True option to plt.hist but how can I do
 the equivalent for CDFs?

 There is no such thing as a normalized empirical CDF. Or rather, there is no
 such thing as an unnormalized empirical CDF.

 Alan's code is good. Unless if you have a truly staggering number of points,
 there is no reason to bin the data first.

 --
 Robert Kern

 I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth.
   -- Umberto Eco


 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to plot the empirical cdf of an array?

2010-07-09 Thread per freem
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 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 want it to be
 normalized.  There's a normed=True option to plt.hist but how can I do
 the equivalent for CDFs?

 There is no such thing as a normalized empirical CDF. Or rather, there is no
 such thing as an unnormalized empirical CDF.

 Alan's code is good. Unless if you have a truly staggering number of points,
 there is no reason to bin the data first.

 --
 Robert Kern

 I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it 
 had
  an underlying truth.
   -- Umberto Eco


 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting heatmap matrices in matplotlib with scale

2010-06-05 Thread per freem
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 maps. Is the right function for this imshow, or pcolor?
Also, how can I get the scale bar to the left of it that shows the
ranges of the intensities, and how can this scale be adjusted?

Thanks very much.

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] using subscripts and tex in labels

2010-01-31 Thread per freem
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$\log_{10}$), since that will use LaTeX fonts
instead of my helvetica font.

second question, when using TeX, I tried the following TeX command in labels:
plt.annotate(r\frac{\sigma}{\sqrt{\mu}}, ) but it complains that
not all arguments converted during string formatting -- but it seems
like correct TeX to me. if I try r\frac{1}{2} then it works, but
using \sigma and \sqrt inside breaks it.. any idea how to fix this?

thanks.

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Setting dash size and gap of dashed line in matplotlib

2010-01-30 Thread per freem
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.

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] using the symbol font in TeX plots

2010-01-26 Thread per freem
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-serif','sans-serif':['Helvetica']})
plt.rcParams['pdf.fonttype'] = 42
# plot figure
# ...
# annotate figure
plt.xlabel(r'$\mu$ = 50')
plt.ylabel(r'$\sigma$ = 1.5')

This makes the equal symbol and everything to the right of it in the
Helvetica font, as intended, and the Greek symbols default to the
usual TeX font (which I believe is Times New Roman.)

How can I make it so the font used for the Greek letters is the
Symbol font instead?  It's important for me not to have it appear in
the default Times font of TeX.

thanks for your help.

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] positioning an inset_axes precisely in the figure

2010-01-26 Thread per freem
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 trying to use the bbox_transform keyword argument to reposition
this within the figure -- i want to use figure coordinates rather than
the loc= keyword.

if i try the following:

inset = inset_axes(s,
   width=30%, # width = 30% of parent_bbox
   height=.5, # height : 1 inch
   bbox_transform=(0.1, 0.1))

then i get the error:

  File 
/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/offsetbox.py,
line 910, in get_bbox_to_anchor
transform)
  File 
/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/transforms.py,
line 974, in __init__
assert isinstance(transform, Transform)
AssertionError

any idea how i can reposition the inset axes? thanks very much for your help.

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] feature discussion/request: a 'layout' command for matplotlib

2010-01-09 Thread per freem
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 layout command, which allows you to nearly
arbitrarily arrange the subplots of a figure. this command is much
more general than subplot since it does not restrict you to square
arrangements of figure subplots.

for examples, check out these figures/examples:

1. source code of complex layout:
http://rgraphics.limnology.wisc.edu/rmargins_layout.php
(the associated graph it produces is here:
http://rgraphics.limnology.wisc.edu/images/layouts/rmargins_layout_thumb.png)

2. a tutorial on complex layouts with this command:
http://www.statmethods.net/advgraphs/layout.html
in particular, see:
http://www.statmethods.net/advgraphs/images/layout3a.png where a
complex layout which is currently not possible with subplot is made.

a command like R's layout would be a tremendously helpful addition to
matplotlib, in my opinion. it will prevent the need for annoying
manual postprocessing of figures into these layouts using tools like
Illustrator, since these figures could be generated programmatically
instead, which much more precision.

as far as i know, this cannot be done in matplotlib right now, without
plotting your own axes (using some combination of axes grid toolkit
and raw axes plotting.)

if anyone out there has written some kind of wrappers that do
something like the layout command, i would love to know about it. if
it's still in testing and not part of the current matplotlib, i'd be
more than happy to beta test this for anyone and try it on many
examples.

thanks very much for your help.

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] dividing up subplots?

2010-01-03 Thread per freem
thanks very much.  Using expand_subplot for that purpose worked great,
but I am now trying a variant of this and am having trouble getting it
to work.

I'd like to create a subplot that has two parts: the left part is a
square plot, and the right part is a 2x2 set of square subplots.
Something like this:

http://www.mathworks.com/access/helpdesk_archive_ja_JP/r2007/help/toolbox/matlab/ref/image/subplot_vert.gif

Except the left hand plot should have square axes.  just imagine
taking a square plot and putting it on the left, and then making a 2x2
subplot, which each subplot is less than 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 lee.j.j...@gmail.com wrote:
 On Thu, Dec 24, 2009 at 3:53 PM, per freem perfr...@gmail.com wrote:
 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,

 Matpltlib's subplot does not support it as of now.

 There a few work around you may try, but it will at least take a few
 tens of lines of code. Attached is a way to do this by patching the
 object method, which I personally do not prefer but may be one of the
 easiest for normal users.

 Also, there is a patch I once worked on, but haven't pushed into the
 svn yet (i'm not sure if I ever will). So give it a try if you want.

 http://article.gmane.org/gmane.comp.python.matplotlib.general/19097

 Regards,

 -JJ


 import matplotlib.transforms as mtransforms

 def expand_subplot(ax, num2):
    update_params_orig = ax.update_params

    ax._num2 = num2 - 1
    def _f(self=ax):
        num_orig = self._num

        self._num = self._num2
        update_params_orig()
        right, top = self.figbox.extents[2:]

        self._num = num_orig
        update_params_orig()
        left, bottom = self.figbox.extents[:2]

        self.figbox = mtransforms.Bbox.from_extents(left, bottom,
                                                    right, top)

    ax.update_params = _f
    ax.update_params()
    ax.set_position(ax.figbox)


 ax = subplot(231)
 expand_subplot(ax, 2)


--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] making inset graphs (small graph inside larger graph?)

2009-12-23 Thread per freem
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.

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] changing the xtick/ytick pads for subplots?

2009-11-13 Thread per freem
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 seems to only work for the y-axis and not
the x-axis for some reason -- here is an example:

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-serif','sans-serif':['Helvetica']})
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['font.size'] = 10
from mpl_toolkits.axes_grid.axislines import SubplotZero

def setup_axes(fig, labelpad=1, invisible=[bottom, top, right]):
plt.rcParams['ytick.major.pad'] = 2
plt.rcParams['ytick.minor.pad'] = 2
# Y ticks work, but X tick do not...
plt.rcParams['xtick.major.pad'] = 0.01
plt.rcParams['xtick.minor.pad'] = 0.01
ax = SubplotZero(fig, 1, 1, 1)
fig.add_subplot(ax)
# make xzero axis (horizontal axis line through y=0) visible.
ax.axis[xzero].set_visible(True)
# make other axis (bottom, top, right) invisible.
for n in invisible:
ax.axis[n].set_visible(False)
return ax

fig = plt.figure(figsize=(5, 5), dpi=300)
setup_axes(fig, labelpad=2)
x = range(1, 11)
y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
plt.plot(x, y)
ax = plt.gca()
plt.savefig('test.pdf')

i am seeing the ylabels get closer to the y-axis, but the x-axis seems
to have no effect. it seems to be related to SubplotZero since
otherwise in ordinary plots this works fine. any idea how this could
be fixed?

thanks very much for your help.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] adjusting space between axes label and axes

2009-11-13 Thread per freem
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 label and the axes.

how can this be done?  thanks.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] adjusting space between axes label and axes

2009-11-13 Thread per freem
thanks for the suggestion, though this does not work for me in the
following example:

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-serif','sans-serif':['Helvetica']})
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['font.size'] = 10

from mpl_toolkits.axes_grid.axislines import SubplotZero

def setup_axes(fig, labelpad=1, invisible=[bottom, top, right]):
plt.rcParams['ytick.major.pad'] = 2
plt.rcParams['ytick.minor.pad'] = 2
# Y ticks work, but X tick do not...
plt.rcParams['xtick.major.pad'] = 0.01
plt.rcParams['xtick.minor.pad'] = 0.01
ax = SubplotZero(fig, 1, 1, 1)
fig.add_subplot(ax)
# make xzero axis (horizontal axis line through y=0) visible.
ax.axis[xzero].set_visible(True)
# make other axis (bottom, top, right) invisible.
for n in invisible:
ax.axis[n].set_visible(False)
return ax

fig = plt.figure(figsize=(5, 5), dpi=300)
setup_axes(fig, labelpad=2)
x = range(1, 11)
y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
plt.plot(x, y, linewidth=1.5, c='k')
plt.ylabel('hello', labelpad=10)
xlab = 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 gokhanse...@gmail.com wrote:


 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 by 'xtick.major.pad' or 'ytick.major.pad')
 but between the overall axes label and the axes.

 how can this be done?  thanks.


 Using the set_position method, e.g. :

 xlab = plt.xlabel(my x-axes label)
 xlab.set_position((0.2, 0.1))



 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008
 30-Day
 trial. Simplify your report design, integration and deployment - and focus
 on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



 --
 Gökhan


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bug in set_yscale of bar graphs?

2009-11-12 Thread per freem
thanks to all for the replies. i am still having an issue with the log
scale of these plots. i am trying to hide the top and right axes of
the plot, since these should not be there when plotting a histogram or
a line plot. 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'] = True
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['font.size'] = 10

from mpl_toolkits.axes_grid.axislines import SubplotZero

fig = plt.figure(figsize=(5, 5), dpi=300)
ax = SubplotZero(fig, 1, 1, 1)
ax = fig.add_subplot(ax)
x = range(1, 11)
y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
plt.plot(x, y, linewidth=1.5, c='k')
ax = plt.gca()
ax.set_yscale('log')
ax.axis[xzero].set_visible(True)
# make other axis (bottom, top, right) invisible.
invisible = [bottom, top, right]
for 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.

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 freem perfr...@gmail.com wrote:
 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'] = True
 rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
 plt.rcParams['pdf.fonttype'] = 42
 plt.rcParams['font.size'] = 10

 x = range(1, 11)
 y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
 plt.figure(figsize=(5, 5), dpi=300)

 plt.bar(x, y)

 It should work scaling from within the bar()
 plt.bar(x, y, log=True)

 # plt.gca().set_yscale('log')

 plt.savefig('test_logscale.pdf')

 the problem is that the bar graphs do not appear -- instead, i simply
 get horizontal lines around where the top of the bar graph should
 appear. Any idea how to fix this?

 also, sometimes the x axis disappears when i try this. thanks.

 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008
 30-Day
 trial. Simplify your report design, integration and deployment - and focus
 on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




 --
 Gökhan


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] parsing tab separated files into dictionaries - alternative to genfromtxt?

2009-11-11 Thread per freem
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 column named by
'header_name1', d['header_name2'] to access the column named by
'header_name2', etc.  Or it will allow you to traverse the file line
by line, and then access each header by number, i.e.

for line in d:
  field1 = d[0]
  field2 = d[1]
  # etc.

the problem is that the second method relies on knowing the order of
the fields rather than just their name, and the first method does not
allow line by line iteration.
ideally what i would like is to be able to traverse each line of the
parsed file, and then refer to each of its fields by header name, so
that if the column order in the file changes my program will be
unaffected:

for line in d:
  field1 = ['header_name1']
  field2 = ['header_name2']

is there a way to do this using standard matplotlib/numpy/scipy
utilities? i could write my own code to do this but it seems like
something somebody probably already thought of a good representation
for and has implemented a more optimized version than i could write on
my own. does such a thing exist?

thanks very much

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] drawing arrows

2009-10-26 Thread per freem
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 = plt.gca()
prev_val = init_val
for x, y in all_vals[1:]:
ax = plt.gca()
start_coord = prev_val
plt.scatter(start_coord[0], start_coord[1], c=c)
end_coord = (x, y)
ax.add_patch(FancyArrowPatch(start_coord, end_coord,
 arrowstyle='-', edgecolor=c,
facecolor=c, mutation_scale=10))
prev_val = end_coord
plt.scatter(all_vals[-1][0], all_vals[-1][1], c=c)

points = rand(5,2)
init = [0, 0]
plot_arrows(init, points)
plt.show()

this usually works, but sometimes when i give it a set of points (not
necessarily ones generated randomly), then it gives me the error:

Library/Python/2.5/site-packages/matplotlib/bezier.pyc in
split_path_inout(path, inside, tolerence, reorder_inout)
265
266 if bezier_path is None:
-- 267 raise ValueError(The path does not seem to intersect
with the patch)
268
269 bp = zip(bezier_path[::2], bezier_path[1::2])

ValueError: The path does not seem to intersect with the patch

any idea what could be causing this? it seems like any arbitrary set
of points should work here, since you can always draw an arrow between
any two points not sure what is the root of this error. any help
would be really appreciated. thank you.

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] drawing points on simplex?

2009-10-18 Thread per freem
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 a point on the simplex.

is there an easy way to do this in matplotlib? just to be clear, i
dont want to draw a density/distribution over the simplex, but just
individual points on it. so really all i want are three ordinary axes
that happen to intersect and make a triangle.

thanks very much.

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting normalized histograms

2009-10-16 Thread per freem
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[:, 0], 15)
plt.subplot(2, 2, 1)
# histogram of second column
plt.hist(mydata[:, 1], 15)
# etc...

since i want the subplots to be comparable, i'd like hist to use the
same bins for all subplots. how can i do this?

also, i would like to, instead of showing counts on the y-axis, show
the normalized probability of each bin. i looked into the normed
optional argument, but i don't think it achieves this. my attempt to
do this was:

plt.hist(mydata[:, 0], 15, normed=1)

but the y-axis is not set to be between 0 and 1.

any ideas on how to do this would be greatly appreciated. thanks.

plt.hist(mydata[:, 0]

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] sharing labels and legends across subplots

2009-10-11 Thread per freem
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 legends inside subplots. what i have right now is:

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.axislines import SubplotZero
fig = plt.figure()
ax = SubplotZero(fig, 3, 1, 1)
ax1 = fig.add_subplot(ax)
ax.axis[xzero].set_visible(True)
plt.plot([1,2,3], label=line a, c='r')
plt.plot([1.2, 2.4, 3.01], label=line b, c='b')
ax = SubplotZero(fig, 3, 1, 2)
ax2 = fig.add_subplot(ax)
plt.plot([1,2,3], label=line a, c='r')
plt.plot([1.2, 2.4, 3.01], label=line b, c='b')
ax = SubplotZero(fig, 3, 1, 3)
ax3 = fig.add_subplot(ax)
plt.plot([1,2,3], label=line a, c='r')
plt.plot([1.2, 2.01, 3.01], label=line b, c='b')
plt.figlegend([ax1.lines[0], ax1.lines[1]], [line a, line b], 'upper right')

two quick questions about this: first, how can i create a single
ylabel for the figure?  i still want each subplot to have its own
yticks and ytick labels but i just want a main label, since the
quantity plotted on each y axis is the same.

finally, plt.figlegend does display a main legend for the figure, like
i intended, but i was hoping someone can explain how ax1.lines gets
set. i was expecting ax1.lines to have 2 elements in it, one for each
line plotted, but it has 4. why is that? right now i simply used
lines[0] and lines[1] to create the labels for only the plotted
lines... is there a better way of doing this?

thanks.

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] making horizontal axes labels in plots

2009-10-11 Thread per freem
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.pyplot as plt
fig = plt.figure()
ax = SubplotZero(fig, 3, 1, 1)
ax1 = fig.add_subplot(ax)
ax.axis[xzero].set_visible(True)
plt.plot([1,2,3], label=line a, c='r')
plt.plot([1.2, 2.4, 3.01], label=line b, c='b')
plt.ylabel(hello, rotation='horizontal')
ax = SubplotZero(fig, 3, 1, 2)
ax2 = fig.add_subplot(ax)
plt.plot([1,2,3], label=line a, c='r')
plt.plot([1.2, 2.4, 3.01], label=line b, c='b')
plt.ylabel(world)
ax = SubplotZero(fig, 3, 1, 3)
ax3 = fig.add_subplot(ax)
plt.plot([1,2,3], label=line a, c='r')
plt.plot([1.2, 2.01, 3.01], label=line b, c='b')
plt.figlegend([ax1.lines[0], ax1.lines[1]], [line a, line b], 'upper right')

but it does not work. both the labels hello and world of the y
axes are displayed in their default vertical orientation. the argument
seems to have no effect. i am using matplotlib '0.99.0' on Mac OS X.
any ideas how to fix this?

thanks.

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] error when installing matplotlib -- wx requirement?

2009-10-05 Thread per freem
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 --prefix=/my/local/dir

which yields:


BUILDING MATPLOTLIB
   matplotlib: 0.99.1.1
   python: 2.5.2 (r252:60911, Jul 22 2009, 15:33:10)  [GCC
   4.2.4 (Ubuntu 4.2.4-1ubuntu3)]
 platform: linux2

REQUIRED DEPENDENCIES
numpy: 1.3.0rc2
freetype2: found, but unknown version (no pkg-config)

OPTIONAL BACKEND DEPENDENCIES
   libpng: found, but unknown version (no pkg-config)
  Tkinter: no
   * TKAgg requires Tkinter
 wxPython: no
   * wxPython not found
Traceback (most recent call last):
 File setup.py, line 146, in module
   import wx
ImportError: No module named wx

thanks.

--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] parsing csv files and accessing a particular column value

2009-10-01 Thread per freem
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'] == x)

which returns the indices that match. is there a more efficient way to
do this? i'm willing to assume that the values in this column are
unique, so a dict like structure might work. however, i prefer to use
a built in function that might do something like this... is there a
way to do this with the array returned by genfromtxt for example?

thank you.

--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] stacked bar graphs not appearing correctly

2009-09-27 Thread per freem
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')
plt.bar(ind, [5969352, 5011032, 5590754], width, align='center',
bottom=[5128307, 4305252, 4817425], color='k')

i want it to be so that the bar graphs with values [5128307, 4305252,
4817425] appear in red below the taller bar graphs with values
[5969352, 5011032, 5590754].  when i try to plot this, i get a very
strange y-axis, formatted on a 1e7 scales, and the values appear
wrong.

if i modify my plot to simply be:

ind = np.arange(3)
width = 0.35
plt.bar(ind, [5969352, 5011032, 5590754], width, align='center', color='k')

then the y-axis appears correctly, with ylim set to 6 million. how can
i get the graph to look just like this, except have the stacked
smaller bar graphs appear in red?

any help on this would be greatly appreciated.

thanks.

--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting asymmetric error bars?

2009-09-12 Thread per freem
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 documentation for plt.errorbar asks for. when i try to plot this,
i get the following error:

/Library/Python/2.5/site-packages/matplotlib/axes.pyc in vlines(self,
x, ymin, ymax, colors, linestyles, label, **kwargs)
   3271
   3272 verts = [ ((thisx, thisymin), (thisx, thisymax))
- 3273 for thisx, (thisymin,
thisymax) in zip(x,Y)]
   3274 #print 'creating line collection'
   3275 coll = mcoll.LineCollection(verts, colors=colors,

ValueError: too many values to unpack

any idea what's causing this?

the only way it lets me plot is if i do:

plt.errorbar([1,2,3],[1,2,3],yerr=[a[:, 0], a[:, 1]])

which is not the intended result, since the first column in a is the
-yerror and the second is +yerror. does anyone know how to fix this?

thank you.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] adjusting width of subplot columns

2009-09-11 Thread per freem
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 the
figure than the first column. for example, i want the series of
subplots in the first column to take up 70% of the figure, and the
subplots in the second column to take up only 30%. is there a way to
do this?

i looked into plt.subplots_adjust but i do not know how to use that
function to get this desired effect.

thanks.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] error bars getting cut off when plotting

2009-09-11 Thread per freem
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[xzero].set_visible(True)
for k in [bottom, top, right]:
ax.axis[k].set_visible(False)
m = array([0.83820351, 0.816858357])
sd = array([0.18543833, 0.12603507])
lw = 1.2
msize = 3
plt.errorbar([1, 2], m, yerr=sd, fmt='-s', markersize=msize, linewidth=lw)
tm = .8
lower_y = max(tm-.2, 0)
upper_y = min(tm+.4, 1)
ytickvals = arange(lower_y, upper_y + .1, .1)
plt.xlim([0, 3])
plt.yticks(ytickvals)
plt.ylim([lower_y, upper_y])
plt.savefig('test.pdf')

when i plot it, the top error bar of the first data point gets cut
off. this error bar should be at location:
0.83820351+0.18543833 which slightly exceeds the ylimit of 1.
since the y value here is a probability, i dont want the plot to have
labels on it that exceed 1, since that does not make sense. is there
any way to allow more room for the y axis without plotting values
greater than 1? this is only for the purpose of errorbars. again,
these data were just various probabilities, and so they never exceed
1.

thanks.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplotlib-0.99 font incompatibility?

2009-08-22 Thread per freem
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':'sans-serif','sans-serif':['Helvetica']})
from scipy import *
from numpy import *

my_fig = plt.figure(figsize=(6,5), dpi=100)
x = rand(100)*300
y = rand(100)
plt.scatter(x, y)
plt.rcParams['xtick.direction'] = 'out'
plt.rcParams['ytick.direction'] = 'out'
c = 0.05*300.5
plt.xlim([0-c, 300+c])
plt.ylim([-0.05, 1.05])
plt.savefig('x.pdf')

i recently upgraded to matplotlib-0.99 and the changing of the font
using the above method no longer works. the figure is plotted the
same, but the font remains the default matplotlib font.

one potential problem in the installation was this: i installed
matplotlib-0.99 using the dmg prepackaged binary installer. this
installed matplotlib in the directory:

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages

however, for some reason ipython / python2.5 was looking for packages in:

/Library/Python/2.5/site-packages

and so matplotlib/mpl_toolkits was not found. so I copied the
directories 'matplotlib' and 'mpl_toolkits' from
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
to /Library/Python/2.5/site-packages.  Perhaps this was the cause of
the problem?

thanks for your help.

(i run my code via ipython, by the way.)

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib-0.99 font incompatibility?

2009-08-22 Thread per freem
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 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 freemperfr...@gmail.com wrote:
 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':'sans-serif','sans-serif':['Helvetica']})
 from scipy import *
 from numpy import *

 my_fig = plt.figure(figsize=(6,5), dpi=100)
 x = rand(100)*300
 y = rand(100)
 plt.scatter(x, y)
 plt.rcParams['xtick.direction'] = 'out'
 plt.rcParams['ytick.direction'] = 'out'
 c = 0.05*300.5
 plt.xlim([0-c, 300+c])
 plt.ylim([-0.05, 1.05])
 plt.savefig('x.pdf')

 i recently upgraded to matplotlib-0.99 and the changing of the font
 using the above method no longer works. the figure is plotted the
 same, but the font remains the default matplotlib font.

 one potential problem in the installation was this: i installed
 matplotlib-0.99 using the dmg prepackaged binary installer. this
 installed matplotlib in the directory:

 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages

 however, for some reason ipython / python2.5 was looking for packages in:

 /Library/Python/2.5/site-packages

 and so matplotlib/mpl_toolkits was not found. so I copied the
 directories 'matplotlib' and 'mpl_toolkits' from
 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
 to /Library/Python/2.5/site-packages.  Perhaps this was the cause of
 the problem?

 thanks for your help.

 (i run my code via ipython, by the way.)


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] trouble installing new matplotlib on mac os x

2009-08-14 Thread per freem
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 me to download
matplotlib-0.99.0-py2.5-macosx10.5.dmg.  when i download this
installer and install it, it only lets me to install it in my mac
harddrive (I don't see any option to change the installation
location.)  installation goes through smoothly and in the end i get
the installation successful message.  however, only the older
version of matplotlib comes up when i do import matplotlib. i also
cannot where the new version was installed. does anyone know where the
files for the new matplotlib should be? they are not in
/Library/Frameworks/Python2.5/ it seems.

if i do:

locate matplotlib | grep 0.99

nothing comes up. i only see files related to the older matplotlib
when i do locate matplotlib in the shell.
any ideas how i can install this?  i wanted to try the .egg
installation with easy_install but when i do:

easy_install matplotlib

it matches to a 0.98 version of matplotlib, not 0.99.

thanks for your help

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] loading csv data into arrays

2009-08-12 Thread per freem
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 numbers. typically, one column is a set of strings and the
others are floats. it's necessary for me to be able to specify whether
the file has a header or not, or what the delimiter is. also, i'd like
to be able to manipulate the array that i read in and then easily
serialize it to a file as csv, again controlling the
delimiters/headers.

from the documentation, it looks like 'csv2rec'  (from
matplotlib.mlab) might be the best option, but i am having problems
with it. for example, i use:

data = csv2rec(se_counts, skiprows=1, delimiter='\t')

however, then i cannot access the resulting array 'data' by columns,
it seems. the usual array notation data[:, 0] to access the first
column does not work -- how can i access the columns?

also, the first line of the file in this case was a header. ideally
i'd like to be able to specify that to csv2rec, so that it uses the
tab separated headers in the first line as the field names for the
columns -- is there a way to do this?

finally, how can i then easily serialize the results to a csv file?

any help on this would be greatly appreciated. i am happy to use
options aside from 'csv2rec' -- it's just that this seemed closest to
what i wanted to do, but i might have missed something. thank you.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] loading csv data into arrays

2009-08-12 Thread per freem
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
floats and all things that don't look like numbers (in this case the
first and second columns) to be parsed in as strings.

i tried:

data = genfromtxt(myfile, delimiter='\t', dtype=None)

(if i don't specify dtype=None, it reads everything as NaN)

the first problem is that with dtype=None all the entries are parsed
as strings. i'd like to be able to read in the unambiguously numeric
values as numbers (column 3 in this case.)

the second problem is that if i try to use headers as column names using:

data = genfromtxt(myfile, delimiter='\t', dtype=None, names=True)

then it converts my headers into different strings:

 data
array([('a:5-X:b', '3;0;5;0;0;0', 3.0151),
   ('c:6-Y:d', '0;0;0;0;0;0', 2.5)],
  dtype=[('myheader1', '|S7'), ('myheader2_a', '|S11'),
('myheader2_b', 'f8')])

i would only like to refer to my headers using this notation:

data['my;header1']

i don't need to be able to write data.headername at all. is there a
way to make genfromtxt not mess with any of the header names, and read
in the numeric values?

thanks very much.


On Wed, Aug 12, 2009 at 11:16 AM, Ryan Mayrma...@gmail.com wrote:
 On Wed, Aug 12, 2009 at 10:01 AM, Sandro Tosi mo...@debian.org wrote:

 On Wed, Aug 12, 2009 at 16:56, per freemperfr...@gmail.com wrote:
  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

 numpy's loadtxt()

 With numpy 1.3 and newer, there's also numpy.genfromtxt (which actually
 should behave very similar to mlab.csv2rec):

 import numpy as np
 from StringIO import StringIO
 data = StringIO(
 #gender age weight
 M   21  72.10
 F   35  58.33
 M   33  21.99
 )

 arr = np.genfromtxt(data, names=True, dtype=None)
 print arr['gender']
 print arr['age']

 Writing this back out to a file in the same format will require a bit more
 of manual (though) straightforward work.  There's no simple method that will
 do it for you.  The best one liner here is:

 arr.tofile('test.txt', sep='\n')

cat arr.txt
 ('M', 21, 72.094)
 ('F', 35, 58.328)
 ('M', 33, 21.988)

 That should get you going.  If it's not enough, feel free to post a sample
 of your data file (or a representative example) and I can try to point you
 further in the right direction.

 Ryan

 --
 Ryan May
 Graduate Research Assistant
 School of Meteorology
 University of Oklahoma


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] hexbin density plots in matplotlib?

2009-08-12 Thread per freem
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 thing i cannot information on is: how can i make an automatic
legend for such plots, where hex bins of varying sizes are shown to
tell the viewer how many points fall into each bin size?

to make this clear, i am looking for something like this:

http://r-spatial.sourceforge.net/gallery/fig/fig12.png

where instead of bubbles, we have hexbins, and the legend on the right
gives a mapping from differently sized hex bins to the number of
points in that hexbin.

any help on this would be greatly appreciated. thanks.



On Wed, Aug 5, 2009 at 12:36 PM, John Hunterjdh2...@gmail.com wrote:
 On Wed, Aug 5, 2009 at 10:25 AM, Ryan Mayrma...@gmail.com wrote:

 is there a way to do this in matplotlib? thanks for your help.

 Not to be rude, but is there any reason you didn't look for pyplot.hexbin
 before sending the email? :)

 Continuing in the non-rude vein :-) See these examples::

  http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo.html
  http://matplotlib.sourceforge.net/examples/pylab_examples/hexbin_demo2.html

 and this doc string::

  http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.hexbin

 Have fun!
 JDH


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] complex layouts of plots in matplotlib

2009-08-09 Thread per freem
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 square matrix layouts that the 'subplot' function
produces (unless i am missing some other usage of 'subplot').

for example, creating a central square plot with two plots that are
narrower/rectangular on top of the square plot and to the side of it,
as in the example shown here:

http://www.statmethods.net/advgraphs/images/layout4.jpg

The code for that in R can be found here
http://www.statmethods.net/advgraphs/layout.html.  is there a way to
do this in matplotlib? ideally i'd like the top and right plots to
just be ordinary plot objects, such that i can change their
axes/labels in the same way that i change normal plots.

thanks.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting separated axes

2009-08-09 Thread per freem
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://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=82

or this: http://msenux.redwoods.edu/math/R/graphics/hist1.gif

any advice on how to do this would be greatly appreciated. thanks.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting lines with shaded / transparent region for standard deviation

2009-08-05 Thread per freem
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/vhost/arctic-roos.org/doc/observations/images/ssmi1_ice_ext.png

where the black line has shaded grey bands around. i'd like to plot
something like this but have the band be partly transparent.

is there a way to do this?  thank you.
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] hexbin density plots in matplotlib?

2009-08-05 Thread per freem
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/packages/2.3/bioc/html/hexbin.html

alternatively, the hexgons can be of the same size but shaded in proportion
to their counts. i am more interested in the case where the hexagons are
sized differently, but in any case, both hexagonal density plots come with
an associated legend on the side that shows the bins:

http://bm2.genes.nig.ac.jp/RGM2/R_current/library/hexbin/man/gplot.hexbin.html

is there a way to do this in matplotlib? thanks for your help.
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] changing tick labels and tick positioning to account for origin

2009-07-24 Thread per freem
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.rcParams['xtick.direction'] = 'out'
plt.rcParams['ytick.direction'] = 'out'
plt.xlim([-0.05, 300.05])
plt.ylim([-0.05, 1.05])
plt.show()

i'd like to leave a bit of space between the origin and the x-axis 0 and
between the origin and y-axis 0, which is why i added 0.05 to the end points
of each axis. however, i'd like the space between 0 and the origin on either
axis to be the same. since 0.05 on a scale from 0 to 300 is not the same
amount of space as 0.05 on a scale from 0 to 1, this is not the effect i
get. the yaxis looks good but the xaxis does not.  how can i fix this?

second, how can i remove the upper x axis ticks and the right y axis ticks?
these ticks are really not informative to the plot. ideally i would like to
remove those axes altogether, and just have one x axis and one y axis -- but
i don't want to manually plot the axes. is there a way to do this?

if that is not possible i'd like to at least remove those tick marks from
the duplicate axes. any thoughts on this will be greatly appreciated.

thank you
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting 2d or 3d normal distribution pdf

2009-07-22 Thread per freem
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?

thank you.
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting lines in the background of other lines

2009-07-17 Thread per freem
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.axhline. for
example if i have

plt.axhline(...plot horizontal line..., color='red')
plt.plot(...plot 1st line)
plt.plot(...plot 2nd line...)

then the horizontal line appears ON TOP of the other two lines -- i want it
to be the opposite, i want the horizontal line to be in the background. how
can i do this?

thank you
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] changing appearance of legend line entries

2009-07-17 Thread per freem
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 square marker line

however, in these types of plots, it's standard for the line in the legend
to only have *one* marker. meaning the legend should look like this:

--o--  label of circular marker line
--s--  label of square marker line

is there a way to get this modified legend appearance?

second question: how can i make the legend altogether smaller? or at least
make the label text font smaller?

thanks.
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] grouping several line types together in legend of plots

2009-07-16 Thread per freem
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=line_color[n], label=line %d
%(n))
  # plot ordinary line in different color
  plot(line_x[n], line_y[n], color=other_line_color[n], label=line %d
%(n))
  ...

If i plot n lines, i don't want the legend to show n-items, giving a
separate key for each line. rather, i want it to display a legend containing
a label for the dashed lines and a label for the solid lines, as in:

Legend:
[-- line of type A
 -  line of type B]

so 2 entries rather than as many entries as i have lines. how can i do this?

finally, how can i make it so the legend does not interfere with the plot?
right now the lines appear behind the legend. it'd be great if the legend
could be made to be in the background of the line (i.e. be transparent.)

thank you.
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] question about setting colors of lines using colormap

2009-07-14 Thread per freem
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.

the docs say how to set the color cycle of lines set by plot, using:

matplotlib.axes.set_default_color_cycle(['r', 'y', 'g', 'b'])

but this only allows me to use named colors, and here i am looking to use
shades from red to green.
my question is: first, how can i generate N evenly spaced colors from the
red spectrum to the green spectrum? and two, how can i make it so plot uses
these colors for its line plots?

thanks very much.
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question about setting colors of lines using colormap

2009-07-14 Thread per freem
Hi Tony,

thanks for the pointer.  that code does not run for me, it generates the
following error:

ttributeErrorTraceback (most recent call last)

color_cycle.py in module()
 63 if __name__ == '__main__':
 64 n_lines = 10
--- 65 cycle_cmap(length=n_lines)
 66 x = np.linspace(0, 10)
 67 for shift in np.linspace(0, np.pi, n_lines):

color_cycle.py in cycle_cmap(cmap, length)
 59 idx = np.linspace(crange['start'], crange['stop'],
length).astype(np.int)
 60 colors = cm(idx)
--- 61 mpl.axes.set_default_color_cycle(colors.tolist())
 62
 63 if __name__ == '__main__':

/Library/Python/2.5/site-packages/matplotlib/axes.pyc in
set_default_color_cycle(clist)
113 
114 _process_plot_var_args.defaultColors = clist[:]
-- 115 rcParams['lines.color'] = clist[0]
116
117 class _process_plot_var_args:

/Library/Python/2.5/site-packages/matplotlib/__init__.pyc in
__setitem__(self, key, val)
603 instead.'% (key, alt))
604 key = alt
-- 605 cval = self.validate[key](val)
606 dict.__setitem__(self, key, cval)
607 except KeyError:

/Library/Python/2.5/site-packages/matplotlib/rcsetup.pyc in
validate_color(s)
160 def validate_color(s):
161 'return a valid color arg'
-- 162 if s.lower() == 'none':
163 return 'None'
164 if is_color_like(s):

AttributeError: 'list' object has no attribute 'lower'
WARNING: Failure executing file: color_cycle.py

any idea what might be wrong?


On Tue, Jul 14, 2009 at 10:14 AM, Tony S Yu ton...@mit.edu wrote:

 Not too long ago, I posted an example of this to the 
 listhttp://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 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 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.

 the docs say how to set the color cycle of lines set by plot, using:

 matplotlib.axes.set_default_color_cycle(['r', 'y', 'g', 'b'])

 but this only allows me to use named colors, and here i am looking to use
 shades from red to green.
 my question is: first, how can i generate N evenly spaced colors from the
 red spectrum to the green spectrum? and two, how can i make it so plot uses
 these colors for its line plots?

 thanks very much.

 --
 Enter the BlackBerry Developer Challenge
 This is your chance to win up to $100,000 in prizes! For a limited time,
 vendors submitting new applications to BlackBerry App World(TM) will have
 the opportunity to enter the BlackBerry Developer Challenge. See full prize

 details at:
 http://p.sf.net/sfu/Challenge___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] unable to plot multiple lines with plot?

2009-07-14 Thread per freem
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')
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-serif','sans-serif':['Helvetica']})

my_fig = plt.figure(figsize=(6,5), dpi=100)
num_lines = 3

for n in range(0, num_lines):
print Printing line %d %(n+1)
x = range(0, 100)
y = (ones(100)*(n+1))
plt.plot(x, y)

plt.savefig('plot_example.pdf')

when I do this, it only plots the last line (a horizontal line at y = 3).
how can i get to actually plot all three lines?

more strangely, it shows *stochastic* behavior: sometimes when i run the
code, it generates a green line at y = 3, and other times a blue line. from
plot to plot, the upper bound of the y axis changes, sometimes being 3.15,
sometimes 3.2.  i'm not sure why it is doing that.

how can i get it to simply add whatever i plot in the body of the 'for' loop
to the same graph? i tried adding plt.plot() after my call to plt.plot but
that did not fix it.

thank you.
--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting figure font to helvetica

2009-06-29 Thread per freem
/Vera.ttf
findfont: Matching
:family=STIXGeneral:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to STIXGeneral
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf)
with score of 0.00
findfont: Matching
:family=STIXNonUnicode:style=normal:variant=normal:weight=bold:stretch=normal:size=12.0
to STIXNonUnicode
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf)
with score of 0.00
findfont: Matching
:family=STIXGeneral:style=normal:variant=normal:weight=bold:stretch=normal:size=12.0
to STIXGeneral
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf)
with score of 0.00
findfont: Matching
:family=STIXSize3:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to STIXSize3
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz3Sym.ttf)
with score of 0.00
findfont: Matching
:family=STIXSize4:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to STIXSize4
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz4Sym.ttf)
with score of 0.00
findfont: Matching
:family=STIXSize5:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to STIXSize5
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz5Sym.ttf)
with score of 0.00
findfont: Matching
:family=STIXSize1:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to STIXSize1
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz1Sym.ttf)
with score of 0.00
findfont: Matching
:family=STIXSize2:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to STIXSize2
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz2Sym.ttf)
with score of 0.00
findfont: Matching
:family=STIXGeneral:style=italic:variant=normal:weight=normal:stretch=normal:size=12.0
to STIXGeneral
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf)
with score of 0.00
findfont: Matching
:family=STIXNonUnicode:style=italic:variant=normal:weight=normal:stretch=normal:size=12.0
to STIXNonUnicode
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf)
with score of 0.00
findfont: Matching
:family=STIXNonUnicode:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to STIXNonUnicode
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf)
with score of 0.00
findfont: Matching
:family=cmb10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to cmb10
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf)
with score of 0.00
findfont: Matching
:family=cmtt10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to cmtt10
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf)
with score of 0.00
findfont: Matching
:family=cmmi10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to cmmi10
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf)
with score of 0.00
findfont: Matching
:family=cmex10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to cmex10
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10.ttf)
with score of 0.00
findfont: Matching
:family=cmsy10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to cmsy10
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf)
with score of 0.00
findfont: Matching
:family=cmr10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to cmr10
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf)
with score of 0.00
findfont: Matching
:family=cmss10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
to cmss10
(/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf)
with score of 0.00

any idea what might be wrong here?

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 simply set the font to Arial, using

 rc('font',**{'family':'sans-serif','sans-serif':['Arial']})

 then it works. But the same call with Helvetica still defaults to that
 Bitstream/default font of matplotlib. any idea why this might be? could
 matplotlib be confusing helvetica with bitstream?

 On Sun, Jun 28, 2009 at 11:28 AM, per freem perfr...@gmail.com mailto:
 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 matplotlib
matplotlib.use('PDF')
from matplotlib import rc
import

Re: [Matplotlib-users] setting figure font to helvetica

2009-06-29 Thread per freem
more information on this. if i try to use pdf.use14corefonts, like was
suggested by Jouni, as follows:

from scipy import *
import matplotlib
matplotlib.use('PDF')
from matplotlib import rc
import matplotlib.pyplot as plt
rc('font',**{'family':'sans-serif','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 elements.



On Mon, Jun 29, 2009 at 4:46 PM, per freem perfr...@gmail.com wrote:

 hi all,

 I am not sure if I have helvetica installed as a TTF -- how can i install
 it if i don't?

 i followed the debug suggestion and here are the results. when i set the
 font to arial, using:

 from matplotlib import rc
 rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})

 then the relevant output i get using --verbose-debug is:

 matplotlib version 0.98.5.2
 Using fontManager instance from /Users/perf/.matplotlib/fontList.cache
 backend pdf version unknown
 findfont: Matching
 :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
 to Arial (/Library/Fonts/Arial.ttf) with score of 0.00
 findfont: Matching
 :family=STIXGeneral:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to STIXGeneral
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf)
 with score of 0.00
 findfont: Matching
 :family=STIXNonUnicode:style=normal:variant=normal:weight=bold:stretch=normal:size=12.0
 to STIXNonUnicode
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf)
 with score of 0.00
 findfont: Matching
 :family=STIXGeneral:style=normal:variant=normal:weight=bold:stretch=normal:size=12.0
 to STIXGeneral
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf)
 with score of 0.00
 findfont: Matching
 :family=STIXSize3:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to STIXSize3
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz3Sym.ttf)
 with score of 0.00
 findfont: Matching
 :family=STIXSize4:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to STIXSize4
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz4Sym.ttf)
 with score of 0.00
 findfont: Matching
 :family=STIXSize5:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to STIXSize5
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz5Sym.ttf)
 with score of 0.00
 findfont: Matching
 :family=STIXSize1:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to STIXSize1
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz1Sym.ttf)
 with score of 0.00
 findfont: Matching
 :family=STIXSize2:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to STIXSize2
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSiz2Sym.ttf)
 with score of 0.00
 findfont: Matching
 :family=STIXGeneral:style=italic:variant=normal:weight=normal:stretch=normal:size=12.0
 to STIXGeneral
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf)
 with score of 0.00
 findfont: Matching
 :family=STIXNonUnicode:style=italic:variant=normal:weight=normal:stretch=normal:size=12.0
 to STIXNonUnicode
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf)
 with score of 0.00
 findfont: Matching
 :family=STIXNonUnicode:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to STIXNonUnicode
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf)
 with score of 0.00
 findfont: Matching
 :family=cmb10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to cmb10
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf)
 with score of 0.00
 findfont: Matching
 :family=cmtt10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to cmtt10
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf)
 with score of 0.00
 findfont: Matching
 :family=cmmi10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to cmmi10
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf)
 with score of 0.00
 findfont: Matching
 :family=cmex10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to cmex10
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10.ttf)
 with score of 0.00
 findfont: Matching
 :family=cmsy10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to cmsy10
 (/Library/Python/2.5/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf)
 with score of 0.00
 findfont: Matching
 :family=cmr10:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0
 to cmr10
 (/Library/Python/2.5/site

[Matplotlib-users] setting figure font to helvetica

2009-06-28 Thread per freem
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',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['font.family'] = 'Helvetica'
plt.hist(rand(100))
xlabel(rMy x axis $\alpha$)
ylabel(rMy y axis $\beta$)

i verified that plt.rcParams gets modified to use 'Helvetica' as the value
for font.family, etc. but i still get the default font used in all of these
figures. i tried using the PS backend using matplotlib.use('PS') but the
problem persists. i am interested in getting out PDFs that use helvetica
everywhere.

does anyone know how to fix this? thank you.
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting figure font to helvetica

2009-06-28 Thread per freem
I just wanted to add: if i simply set the font to Arial, using

rc('font',**{'family':'sans-serif','sans-serif':['Arial']})

then it works. But the same call with Helvetica still defaults to that
Bitstream/default font of matplotlib. any idea why this might be? could
matplotlib be confusing 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 matplotlib
 matplotlib.use('PDF')
 from matplotlib import rc
 import matplotlib.pyplot as plt
 rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
 plt.hist(rand(100))
 xlabel(rMy x axis $\alpha$)
 ylabel(rMy y axis $\beta$)

 i verified that plt.rcParams gets modified to use 'Helvetica' as the value
 for font.family, etc. but i still get the default font used in all of these
 figures. i tried using the PS backend using matplotlib.use('PS') but the
 problem persists. i am interested in getting out PDFs that use helvetica
 everywhere.

 does anyone know how to fix this? thank you.

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] savefig as pdf not generating vector graphics?

2009-06-27 Thread per freem
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.hist(rand(100), 10)
plt.xlabel(r\alpha)
plt.ylabel(r\beta\kappa)
plt.savefig('myfig.pdf')

The problem is that myfig.pdf for some reason renders the figure's x and y
labels as *images* rather than vector graphics. Strangely, the labels of the
units on the x and y axes are rendered as vector fonts correctly as they
should -- it is only the x and y labels that somehow are wrongly generated
as images.

how can i make it so everything is generated as a vector graphic in this
pdf?

thanks very much.

i am attaching my rcParams settings below in case it helps:

{'agg.path.chunksize': 0,
 'axes.axisbelow': False,
 'axes.edgecolor': 'k',
 'axes.facecolor': 'w',
 'axes.formatter.limits': [-7, 7],
 'axes.grid': False,
 'axes.hold': True,
 'axes.labelcolor': 'k',
 'axes.labelsize': 'medium',
 'axes.linewidth': 1.0,
 'axes.titlesize': 'large',
 'axes.unicode_minus': True,
 'backend': 'MacOSX',
 'backend_fallback': True,
 'cairo.format': 'png',
 'contour.negative_linestyle': 'dashed',
 'datapath': '/Library/Python/2.5/site-packages/matplotlib/mpl-data',
 'docstring.hardcopy': False,
 'figure.autolayout': False,
 'figure.dpi': 80,
 'figure.edgecolor': 'w',
 'figure.facecolor': '0.75',
 'figure.figsize': [8.0, 6.0],
 'figure.subplot.bottom': 0.10001,
 'figure.subplot.hspace': 0.20001,
 'figure.subplot.left': 0.125,
 'figure.subplot.right': 0.90002,
 'figure.subplot.top': 0.90002,
 'figure.subplot.wspace': 0.20001,
 'font.cursive': ['Apple Chancery',
  'Textile',
  'Zapf Chancery',
  'Sand',
  'cursive'],
 'font.family': 'sans-serif',
 'font.fantasy': ['Comic Sans MS',
  'Chicago',
  'Charcoal',
  'ImpactWestern',
  'fantasy'],
 'font.monospace': ['Bitstream Vera Sans Mono',
'DejaVu Sans Mono',
'Andale Mono',
'Nimbus Mono L',
'Courier New',
'Courier',
'Fixed',
'Terminal',
'monospace'],
 'font.sans-serif': ['Helvetica'],
 'font.serif': ['Bitstream Vera Serif',
'DejaVu Serif',
'New Century Schoolbook',
'Century Schoolbook L',
'Utopia',
'ITC Bookman',
'Bookman',
'Nimbus Roman No9 L',
'Times New Roman',
'Times',
'Palatino',
'Charter',
'serif'],
 'font.size': 12.0,
 'font.stretch': 'normal',
 'font.style': 'normal',
 'font.variant': 'normal',
 'font.weight': 'normal',
 'grid.color': 'k',
 'grid.linestyle': ':',
 'grid.linewidth': 0.5,
 'image.aspect': 'equal',
 'image.cmap': 'jet',
 'image.interpolation': 'bilinear',
 'image.lut': 256,
 'image.origin': 'upper',
 'image.resample': False,
 'interactive': False,
 'legend.axespad': 0.5,
 'legend.borderaxespad': 0.5,
 'legend.borderpad': 0.40002,
 'legend.columnspacing': 2.0,
 'legend.fancybox': False,
 'legend.fontsize': 'large',
 'legend.handlelen': 0.050003,
 'legend.handlelength': 2.0,
 'legend.handletextpad': 0.80004,
 'legend.handletextsep': 0.02,
 'legend.isaxes': True,
 'legend.labelsep': 0.01,
 'legend.labelspacing': 0.5,
 'legend.loc': 'upper right',
 'legend.markerscale': 1.0,
 'legend.numpoints': 2,
 'legend.pad': 0,
 'legend.shadow': False,
 'lines.antialiased': True,
 'lines.color': 'b',
 'lines.dash_capstyle': 'butt',
 'lines.dash_joinstyle': 'miter',
 'lines.linestyle': '-',
 'lines.linewidth': 1.0,
 'lines.marker': 'None',
 'lines.markeredgewidth': 0.5,
 'lines.markersize': 6,
 'lines.solid_capstyle': 'projecting',
 'lines.solid_joinstyle': 'miter',
 'maskedarray': False,
 'mathtext.bf': 'serif:bold',
 'mathtext.cal': 'cursive',
 'mathtext.fallback_to_cm': True,
 'mathtext.fontset': 'cm',
 'mathtext.it': 'serif:italic',
 'mathtext.rm': 'serif',
 'mathtext.sf': 'sans\\-serif',
 'mathtext.tt': 'monospace',
 'numerix': 'numpy',
 'patch.antialiased': True,
 'patch.edgecolor': 'k',
 'patch.facecolor': 'b',
 'patch.linewidth': 1.0,
 'path.simplify': False,
 'pdf.compression': 6,
 'pdf.fonttype': 3,
 'pdf.inheritcolor': False,
 'pdf.use14corefonts': False,
 'plugins.directory': '.matplotlib_plugins',
 'polaraxes.grid': True,
 'ps.distiller.res': 6000,
 'ps.fonttype': 3,
 'ps.papersize': 'letter',
 'ps.useafm': False,
 'ps.usedistiller': False,
 'savefig.dpi': 100,
 'savefig.edgecolor': 'w',
 'savefig.facecolor': 'w',
 'savefig.orientation': 'portrait',
 'svg.embed_char_paths': True,
 'svg.image_inline': True,
 

[Matplotlib-users] changing matplotlib fonts in illustrator

2009-06-14 Thread per freem
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 font it does not work. apparently the
font information has been lost.

is there a way to make the .pdf file contain the font? or is the solution to
export it as a different file format (if so which)?

p.s. i do not have helvetica on the system that generates the plots so i
cannot set it programmatically... this is why i export it using the default
matplotlib font and then try to edit it in illustrator.

thanks.
--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] making subplots more square

2009-05-24 Thread per freem
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()
# make axes square
p1.set_aspect('equal')

p2 = subplot(3,1,2)
plot()
p2.set_aspect('equal')

# etc for third subplot...

then the subplots i get are square, but very small and squished compared to
the space they have in the figure (ie what i set in figsize.) how can i fix
this? i just want to have square axes, but have each subplot take up as much
space as it would if i didnt set square axes... it works fine for the
rectangular axes case.
--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA,  Big Spaceship. http://www.creativitycat.com ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] making subplots more square

2009-05-24 Thread per freem
hi eric,

i tried your suggestion but it still did not work.  here's a code snippet
that demonstrates what i am trying to do:

import matplotlib.pyplot as
plt
from scipy import
*


my_fig = plt.figure(figsize=(7,6),
dpi=100)
plot_ax1 =
plt.subplot(3,1,1)
a =
rand(100)

b = rand(100) +
rand()
plt.scatter(a,
b)
plot_ax1.set(xticklabels=[])

plot_ax1.set_aspect('equal',
adjustable='box')
plt.savefig('myplot.pdf')



when i run this, i get a small square scatter plot in the middle of the
page. i want this plot to be scaled to be bigger.  if i remove the
set_aspect() 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 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 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()
 # make axes square
 p1.set_aspect('equal')

 p2 = subplot(3,1,2)
 plot()
 p2.set_aspect('equal')

 # etc for third subplot...

 then the subplots i get are square, but very small and squished compared
 to the space they have in the figure (ie what i set in figsize.) how can i
 fix this? i just want to have square axes, but have each subplot take up as
 much space as it would if i didnt set square axes... it works fine for the
 rectangular axes case.


 Maybe what you are looking for is
 p1.set_aspect('equal', adjustable='datalim')

 It is not clear from your message, but try the modification above and see
 if it does what you want.

 Eric

--
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers  brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing,  
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA,  Big Spaceship. http://www.creativitycat.com ___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] hierarchical clustering with dendrograms in matplotlib?

2009-05-02 Thread per freem
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 appreciated.
thank you.
--
Register Now  Save for Velocity, the Web Performance  Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance  Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] automatically plotting points in different colors

2009-03-14 Thread per freem
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 looking for is a different color for every point -- it
can even be different shades, as in this example:

http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_collection.html

does anyone know how to create this?

also, more complex, is there a way to do this where every point gets not
only a different color but a different symbol? e.g. '^', 's', 'x', etc. ? i
know there aren't 200 different symbols but it'd be nice if it cycled
through the different symbols as much as possible (e.g. one point might be
blue '^' and another might be red '^') to distinguish the points

thanks.
--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plotting without certain axes in matplotlib

2009-03-13 Thread per freem
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', 'off', 'LineWidth', 1);

so the set(gca, 'Box', 'off'...) command does the job. what's the analogous
matplotlib command? i would like to do this preferably without any external
packages.

I attach the figure so you can see what i mean...

thank you.
attachment: matlab.png--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] parsing tab separated data into arrays

2009-03-13 Thread per freem
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 can do: mydata[:, 0] and
mydata[:, 1] to easily access all the columns.

right now i can iterate through the file, parse it manually using the
split('\t') command and construct a list out of it, then convert it to
arrays. but there must be a better way?

also, my first column is just a name, and so it is variable in length -- is
there still a way to store it as an array so i can access: mydata[:, 0] to
get all the names (as a list)?

thank you.
--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] legend for scatter plots with just a single dot

2009-03-11 Thread per freem
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 label 'a' next to it. how can i
make it so it just displays a single dot instead?

also, is there a way to make the legend display outside the figure?

thanks
--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] legend bug?

2009-03-11 Thread per freem
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 do:

scatter([1],[1],c='r')

then if i do:

legend('my point', numpoints=1)

the legend is still displayed with 3 points... even if i directly set
rcParams['legend.numpoints'] = 1, it still behaves this way. any idea how to
fix this?

thank you
--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] hierarchical clustering with dendrograms in matplotlib?

2009-03-11 Thread per freem
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 appreciated.
thank you.
--
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to make scatter plot and bar graphs in same figure?

2009-03-07 Thread per freem
thank you very much for this (i include your code below).

one question about this: how can i remove the top x-axis and the right yaxis
from each of the marginal histograms? in other words, keep only the left
y-axis and the bottom x-axis of each of the histograms.

thank you.

mport numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter


x = np.random.randn(1000)
y = np.random.randn(1000)

nullfmt   = NullFormatter() # no labels

left, width = 0.1, 0.65
bottom, height = 0.1, 0.65
bottom_h = left_h = left+width+0.02

rect1 = [left, bottom, width, height]
rect2 = [left, bottom_h, width, 0.2]
rect3 = [left_h, bottom, 0.2, height]

# start with a rectangular figure
#fig = plt.Figure( (8,8) )

axScatter = plt.axes(rect1)
axHistx = plt.axes(rect2)#, sharex=axScatter)
axHisty = plt.axes(rect3)#, sharey=axScatter)

axHistx.xaxis.set_major_formatter(nullfmt)
axHisty.yaxis.set_major_formatter(nullfmt)

axScatter.scatter(x,y)

bins = np.linspace(-4,4,21)
axHistx.hist(x, bins=bins)
axHisty.hist(x, bins=bins, orientation='horizontal')

axHistx.set_xlim( axScatter.get_xlim() )
axHisty.set_ylim( axScatter.get_ylim() )

plt.show()


On Mon, Feb 16, 2009 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 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/stats/scatterhist.html
 
  ideally i'd like the histograms outside the scatter plot to also have
 axes
  so that the height of each histogram bar will be interpretable.
  i understand that there's no command for this - but how can i construct
 it?
   i would not mind writing code to do this... if it's possible.  right now
  this is the only thing keeping me from switching from matlab to
 matplotlib
  exclusively since i use these graphs a lot
 
  thank you
 
 
 
  
 
 
 --
  Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
 CA
  -OSBC tackles the biggest issue in open source: Open Sourcing the
 Enterprise
  -Strategies to boost innovation and cut costs with open source
 participation
  -Receive a $600 discount off the registration fee with the source code:
 SFAD
  http://p.sf.net/sfu/XcvMzF8H
 
 
  
 
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users




 --
 Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
 CA
 -OSBC tackles the biggest issue in open source: Open Sourcing the
 Enterprise
 -Strategies to boost innovation and cut costs with open source
 participation
 -Receive a $600 discount off the registration fee with the source code:
 SFAD
 http://p.sf.net/sfu/XcvMzF8H
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] making scatter plots with histograms with equal axes (scatter_hist.py)

2009-03-07 Thread per freem
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 code below
makes the main scatter plot look as it should but is out of sync with the
scales of the histograms:

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter
from numpy.random import normal
from frame import FrameAxes
from numpy import *
def scatter_hist(x, y, num_bins=20):
nullfmt = NullFormatter() # no labels

left, width = 0.1, 0.65
bottom, height = 0.1, 0.65
bottom_h = left_h = left+width+0.02

rect1 = [left, bottom, width, height]
rect2 = [left, bottom_h, width, 0.2]
rect3 = [left_h, bottom, 0.2, height]
axScatter = plt.axes(rect1)
axHistx = plt.axes(rect2)#, sharex=axScatter)
axHisty = plt.axes(rect3)#, sharey=axScatter)
axHistx.xaxis.set_major_formatter(nullfmt)
axHisty.yaxis.set_major_formatter(nullfmt)
axScatter.set_aspect('equal')
axScatter.scatter(x, y)
c = .05
bins = np.linspace(min(x)-c,max(x)+c,num_bins)
axHistx.hist(x, bins=bins)
axHisty.hist(y, bins=bins, orientation='horizontal')

axHistx.set_xlim(axScatter.get_xlim())
axHisty.set_ylim(axScatter.get_ylim())

x = np.random.randn(1000)
y = np.random.randn(1000)
scatter_hist(x,y)
plt.show()

if i pass the 'sharex' and 'sharey' arguments to 'axes' (see commented lines
in code above), then the dimensions are in sync, but the NullFormatter from
these lines:

axHistx.xaxis.set_major_formatter(nullfmt)
axHisty.yaxis.set_major_formatter(nullfmt)

removes the axes from the main scatter plot. i simply want the scatter plot
to have both x and y axes, and the marginal histograms to only have the
yaxis, but have their dimensions be in sync with the square scatter plot.
how can i do this?

thanks very much.
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] computing r-squared?

2009-03-04 Thread per freem
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.
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] removing upper and right ticks

2009-03-03 Thread per freem
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 parallel to the x-axis) and in the right most axis (the
one parallel to the y-axis)?

thanks.
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] dynamically creating then plotting arrays

2009-03-01 Thread per freem
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:
  field1, field2, field3 = line.strip().split('\t')
  data.append([int(field1), int(field2), int(field3)])

i then convert it into an array as follows:

data = array(data)

i am able to reference the first column as follows:

data[:,0]

but if i try to plot the first column against the second as follows:

bar(data[:,0],data[:,1])

then i get the error:

/usr/lib64/python2.5/site-packages/matplotlib/units.pyc in
get_converter(self, x)
128 converter = self.get(classx)
129
-- 130 if converter is None and iterable(x):
131 # if this is anything but an object array, we'll assume
132 # there are no custom units

[repeated many times]

RuntimeError: maximum recursion depth exceeded
WARNING: Failure executing file: myfile.py

how can i fix this? i'd like an n-by-m representation of my data as an array
which i can reference like a matrix in matlab. some of the columns are
floats, other are ints, and others are strings, so i prefer to load the data
into an array as a loop where i can cast the strings appropriately, rather
than use some built in io function for reading tab-separated data.

thank you very much.
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] dynamically creating then plotting arrays

2009-03-01 Thread per freem
hi all,

please disregard the previous email - i had a mistake in my file that did
not do the casting properly when loading the data.

i managed to plot my data, but this time i am having a problem with the
'bar' function.

when i plot using:

x = data[:, 0]
y = data[:, 1]
bar(x,y)

i get the attached figure. the bar graphs are way too thin and don't look
like bar graphs at all. i see in the gallery many examples of bars with
greater width, e.g.
http://matplotlib.sourceforge.net/examples/api/histogram_demo.html

but all of these seem to be made using the 'hist' function. i just want the
bar width to be greater. my setting of the width= does not make a
difference, it treats:

bar(x,y,width=1.5)
bar(x,y,width=10)
etc.

as the same, yielding this line plot. if i remove some data points (and plot
x and y's that are only, say, 3 in length) then the bars look normal.

how can i make the bar 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 of rows. i load the array from the
 file as follows, which seems to work:

 data = []
 for line in myfile:
   field1, field2, field3 = line.strip().split('\t')
   data.append([int(field1), int(field2), int(field3)])

 i then convert it into an array as follows:

 data = array(data)

 i am able to reference the first column as follows:

 data[:,0]

 but if i try to plot the first column against the second as follows:

 bar(data[:,0],data[:,1])

 then i get the error:

 /usr/lib64/python2.5/site-packages/matplotlib/units.pyc in
 get_converter(self, x)
 128 converter = self.get(classx)
 129
 -- 130 if converter is None and iterable(x):
 131 # if this is anything but an object array, we'll assume
 132 # there are no custom units

 [repeated many times]

 RuntimeError: maximum recursion depth exceeded
 WARNING: Failure executing file: myfile.py

 how can i fix this? i'd like an n-by-m representation of my data as an
 array which i can reference like a matrix in matlab. some of the columns are
 floats, other are ints, and others are strings, so i prefer to load the data
 into an array as a loop where i can cast the strings appropriately, rather
 than use some built in io function for reading tab-separated data.

 thank you very much.

attachment: image.png--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] making (very simple) Venn diagrams?

2009-03-01 Thread per freem
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 number of elements they are supposed to represent.  i know some
people use Sage for this but i prefer to use matplotlib directly.

any help / info on how to get started on this or some example code would be
greatly appreciated.

thank you.
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] setting font of axes ticklabels and making labels not overlap

2009-02-28 Thread per freem
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())

rcParams['font.family'] = 'Helvetica'
p = matplotlib.font_manager.FontProperties()
p.set_family('Helvetica')
x = rand(20)
ax = plot(x, x, 'bo', markeredgecolor='blue', mfc='none')
axes_square(p)

but it does not work. i tried similarly setting the font size (with
set_size() or through rcParams) but it did not work either. how can i do
this? i'd like to do this either on per axes basis, or for the entire
figure.

second, how can i make it so axes labels do not overlap? in many plots,
including ones in the gallery, you see the labels at the origin of plots get
too close to each other. (i.e. the 0.0 of x-axis and 0.0 of y-axis) - how
can you prevent this from happening?

thank you!
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] removing leading zeros in ticklabels

2009-02-28 Thread per freem
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)
majorFormatter = FormatStrFormatter('%0.1f')
s.xaxis.set_major_formatter(majorFormatter)
scatter(x,x)

but it does not work. i also tried %.f but it does not work either. the
matlab default is to plot without the leading zero and i am trying to
recreate this.

thank you.
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] setting font of axes ticklabels and making labels not overlap

2009-02-28 Thread per freem
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 a way to do this -- could you please explain how this can be
done?

thanks again.


On Sat, Feb 28, 2009 at 5:19 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote:

  but it does not work. i tried similarly setting the font size (with
  set_size() or through rcParams) but it did not work either. how can i do
  this? i'd like to do this either on per axes basis, or for the entire
  figure.

 It seems that changing rcParams is not effective because of the way
 how the font caching is done. Here is a little monkey patching to
 change this behavior.

 from matplotlib.font_manager import FontProperties

 def my_hash(self):
l = dict([(k, getattr(self, get + k)()) for k in self.__dict__])
return hash(repr(l))

 FontProperties.__hash__ = my_hash


 With this code, changing rcParams will affect (most of) the text in the
 figure.

 As far as I know, you cannot have a default font properties on per
 axes basis. You need to manually change the font properties of Text
 artists in your interests.

 For example, to change the font properties of the xtick labels,

 fp = FontProperties(family=Lucida Sans Typewriter)
 ax = gca()
 for t in ax.get_xticklabels():
t.set_fontproperties(fp)


 
  second, how can i make it so axes labels do not overlap? in many plots,
  including ones in the gallery, you see the labels at the origin of plots
 get
  too close to each other. (i.e. the 0.0 of x-axis and 0.0 of y-axis) - how
  can you prevent this from happening?
 

 I don't think there is a smart way to prevent it other than manually
 changing the tick positions. Other may have better ideas.

 -JJ

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] errors when plotting random vectors

2009-02-19 Thread per freem
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 somehow weird? do they not behave like
lists? any info on this will be greatly appreciated.

thank you.
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] making points cross in simple plots

2009-02-19 Thread per freem
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 matplotlib, this is not the case, and points that overlap are placed on
top of each other. for example if i use:
x = randn(1,1000)
plot(x, x, 'bo')

how can i fix it so that it looks like matlab and points cross?

more importantly, the above command in matplotlib generates many many line
objects and takes forever to render. if i don't specify 'bo' and simply call
plot(x, x, 'o') it makes every point in a *different color*. why is that?
how can i change that? i feel like i must be doing something wrong here.

 thanks.
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] how to make scatter plot and bar graphs in same figure?

2009-02-14 Thread per freem
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/stats/scatterhist.html

ideally i'd like the histograms outside the scatter plot to also have axes
so that the height of each histogram bar will be interpretable.
i understand that there's no command for this - but how can i construct it?
 i would not mind writing code to do this... if it's possible.  right now
this is the only thing keeping me from switching from matlab to matplotlib
exclusively since i use these graphs a lot

thank you
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] scatterhist matlab equivalent

2009-02-02 Thread per freem
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/stats/scatterhist.html

ideally i'd like the histograms outside the scatter plot to also have axes
so that the height of each histogram bar will be interpretable.

thank you
--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users