[Matplotlib-users] weird behaviour in x axis

2010-09-11 Thread freeeeeekk

Im trying to do a very simple x vs y plot. Where the x values range between
3247 and 3256 and y between 0 and 1. This data is stored in data.dat. I plot
it using the code below, the resulting plot is shown in the first of the two
plots below. Everything goes well except for the x axis, for some reason
tickmarks from 0 up to 9 appear. At the far end of the axis my xmin is
printed: 3.247e3. 
I started looking for the cause and it turns out that as long as my range in
x is lower than 10, this happens. If I change the xlimits to xlim(3246,3256)
I get the plot at the bottom of this page, everything is fine. But if I
change this to for instance xlim(3246.01,3256) or xlim(3245, 3254.99) I get
the same behaviour as in the first graph. 

Does any one have any experience with this/ know the reason for this
happening? Thanks!

from numpy import *
from pylab import *

datafile = mlab.load('./data.dat')
xx=datafile[:,0]
yy=datafile[:,1]

plot(xx,yy,'black')
xlim(3247,3256)
ylim(0,1.2)

show()


http://old.nabble.com/file/p29687404/wrong.png 
http://old.nabble.com/file/p29687404/right.png 
-- 
View this message in context: 
http://old.nabble.com/weird-behaviour-in-x-axis-tp29687404p29687404.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Adjusting Image size

2010-09-11 Thread Alan G Isaac
On 9/10/2010 5:27 AM, Nils Wagner wrote:
> what is needed to save a figure when the size is given in
> pixels, i.e. 1024x772 ?
> The default is 800x600 pixels.

Did you already get an answer?
My understanding is that you set the figure size in *inches*,
and then by setting its ``dpi`` you determine the number of
pixels.  (So "inches" are purely virtual, unless you match
the ppi of your display/printer.)

hth,
Alan Isaac


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colorbar questions ...

2010-09-11 Thread Oz Nahum
Hi Everyone again,

So, with the weekend comes some time to think and I found an answer to
another question of mine.

I know now how to remove xticks in colorbar, and I also know how to
customize the widths of the lines in the color bar.

import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from pylab import *

matplotlib.rcParams['xtick.direction'] = 'out'
matplotlib.rcParams['ytick.direction'] = 'out'

delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-2.0, 2.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)



# Create a simple contour plot with labels using default colors.  The
# inline argument to clabel will control whether the labels are draw
# over the line segments of the contour, removing the lines beneath
# the label
plt.figure()
CS = plt.contour(X, Y, Z)
plt.clabel(CS, inline=1, fontsize=10,inlinespacing=50)
a=plt.colorbar()
ticks = a.ax.get_xticklines()
lines = a.ax.get_ygridlines()
children=a.ax.get_children()

children=a.ax.get_children()

children[4].set_linewidths([12,12,12,12,12,12])

for tick in ticks:
setp(tick, [])


plt.title('Customize colorbar')


I hope someone finds that useful. And someone is still following my
monologue, my question, how to remove the axes around the colorbar, or at
least changed the to be non-visible, still stands...

Thanks,

Oz


-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen

---

Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] MacOS X install and ppc flag

2010-09-11 Thread Friedrich Romstedt
2010/9/4 Thomas Robitaille :
> export MACOSX_DEPLOYMENT_TARGET=10.6
> export CFLAGS="-arch i386 -arch x86_64"
> export CPPFLAGS="-arch i386 -arch x86_64"
> export FFLAGS="-arch i386 -arch x86_64"
> export LDFLAGS="-Wall -undefined dynamic_lookup -bundle -arch i386 -arch 
> x86_64"

So you're on 10.6?  (Because of the DEPLOYMENT_TARGET.)

In general, distutils chooses the flags and tweaks them to match the
options used when compiling Python.  Did you install Python from
source, and if yes, maybe with ppc?

> ARCH_FLAGS="-arch i386-arch x86_64"

I don't know how the ARCH_FLAGS are interpreted.

