[Matplotlib-users] How to show interactive plot window from program

2010-04-20 Thread Nikolaus Rath
Hello, When I'm calling the pyplot.plot function from ipython, I get a nice dialog in which I can zoom, pan save. How can I achieve the same thing from a non-interactive program? I tried fig = plt.figure() ax = fig.add_subplot(111) ax.contourf(stuff) fig.show() but this

[Matplotlib-users] ticks at 0 and 2pi

2010-04-20 Thread Nikolaus Rath
Hello, I'm trying to plot something from 0 to 2pi: fig = plt.figure() ax = fig.add_subplot(111) ax.set_title('Radial Magnetic Field') ax.set_ylabel(r'Poloidal Angle $\theta$') ax.set_xlabel(r'Toroidal Angle $\phi$') ax.set_xticks([0, 2 * math.pi])

Re: [Matplotlib-users] ticks at 0 and 2pi

2010-04-20 Thread Nikolaus Rath
On 04/20/2010 10:29 AM, Ryan May wrote: On Tue, Apr 20, 2010 at 8:58 AM, Nikolaus Rath nikol...@rath.org wrote: Hello, I'm trying to plot something from 0 to 2pi: fig = plt.figure() ax = fig.add_subplot(111) ax.set_title('Radial Magnetic Field') ax.set_ylabel(r'Poloidal Angle

[Matplotlib-users] How to make colormaps

2010-04-20 Thread Nikolaus Rath
Hello, Maybe my googling skills are deficient, but I wasn't able to find any information on how to define my own colormap. Can someone give me a pointer, or a basic example how to create a simple map that e.g. maps -1 to Red, 0 to White, and 1 to Blue? Thanks, -Nikolaus -- »Time flies

Re: [Matplotlib-users] How to make colormaps

2010-04-20 Thread Nikolaus Rath
On 04/20/2010 01:06 PM, Ryan May wrote: On Tue, Apr 20, 2010 at 11:40 AM, Jim Vickroy jim.vick...@noaa.gov wrote: Nikolaus Rath wrote: Hello, Maybe my googling skills are deficient, but I wasn't able to find any information on how to define my own colormap. Can someone give me a pointer

[Matplotlib-users] Plotting 2d fourier amplitudes

2010-04-26 Thread Nikolaus Rath
Hello, I have 2d array with fourier amplitudes that I would like to plot. I found two options: contourf and imshow. This is my code: omega = np.fft.rfftn(b_field, axes=(1, 0)) omega = np.abs(np.fft.fftshift(omega, axes=(1,))) fig = plt.figure() ax = fig.add_subplot(111) M =

Re: [Matplotlib-users] Plotting 2d fourier amplitudes

2010-04-26 Thread Nikolaus Rath
#matplotlib.pyplot.imshow If this is not what you want, please describe more explicitly why the colorbar is wrong. Regards, -JJ On Mon, Apr 26, 2010 at 11:37 AM, Nikolaus Rath nikol...@rath.org wrote: The problem with imshow is, that it rescales the data so the colorbar does not show the correct

Re: [Matplotlib-users] Plotting 2d fourier amplitudes

2010-04-26 Thread Nikolaus Rath
://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.imshow If this is not what you want, please describe more explicitly why the colorbar is wrong. Regards, -JJ On Mon, Apr 26, 2010 at 11:37 AM, Nikolaus Rath nikol...@rath.org wrote: The problem with imshow is, that it rescales the data so

[Matplotlib-users] Plotting irregular 2d data

2010-06-08 Thread Nikolaus Rath
Hi, I have a 1d array Z that unfortunately contains information about a two dimensional surface. The mapping is nontrivial (i.e. Z is not just a sequence of column or row information that I could reshape) but homogenous (i.e. there is a rectangular grid and Z contains data for each vertex). The x

[Matplotlib-users] Contour plots with same color mapping

2010-07-26 Thread Nikolaus Rath
Hello, I would like to draw a couple of contour plots. The plots are on separate figures, but they should all have exactly the same color mapping (i.e, the same Z value should correspond to the same color in all plots). What's the best way to achieve this? From the documentation I gather that I

[Matplotlib-users] Contour plot of non-uniformly sampled data

2010-07-28 Thread Nikolaus Rath
Hello, What is the best way to generate a contour plot from a set of non-uniformly sampled data (i.e., the datapoints do not lie on the points of a rectangular grid but are randomly distributed)? Thanks, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP

Re: [Matplotlib-users] Contour plot of non-uniformly sampled data

