Re: [Matplotlib-users] Problems seeing a png created with matplotlib in firefox

2010-03-02 Thread Renato Alves
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Quoting Alexander Dietz on 03/02/2010 01:27 PM:
> Hi,
> 
> thanks for testing. So it looks like a bug in firefox from 3.5.8 ->
> 3.6, or do you see any strange things happening in the file to create
> this image?

Tested here on firefox 3.6 (Ubuntu) and I cannot reproduce what you
described.

Looking at the files, the only difference is that one png has an alpha
channel while the other one doesn't. The one that caused you problems is
the one that has the alpha channel.

You should probably check external dependencies like libpng (1.2.37-1 here).
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuNGzAACgkQYh11EUYTX9SarQCdHuUkqBzcLJq7A8R37QCrh0p4
Vl8AmQGE/ye1ylMueVUq5pWxEj924udU
=QYcO
-END PGP SIGNATURE-

--
Download IntelĀ® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] How to calculate relative positions between objects

2010-01-31 Thread Renato Alves
Hi everyone

I've been going around matplotlib objects trying to find a way to
pre-calculate positions depending on input.

I'm trying to create a function that draws two barplots facing opposite
directions.

This is what I managed so far:

###

import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import gamma
from mpl_toolkits.axes_grid import make_axes_locatable

fig = plt.figure(1, (10, 10))
ax1 = fig.add_subplot(1, 1, 1)

ax1.set_xlim(1,0)

labels = ('0-9', '10-19', '20-29', '30-39', '40-49',
'50-59', '60-69', '70-79', '80-89', '90-99')

pad = np.max([len(i) for i in labels]) * .15

divider = make_axes_locatable(ax1)
ax2 = divider.new_horizontal(size="100%", pad=pad, sharey=ax1)
fig.add_axes(ax2)

N = 10
ind = np.arange(N)  # the x locations for the groups
width = 0.35   # the width of the bars

x = [gamma.pdf(i, 1, scale=2) for i in range(N)]
y = [gamma.pdf(i, 5, scale=1) for i in range(N)]

ind = np.arange(N)

ax1.barh(ind, x)
ax2.barh(ind, y)

for loc, spine in ax1.spines.iteritems():
if loc in ['left','top']:
spine.set_color('none') # don't draw spine

for loc, spine in ax2.spines.iteritems():
if loc in ['right','top']:
spine.set_color('none') # don't draw spine

ax1.set_title('Men')
ax2.set_title('Women')

ax1.set_ylim(0, N)
ax2.set_ylim(0, N)

# Name bars
ax1.set_yticks(ind + width)
ax1.xaxis.set_ticks_position('bottom')
ax2.xaxis.set_ticks_position('bottom')
ax1.yaxis.set_ticks_position('right')
ax2.yaxis.set_ticks_position('left')

for tl in ax1.get_yticklabels():
tl.set_visible(False)

ax2.set_yticklabels(labels,
   horizontalalignment='center'
   )

for i in ax2.get_yticklabels():
i.set_position((-(pad * .12) , 0))

plt.show()

###

However I would like to generalize this function but he space between
the two plots and the position of the labels is giving me a hard time.

In particular, the lines:

pad = np.max([len(i) for i in labels]) * .15
i.set_position((-(pad * .12) , 0))

include two values (.15 and .12) that are completely arbitrary and
defined by trial and error for current labels.

However with different labels:
labels = ('-9000', '10-19', '20-29', '30-39', '40-49',
'50-59', '60-69', '70-79', '80-89', '9-99000')

the values are no longer valid and the final image is no longer properly
aligned.

I know my current approach is not the proper way but due to the
complexity of matplotlib, my very superficial knowledge about it and the
overwhelming documentation this was the closest I could get.

In the end I would like to contribute the final result as something to
be included in the gallery/examples section of the website as I'm
positive that it will be helpful to others.

Any comment or suggestion is extremely welcome.

Cheers,
Renato

--
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


Re: [Matplotlib-users] bar/hist plots, bottom on top or right axis

2010-01-12 Thread Renato Alves
Quoting Matthias Michler on 01/08/2010 08:00 AM:
> Hi Renato,
> 
> I think you have to flip the x-axis of the left plot by for instance
> ax1 = subplot(121, xlim=(1, 0))
> and I think than hist(data, orientation='horizontal') or manually using 
> barh-plots works fine.
> 
> Kind regards,
> Matthias

Hi Matthias,

Thanks for your tip, this solved the first problem.

But it seems the approach I was trying is not as flexible as I thought
it would be.

Right now I'm trying mpl_toolkits.axes_grid.axes_divider but I still
have a problem on locating the yaxis labels in a centered format.

Anyway this is a bit out of the scope of the initial thread.

Thanks again.

Renato

--
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] bar/hist plots, bottom on top or right axis

2010-01-07 Thread Renato Alves
What I'm trying to accomplish is something like:

http://bm2.genes.nig.ac.jp/RGM2/R_current/library/plotrix/man/images/big_pyramid.plot_001.png

For that I was trying to use subplots where both draw in horizontal
orientation but one will be flipped or mirrored.

I couldn't find any parameter to do so. There is left for horizontal
plots but no right. The same goes for bottom, but no top.

Is there any way to achieve this?

Thanks,
Renato

--
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] Names in boxplot x axis

2009-10-09 Thread Renato Alves
Hi everyone,

I've been using matplotlib for a while but mostly using the pyplot
functions and going as far as changing their initial input parameters.

Now I need to make a boxplot and include names on the X axis as opposed
to the default numbers.

I've searched extensively on the docs and using google but I reached a
dead end. So, could someone point me in the direction of how can I
change the plot to use names instead of numbers on the x axis (vertical
boxplot) or y axis (horizontal boxplot)?

Thanks,
Renato

--
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