> gcc-4.0 -DNDEBUG -g -O3 -arch i386 -arch x86_64 [...] -isysroot 
> /Developer/SDKs/MacOSX10.6.sdk [...]

gcc-4.0?  Thought you are on 10.6, there gcc-4.2 is the default.
Further, this looks to me like you're using python.org Python, which
is indeed gcc-4.0 compiled afaik.  Maybe you're even using Apple
Python??  (Don't know which compiler this is using.)

So far, it's a bit incomplete, and sorry for the huge delay,
Friedrich

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Installing matplotlib on MacOS X 10.6.4

2010-09-11 Thread Friedrich Romstedt
2010/9/10 Yannis Haralambous :
> when I launch the DMG installer 
> matplotlib-1.0.0-python.org-py2.6-macosx10.4.mpkg
> I get an error message, that my volume does not contain "System Python 2.6".
> I'm running a standard MacOS X 10.6.4 with python 2.6.1 running from /usr/bin
> And I do have Python 2.6 installed in
> /System/Library/Frameworks/Python.framework/Versions/2.6
> Why does the installer doesn't sees it?

Several possible reasons:
1) You installed Python from source.  In this case, since the mpl
installer checks using the Apple package system (yes, there is
actually a package system on Mac!), and installing from source of
course does not register with this, the installer wouldn't be able to
find the "Python" package.
2) There is a mistake in the matplotlib installer.  This happened
before already.
3) You're not running Python from the python.org installer, but rather
Python from Apple.
4) I noticed that you're using the macosx10.4 installer, but you said
you're on 10.6?  Libraries on 10.6 are built with gcc-4.2, and the
libs from the 10.4 bundle are built certainly with gcc-4.0.  In this
case it cannot load the gcc-4.2 built libraries.

You can try to search the /matplotlib/ threads for this, we had
several threads on this before.  I remember no issue atm on this list
about this not solved.  But I may overestimate.  You can also keep
asking.

Btw, where does your freetype2 come from?  How did your build find it
(i.e., do you have pkg-config or not)?

Friedrich

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Line plot orientation

2010-09-11 Thread Tony S Yu

On Sep 11, 2010, at 12:00 PM, Radek Machulka wrote:

> Hi Folks,
> 
> I am trying to do something similar to
> http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_hist.html,
> but with a line plots instead of histograms.
> My problem is how to set orientation of line plot if there is no
> 'orientation' argument (line axHisty.hist(y, bins=bins,
> orientation='horizontal') in the example).
> 
> Thanks a lot
> Radek

Since a line plot doesn't really have an orientation, this might be a lot 
simpler than you think. If I understand your question, you can just switch your 
x and y data to get the desired behavior.

Continuing the example you link to, just remove the lines that create the 
histogram (last 4 lines before plt.show) and replace with normal plot commands; 
for example:

bins = np.arange(-lim, lim + binwidth, binwidth)
x_hist, _ = np.histogram(x, bins=bins)
y_hist, _ = np.histogram(y, bins=bins)
x_bin_centers = y_bin_centers = (bins[:-1] + bins[1:])/2.
axHistx.plot(x_bin_centers, x_hist)
axHisty.plot(y_hist, y_bin_centers)
plt.show()

The first line above marks the last line in the example script that you should 
keep. Note that you don't have to use histogram data (x_hist, y_hist); I only 
do so to simplify the example. Also, x_bin_centers and y_bin_centers are only 
equal because the scatter data is square.

Is this what you were going for?

-Tony


--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Line plot orientation

2010-09-11 Thread Radek Machulka
Hi Folks,

I am trying to do something similar to
http://matplotlib.sourceforge.net/examples/pylab_examples/scatter_hist.html,
but with a line plots instead of histograms.
My problem is how to set orientation of line plot if there is no
'orientation' argument (line axHisty.hist(y, bins=bins,
orientation='horizontal') in the example).

Thanks a lot
Radek

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users