2010-07-29 Thread Nikolaus Rath
Jeff Whitaker jswhit-97jfqw80gc6171pxa8y...@public.gmane.org writes: On 7/28/10 8:32 PM, Nikolaus Rath wrote: Hello, What is the best way to generate a contour plot from a set of non-uniformly sampled data (i.e., the datapoints do not lie on the points of a rectangular grid but are randomly

Re: [Matplotlib-users] Same X and Y scale

2010-07-30 Thread Nikolaus Rath
Ryan May rmay31-re5jqeeqqe8avxtiumw...@public.gmane.org writes: On Jul 30, 2010, at 14:34, Nikolaus Rath nikolaus-bth8mxji...@public.gmane.org wrote: Hi, Consider this: X = np.linspace(0.70, 1.1, 100) Y = np.linspace(-1.19, 1.19, 70) (Xs, Ys) = np.meshgrid(X, Y) Z = np.sqrt((Xs-0.9

[Matplotlib-users] GridSpec for Figure objects?

2010-10-24 Thread Nikolaus Rath
Hello, I would like to create subplots with different sizes using the object oriented API. However, it seems that the subplot2grid() method exists only in pyplot, but not as a Figure instance method. Am I looking in the wrong place? How do I use subplot2grid with an existing Figure object?

[Matplotlib-users] GridSpec Index Order

2010-10-25 Thread Nikolaus Rath
Hello, I just noticed that in order to get a 3 row by 4 column grid, I have to do import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec def make_ticklabels_invisible(fig): for i, ax in enumerate(fig.axes): ax.text(0.5, 0.5, ax%d % (i+1),

Re: [Matplotlib-users] GridSpec Index Order

2010-10-25 Thread Nikolaus Rath
On 10/25/2010 11:18 AM, Jae-Joon Lee wrote: On Mon, Oct 25, 2010 at 10:45 PM, Nikolaus Rath nikol...@rath.org wrote: So I have to instantiate GridSpec with a (rows, column), but when I index the grid I have to use (column, row). Is there any reason for this counterintuitive behaviour

[Matplotlib-users] Trouble with contour plot

2010-10-28 Thread Nikolaus Rath
Hello, I'm having a weird problem with a contour plot. Consider the following plots: import cPickle as pickle import matplotlib.pyplot as plt (Theta, Phi, Bnormal) = pickle.load(open('trouble.pickle', 'rb')) plt.figure(0) for i in [0, 300]: plt.plot(Theta, Bnormal[:, i], label='Bnormal at

Re: [Matplotlib-users] Trouble with contour plot

2010-10-29 Thread Nikolaus Rath
Benjamin Root ben.root-grryuj3d...@public.gmane.org writes: On Thu, Oct 28, 2010 at 3:31 PM, Nikolaus Rath nikolaus-bth8mxji...@public.gmane.org wrote: Hello, I'm having a weird problem with a contour plot. Consider the following plots: import cPickle as pickle import matplotlib.pyplot

Re: [Matplotlib-users] Trouble with contour plot

2010-10-29 Thread Nikolaus Rath
Benjamin Root ben.root-grryuj3d...@public.gmane.org writes: However, it seems to me that this is quite a serious bug. The contour documentation on http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.contour does not mention this requirement, and obviously the contour

Re: [Matplotlib-users] Trouble with contour plot

2010-10-29 Thread Nikolaus Rath
Eric Firing efiring-msmayosy5ky3upmlikx...@public.gmane.org writes: I don't know if there are any strict requirement on monotonicity for X and Y, or if there are any cases where the plot is still valid even if that property is violated. If it is a requirement, then I agree that there should

[Matplotlib-users] Setting tick labels for matshow

2010-10-30 Thread Nikolaus Rath
Hello, I am trying to set tick labels for a matshow plot. This works just fine if I only work on the X axis: res = np.diag(np.arange(10)) # dummy data modes = [ (x+1, 0) for x in range(5) ] # dummy data fig = plt.figure() ax = fig.add_subplot(111) cs = ax.matshow(res)

[Matplotlib-users] Shadowed Text?

2010-11-02 Thread Nikolaus Rath
Hello, I am placing a text object in a place where the background is sometimes dark and sometimes light, so the text is hard to see. Adding a background to the text object itself looks a bit ugly, so I am wondering if there is a way to add a shadow to the text itself. What's the best way to do

Re: [Matplotlib-users] Setting tick labels for matshow

2010-11-04 Thread Nikolaus Rath
Stan West stan.west-qqjzlxdiqip5oiiguju...@public.gmane.org writes: From: Nikolaus Rath [mailto:nikolaus-bth8mxji...@public.gmane.org] Sent: Tuesday, November 02, 2010 21:38 In [16]: matplotlib.__version__ Out[16]: '1.0.0' I attached the result of fig.savefig(). Let's see if it makes

[Matplotlib-users] How to remove vertical lines when plotting rotating phase

2012-04-04 Thread Nikolaus Rath
Hello, I'm plotting a rotating phase: # ipython --pylab x1 = linspace(0, 2*pi, 30) x = concatenate((x1,x1,x1,x1)) plot(x) The resulting plot has ugly vertical lines whenever x wraps from 2*pi back to zero. Does someone have a nice, general way to get to get rid of such lines? (the actual data

[Matplotlib-users] Using object oriented interface in interactive mode?

2012-08-05 Thread Nikolaus Rath
Hello, The following code shows the plot right away as expected: # python Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) [GCC 4.6.3] on linux2 Type help, copyright, credits or license for more information. import matplotlib matplotlib.__version__ '1.1.1rc2' import matplotlib.pyplot as plt

Re: [Matplotlib-users] Using object oriented interface in interactive mode?

2012-08-05 Thread Nikolaus Rath
Benjamin Root ben.root-grryuj3d...@public.gmane.org writes: On Sunday, August 5, 2012, Nikolaus Rath wrote: Hello, The following code shows the plot right away as expected: # python Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17) [GCC 4.6.3] on linux2 Type help, copyright, credits

[Matplotlib-users] Corrupted percent signs in labels

2012-10-09 Thread Nikolaus Rath
Hello, For some reason, my matplotlib isn't able to print percent signs ('%') properly: [1] inspiron:~/tmp# cat mplbug.py import matplotlib import matplotlib.pyplot as plt import numpy as np print matplotlib.__version__ plt.plot(np.arange(10), np.arange(10)**2) plt.xlabel('Percent [%]')

Re: [Matplotlib-users] Corrupted percent signs in labels

2012-10-09 Thread Nikolaus Rath
Damon McDougall damon.mcdougall-re5jqeeqqe8avxtiumw...@public.gmane.org writes: On Tue, Oct 9, 2012 at 10:56 PM, Damon McDougall damon.mcdougall-re5jqeeqqe8avxtiumw...@public.gmane.org wrote: On Tue, Oct 9, 2012 at 10:32 PM, Nikolaus Rath nikolaus-bth8mxji...@public.gmane.org wrote: Hello

Re: [Matplotlib-users] Corrupted percent signs in labels

2012-10-10 Thread Nikolaus Rath
Benjamin Root ben.root-grryuj3d...@public.gmane.org writes: For some reason, my matplotlib isn't able to print percent signs ('%') properly: [1] inspiron:~/tmp# cat mplbug.py import matplotlib import matplotlib.pyplot as plt import numpy as np print matplotlib.__version__

Re: [Matplotlib-users] Corrupted percent signs in labels

2012-10-10 Thread Nikolaus Rath
Michael Droettboom mdroe-pfb3ainihtehxe+lvdl...@public.gmane.org writes: For some reason, my matplotlib isn't able to print percent signs ('%') properly: It's a known bug, fixed since 1.1.1. https://github.com/matplotlib/matplotlib/issues/1211 Indeed. Luckily 1.2.0~rc2-1 is in experimental,

[Matplotlib-users] dpi

2012-10-11 Thread Nikolaus Rath
Hello, I'm confused by the dpi property of figures that can be set in matplotlibrc or passed to pyplot.figure(). It seems to me that dpi is really a property of the backend, not the figure, and the only place to specify it ought to be when saving into a bitmap file. For example, when showing a

Re: [Matplotlib-users] dpi

2012-10-11 Thread Nikolaus Rath
Damon McDougall damon.mcdougall-re5jqeeqqe8avxtiumw...@public.gmane.org writes: On Thu, Oct 11, 2012 at 4:00 PM, Nikolaus Rath nikolaus-bth8mxji...@public.gmane.org wrote: When saving the figure in some vector graphics format, I don't see what the meaning of the dpi is at all. Sure, I use

Re: [Matplotlib-users] dpi

2012-10-12 Thread Nikolaus Rath
Jae-Joon Lee lee.j.joon-re5jqeeqqe8avxtiumw...@public.gmane.org writes: On Fri, Oct 12, 2012 at 3:39 AM, Nikolaus Rath nikolaus-bth8mxji...@public.gmane.org wrote: matplotlib actually rescales the raw imshow data when saving to a vector format? Why is that? I think it should embed the bitmap