Re: [Matplotlib-users] dpi

2012-10-12 Thread Nikolaus Rath
Jae-Joon Lee writes: > On Fri, Oct 12, 2012 at 3:39 AM, Nikolaus Rath > wrote: >> matplotlib actually rescales the raw imshow data when saving to a vector >> format? Why is that? I think it should embed the bitmap with full >> resolution in the vector file and rely on th

Re: [Matplotlib-users] dpi

2012-10-11 Thread Nikolaus Rath
Damon McDougall writes: > On Thu, Oct 11, 2012 at 4:00 PM, Nikolaus Rath > 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 `dpi=` all the time for vector formats. Purely bec

[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] Corrupted percent signs in labels

2012-10-10 Thread Nikolaus Rath
Michael Droettboom 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, and upgrading fixed the problem. Than

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

2012-10-10 Thread Nikolaus Rath
Benjamin Root 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.__ver

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

2012-10-09 Thread Nikolaus Rath
Damon McDougall writes: > On Tue, Oct 9, 2012 at 10:56 PM, Damon McDougall > wrote: >> On Tue, Oct 9, 2012 at 10:32 PM, Nikolaus Rath >> wrote: >>> Hello, >>> >>> For some reason, my matplotlib isn't able to print percent signs ('%&#x

[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 [%]') plt.sa

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

2012-08-05 Thread Nikolaus Rath
Benjamin Root 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 >>

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

[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

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

2010-11-04 Thread Nikolaus Rath
"Stan West" 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.savefi

Re: [Matplotlib-users] Shadowed Text?

2010-11-02 Thread Nikolaus Rath
e > > Or, you may consider to use the path_effect (available w/ v1.0). > > http://matplotlib.sourceforge.net/examples/pylab_examples/patheffect_demo.html > > Regards, > > -JJ > > > On Wed, Nov 3, 2010 at 10:44 AM, Nikolaus Rath wrote: >> Hello,

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

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

Re: [Matplotlib-users] Trouble with contour plot

2010-10-29 Thread Nikolaus Rath
Eric Firing 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 be a check. > > For sensible output, it i

Re: [Matplotlib-users] Trouble with contour plot

2010-10-29 Thread Nikolaus Rath
Benjamin Root 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 method >> itself does not even b

Re: [Matplotlib-users] Trouble with contour plot

2010-10-29 Thread Nikolaus Rath
Benjamin Root writes: > On Thu, Oct 28, 2010 at 3:31 PM, Nikolaus Rath > wrote: > >> Hello, >> >> I'm having a weird problem with a contour plot. Consider the following >> plots: >> >> import cPickle as pickle >> import matplotlib.p

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

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

[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), v

[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? Thank

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

2010-07-30 Thread Nikolaus Rath
Ryan May writes: > On Jul 30, 2010, at 14:34, Nikolaus Rath > 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)**2 + Ys

[Matplotlib-users] Same X and Y scale

2010-07-30 Thread Nikolaus Rath
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)**2 + Ys**2) - 0.10 fig = plt.figure() ax = fig.add_subplot(111) ax.contour(X, Y, Z) fig.show() This works, but gives the y axis a different scale than the x axis

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

2010-07-29 Thread Nikolaus Rath
Jeff Whitaker 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 rando

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

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

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

2010-04-26 Thread Nikolaus Rath
aled values. >> >> Thanks, >> -Niko >> >> >> I did not try vmin and vmax, because >> On 04/26/2010 02:31 PM, Jae-Joon Lee wrote: >>> Did you try to change vmin, vmax? >>> >>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matp

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

2010-04-26 Thread Nikolaus Rath
yplot_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 wrote: >> The problem with imshow is, that it rescales the

[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 = om

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

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

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 wrote: >> Hello, >> >> I'm trying to plot something from 0 to 2pi: >> >>fig = plt.figure() >>ax = fig.add_subplot(111) >>ax.set_title('Radia

[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]) ax.set_xticklabels([

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