Re: [Matplotlib-users] weird matplotlib imread question for png

2015-04-16 Thread Ryan Nelson
Oops. I meant bits not bytes in my earlier statements. Sorry. On Thu, Apr 16, 2015 at 11:24 AM, Ryan Nelson wrote: > xnview says it is 128*128*8, but "print >> imread('python-gray.png').shape" says (128, 128, 3), however I suppose >> it should be (128, 128)!

Re: [Matplotlib-users] Some questions regarding pcolor(mesh)/nbagg/FuncAnimate

2015-04-16 Thread Ryan Nelson
ent. > > On Thu, Apr 16, 2015 at 8:18 AM, Ryan Nelson > wrote: > >> Tom, >> >> Thanks for the code. As it was given, I had to change `blit=True` in the >> `FuncAnimation` call in order to get this to work in a regular Qt backend. >> It did not

Re: [Matplotlib-users] weird matplotlib imread question for png

2015-04-16 Thread Ryan Nelson
> > xnview says it is 128*128*8, but "print > imread('python-gray.png').shape" says (128, 128, 3), however I suppose > it should be (128, 128)! Not sure that this is true, but I guess that xnview is using the third dimension here to refer to a number of bytes. In this case, it is two bytes, one f

Re: [Matplotlib-users] Some questions regarding pcolor(mesh)/nbagg/FuncAnimate

2015-04-16 Thread Ryan Nelson
i = animate.FuncAnimation(test.fig, test.update, interval=10, > blit=False, frames=50) > > plt.show() > > ``` > > note the addition of the `set_clim` line in the `__init__` method. > > > You can also update the scatter artist in-place. The other changes will > make

Re: [Matplotlib-users] Some questions regarding pcolor(mesh)/nbagg/FuncAnimate

2015-04-12 Thread Ryan Nelson
//github.com/matplotlib/matplotlib/issues/4288 > > Running until a given condition is an interesting idea, but I think that > means the animation objects needs to have a public 'stop' method first! > > Tom > > On Fri, Apr 10, 2015 at 3:00 PM Ryan Nelson wrote: &g

Re: [Matplotlib-users] Set a 3-D point?

2015-03-29 Thread Ryan Nelson
Prahas, You're example is a little strange because when I set `x0 = (-1,0,0.5)`, your function works fine on Python 2. Are you trying to set t0? Note, your function does not compile on Python 3. You should try to be more explicit with that first argument in that function. For example, does the fo

Re: [Matplotlib-users] Best way to display image from URL in Python3

2015-03-20 Thread Ryan Nelson
Thomas, sorry I missed your email. I'll see if I can get a PR pulled together soon-ish. Ryan On Fri, Mar 20, 2015 at 4:32 PM, Ryan Nelson wrote: > A little update. It seems that this seems to be specific to Linux in some > way. I tried the original script from the PR under

Re: [Matplotlib-users] Best way to display image from URL in Python3

2015-03-20 Thread Ryan Nelson
works * on Gentoo Linux Python 2.7 and 3.4, MPL 1.4.3 -- only the 2.7 version works Hope that helps. Ryan On Fri, Mar 20, 2015 at 3:41 PM, Jerzy Karczmarczuk < jerzy.karczmarc...@unicaen.fr> wrote: > > Le 20/03/2015 16:57, Ryan Nelson a écrit : > > For me, if I change the scr

Re: [Matplotlib-users] Best way to display image from URL in Python3

2015-03-20 Thread Ryan Nelson
all of this business internally. Thanks Ryan On Fri, Mar 20, 2015 at 12:24 PM, Thomas Caswell wrote: > I think `six` (which we use to smooth over the 2/3 changes) has a way of > dealing with atleast the urllib renaming . > > On Fri, Mar 20, 2015 at 11:58 AM Ryan Nelson > wrote:

Re: [Matplotlib-users] Best way to display image from URL in Python3

2015-03-20 Thread Ryan Nelson
3 version requires the addition of BytesIO and read(). I take it that this is not supposed to be the case. Ryan On Fri, Mar 20, 2015 at 11:48 AM, Ryan Nelson wrote: > Thanks, Ben. I should have made that more clear. If I run the code from > the PR, I get the following error: > > Traceback

Re: [Matplotlib-users] Best way to display image from URL in Python3

2015-03-20 Thread Ryan Nelson
t this fix is in version 1.2.x and up. Are you > saying that you still can't do imread(urllib.request.urlopen(url))? > > On Thu, Mar 19, 2015 at 8:54 PM, Ryan Nelson > wrote: > >> Hello all, >> >> I'm porting over some code that used Py2.7 urllib2.urlopen(

[Matplotlib-users] Best way to display image from URL in Python3

2015-03-19 Thread Ryan Nelson
Hello all, I'm porting over some code that used Py2.7 urllib2.urlopen(url) to grab some image data from the net and load with pyplot.imread. It doesn't work quite right in Py3.4. I found a couple of refs: https://github.com/matplotlib/matplotlib/pull/1650 http://stackoverflow.com/questions/151831

Re: [Matplotlib-users] Python shell despite no IPython problems

2015-03-14 Thread Ryan Nelson
an On Sat, Mar 14, 2015 at 8:54 AM, Brenton Horne wrote: > On 14/03/2015 10:31 PM, Ryan Nelson wrote: > > >>> import matplotlib > >>> matplotlib.use('TkAgg') > >>> import matplotlib.pyplot as plt > >>> plt.plot([1,2,3]) > >

Re: [Matplotlib-users] Python shell despite no IPython problems

2015-03-14 Thread Ryan Nelson
e same problem.) Ryan On Sat, Mar 14, 2015 at 8:21 AM, Brenton Horne wrote: > Yes, a popup window appears but it appears immediately after it appears. > > On 14/03/2015 10:03 PM, Ryan Nelson wrote: > > Brenton, > > Unfortunately, those particular examples are out of date. Firs

Re: [Matplotlib-users] [IPython-dev] IPython's matplotlib inline magic is really magic? Actually it might resets axes bounds...

2015-03-13 Thread Ryan Nelson
s > On Mar 13, 2015 1:59 PM, "Ryan Nelson" wrote: > >> I'm constructing a multi-plot figure using an IPython notebook (v3) and >> matplotlib (v1.4.3) inline magic. I was manually setting the axes bounds, >> and I ended up with something like the following: >&

Re: [Matplotlib-users] IPython's matplotlib inline magic is really magic? Actually it might resets axes bounds...

2015-03-13 Thread Ryan Nelson
progress has been made in that direction (see > https://github.com/matplotlib/matplotlib/issues/1109) > > Tom > > On Fri, Mar 13, 2015 at 3:01 PM Ryan Nelson wrote: > >> I'm constructing a multi-plot figure using an IPython notebook (v3) and >> matplotlib (v1.

[Matplotlib-users] IPython's matplotlib inline magic is really magic? Actually it might resets axes bounds...

2015-03-13 Thread Ryan Nelson
I'm constructing a multi-plot figure using an IPython notebook (v3) and matplotlib (v1.4.3) inline magic. I was manually setting the axes bounds, and I ended up with something like the following: import matplotlib.pyplot as plt %matplotlib inline bottom = 0.12 top = 0.9 left = 0.12 axwid

Re: [Matplotlib-users] Lorenz -- another Q

2015-03-11 Thread Ryan Nelson
Sometimes a simple text file really does the trick... However, you might consider saving yourself some future pain by learning some non-text based storage formats. In the past, I used text files all the time, and they quickly became limiting, as you've noticed. I personally like HDF files. There a

Re: [Matplotlib-users] Set Ticker useOffset to False in matplotlibrc

2015-02-22 Thread Ryan Nelson
guess that answers that! Thanks, I didn't think > to check this. > > Julian > > > On Sun, Feb 22, 2015 at 10:53 AM, Ryan Nelson > wrote: > >> Julian, >> >> What version of matplotlib are you using? The attached rc file works fine >> for me wi

[Matplotlib-users] Qt4 Designer Example

2015-02-18 Thread Ryan Nelson
Hello list, A couple months ago, I spent quite a bit of time trying to figure out how to use Qt designer create a GUI with an embedded MPL window. Unfortunately, the Scipy cookbook page ( http://wiki.scipy.org/Cookbook/Matplotlib/Qt_with_IPython_and_Designer) is very outdated. A recent post ( http

Re: [Matplotlib-users] axes.get_position() inaccurate until after savefig()?

2015-02-18 Thread Ryan Nelson
I don't have an answer to your question exactly. But I'll just say that this does make sense. The aspect-corrected axes (after show) is a subset of what you originally asked for, i.e. the bottom is higher, and the height is smaller. My guess is that this is not calculated until the final rendering

Re: [Matplotlib-users] Fwd: Keep list of figures or plots and flip through list using UI

2015-02-18 Thread Ryan Nelson
Tom et al., I don't know about this exact application... However, a couple of months ago, I asked on the Scipy mailing list about updating the Scipy cookbook page for Qt/Matplotlib ( http://wiki.scipy.org/Cookbook/Matplotlib/Qt_with_IPython_and_Designer), but I never got a response. The cookbook e

Re: [Matplotlib-users] [matplotlib-devel] matplotlib v1.4.3

2015-02-17 Thread Ryan Nelson
Tom and other devs, Thanks for all the hard work! Looking forward to making the upgrade. Just curious if there is a detailed roadmap for v2 and beyond. I feel like there have been some rumors that the get/set architecture will be deprecated at some point. Ryan On Tue, Feb 17, 2015 at 4:30 AM, N

Re: [Matplotlib-users] horizontal alignment of a secondary y-axis

2015-02-14 Thread Ryan Nelson
el in ax2.yaxis.get_ticklabels(): > label.set_horizontalalignment('right') > ax2.tick_params(pad=20) > > When the numbers are large, then they are glued to the secondary > y-axis. When they are small, then they are hovering far away from it. > > On Sat, Feb 14, 2015 at 7:20 PM, Ryan Ne

Re: [Matplotlib-users] MultipleLocator and MaxNLocator

2015-02-14 Thread Ryan Nelson
m/matplotlib.png > > I'll just set the ticks manually. Sadly seems like the easiest thing to do. > > On Sat, Feb 14, 2015 at 7:01 PM, Ryan Nelson > wrote: > > Tommy, > > > > I'm sorry. I forgot to hit send all *again*. Below is my original > message,

Re: [Matplotlib-users] horizontal alignment of a secondary y-axis

2015-02-14 Thread Ryan Nelson
g > many cool plots. The MPL learning curve has just been a bit steep, > when you are used to plot whatever you want. > > On Sat, Feb 14, 2015 at 5:06 PM, Ryan Nelson > wrote: > > Tommy, > > > > I'll try to answer your points in order: > > > > 1)

Re: [Matplotlib-users] MultipleLocator and MaxNLocator

2015-02-14 Thread Ryan Nelson
just use > > > > ax1.xaxis.set_major_locator(TrimmedMultipleLocator(5)) > > > > I haven't tested it--but give it a try. What it is doing is making a > > subclass of MultipleLocator, and altering only the one little bit of its > > behavior that you want to mo

Re: [Matplotlib-users] MultipleLocator and MaxNLocator

2015-02-14 Thread Ryan Nelson
Tommy, (Sorry for the doubleup. I just realized I forgot to hit reply-all.) Do you want to remove the tick at 0 and only have 5,10, etc.? Could you just do something like this instead: import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator fig = plt.figure() ax1 = fig.add_s

Re: [Matplotlib-users] horizontal alignment of a secondary y-axis

2015-02-14 Thread Ryan Nelson
ould make a lot of sense. It would be great, > if I could set the horizontal alignment without having to use a for > loop. It's just plain ugly. In gnuplot it's as simple as this: > set ytics right > > Thanks for your help and providing me with a solution. > > Tommy >

Re: [Matplotlib-users] backend_qt4agg

2015-02-12 Thread Ryan Nelson
quot;, line 454, in _import > mod = _builtin_import(name, globals, locals, fromlist, level) > ImportError: No module named matplotlib.pyplot > > I'm not sure what the first command is to confirm whether a module is > installed or not, but it looks like I may need that. > Than

Re: [Matplotlib-users] backend_qt4agg

2015-02-12 Thread Ryan Nelson
John, As Ben said, the QGIS Windows installer comes with its own Python installation, which doesn't know anything about any other Python install. Unfortunately, this apparently makes it rather difficult to install other packages. However, QGIS Python already contains Numpy and Matplotlib and PyQt4

Re: [Matplotlib-users] creating a path from multiple sets of xy coordinates (inner and outer outlines)

2014-12-22 Thread Ryan Nelson
Denis, I've only made simple polygons with MPL, so I don't know the full capabilities. However, there is another package called Shapely that can construct polygons like you've defined: http://toblerity.org/shapely/manual.html#polygons It also does some set-type stuff, such as intersections, differ

Re: [Matplotlib-users] fill_between issue

2014-12-09 Thread Ryan Nelson
tion here to file > a bug report. > > Ben Root > > On Mon, Dec 8, 2014 at 6:14 PM, Ryan Nelson wrote: > >> Final update. >> >> I've done some more searching, and found a couple more things. It seems >> that this problem occurs with the backend set to &qu

Re: [Matplotlib-users] fill_between issue

2014-12-08 Thread Ryan Nelson
es not work. #col = PolyCollection([data]) #col.set_linewidth(0.0) #ax.add_collection(col) plt.axis([-2, 2, -2, 2]) plt.savefig('junk') # On Mon, Dec 8, 2014 at 5:02 PM, Ryan Nelson wrote: > Update 2. > > I made a new Anaconda Python 2.7 environment and cycled through some > diffe

Re: [Matplotlib-users] fill_between issue

2014-12-08 Thread Ryan Nelson
matplotlib.pyplot as plt x = np.linspace(0, np.pi*2, 1000) y = np.sin(x) ax = plt.axes() fill = ax.fill_between(x, y-0.1, y+0.1) fill.set_linewidth(0) plt.show() On Mon, Dec 8, 2014 at 3:38 PM, Ryan Nelson wrote: > Update. > > This is a problem also in Anaconda Py3.4 with MPL 1.4.2, but

Re: [Matplotlib-users] fill_between issue

2014-12-08 Thread Ryan Nelson
Update. This is a problem also in Anaconda Py3.4 with MPL 1.4.2, but it works without a problem on MPL 1.4.0. Ryan On Mon, Dec 8, 2014 at 12:15 PM, Ryan Nelson wrote: > Hello all, > > I'm having an issue with fill_between. It seems that setting the keyword > `linewidth=0` r

[Matplotlib-users] fill_between issue

2014-12-08 Thread Ryan Nelson
Hello all, I'm having an issue with fill_between. It seems that setting the keyword `linewidth=0` removes the entire patch, rather than the just the bounding lines. Example: import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 2*np.pi, 1000) y = np.sin(x) plt.fill_between(

Re: [Matplotlib-users] Help understanding matplotlibrc vs matplotlib api

2014-09-11 Thread Ryan Nelson
Jonno, Unfortunately, I'm not sure that the matplotlibrc file will cover every type of customization. If you don't find it on the customization page ( http://matplotlib.org/users/customizing.html), then it might not be possible to have it be a default. In principle, I like the matplotlibrc file;

Re: [Matplotlib-users] Plotting large file (NetCDF)

2014-09-09 Thread Ryan Nelson
Raffaele, As Ben pointed out, you might be creating a lot of in memory Numpy arrays that you probably don't need/want. For example, I think (?) slicing all of the variable below: lons = fh.variables['lon'][:] is making a copy of all that (mmap'ed) data as a Numpy array in memory. Get rid of the s

Re: [Matplotlib-users] Setting the tick label font size

2013-10-29 Thread Ryan Nelson
ticks( (20.0, 40.0) ) par2.yaxis.set_ticklabels( ('A', 'B') ) par2.axis["right"].label.set_color(p3.get_color()) par2.axis["right"].label.set_fontsize(18) par2.axis["right"].major_ticklabels.set_fontsize(14) plt.show() ## Hope th

Re: [Matplotlib-users] Setting the tick label font size

2013-10-28 Thread Ryan Nelson
Daniele, I noticed the same problem with the Qt backend. However, I was looking at the documentation on the AxesGrid webpage here: http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html And I see the following warning: axes_grid and axisartist (but not axes_grid1) uses a custom Axes cla

Re: [Matplotlib-users] Plot Scatter plot with hist() method output

2013-08-19 Thread Ryan Nelson
Dilpreet, Fortunately, you have a couple of options here. First of all, when you call the plt.hist function, it actually returns three useful sets of data: the frequencies, bin edges, and the bar patches. The first two are probably what you want. You can grab those for later use in your code by do

Re: [Matplotlib-users] Plot/save line collection object without margins

2013-07-06 Thread Ryan Nelson
You might need to explicitly specify your axes object rather than relying on plt.subplot. Try replacing 'ax = plt.sublplot(111)' with 'ax = plt.axes([0, 0, 1, 1])'. Ryan On 7/5/2013 12:44 PM, death jun wrote: > Hello list, > > I have LineCollection object: "l = matplotlib.collections.LineCollecti

Re: [Matplotlib-users] Highlighting portions of a plot

2013-06-27 Thread Ryan Nelson
Neal, I like to use partially transparent rectangles, such as axhspan and axvspan. Some people are not so great with colors, so I try to minimize line color changes. If you were going to change line colors, I would do something to the line style to highlight the difference as well. Below is a l

Re: [Matplotlib-users] Individual custom markers and colorbar

2013-04-26 Thread Ryan Nelson
> and 'None', respectively, both with no effect whatsoever. > > The second problem is, that I cannot get the colorbar to work. > I tried > > sc = ax.add_collection(col) > plt.colorbar(sc) > > and > > plt.colobar(col) > > both do not work. > Any Ideas h

Re: [Matplotlib-users] Individual custom markers and colorbar

2013-04-25 Thread Ryan Nelson
Hackstein, Unfortunately, I'm not sure of an 'elegant' way to do what your asking with a single call to scatter. Others may know a better way. However, you can use rectangle patches and patch collections. (Requires a bit more code than scatter but is ultimately more flexible.) I think the ex

Re: [Matplotlib-users] Impossible to draw a direction of arrows in Matplotlib???

2013-04-12 Thread Ryan Nelson
I'm not sure that I understand exactly what you are trying to do, but you may want to look into Matplotlib annotation. Here's a really quick example: import matplotlib.pyplot as plt plt.annotate('', (1, 1), (0, 0), arrowprops=dict(facecolor='black')) plt.axis([-1, 2, -1, 2]) plt.show()

Re: [Matplotlib-users] Unicode characters in PS output

2013-02-25 Thread Ryan Nelson
On 2/25/2013 9:29 PM, Gökhan Sever wrote: Hello, For some reason, I can't get the degree sign showing up in my ps output: Here is the simple test code: fp = plt.figure(figsize=(8.5, 11)) fp.text(0.5, 0.5, u"Temperature, ^(0)C", color='black', fontsize=16) plt.savefig('test.ps '

Re: [Matplotlib-users] fading line plot

2013-02-24 Thread Ryan Nelson
On 2/24/2013 1:28 PM, Paul Anton Letnes wrote: > Hi everyone, > > I've been looking into making an animation of a mechanical system. In its > first incarnation, my plan was as follows: > 1) Make a fading line plot of two variables (say, x and y) > 2) Run a series of such plots through ffmpeg/avenc

Re: [Matplotlib-users] discrete colors from colormap for plt.plot and plt.scatter

2012-11-15 Thread Ryan Nelson
Claus, I agree with Sterling that the colors api page has a great deal of useful info. However, as another solution to your problem, keep in mind that the predefined colormaps contained in matplotlib.pyplot.cm return color tuples when called with a float between 0 and 1. To illustrate with an exte

Re: [Matplotlib-users] color pallette suggestions wanted

2012-10-12 Thread Ryan Nelson
Andreas, Perhaps you would be better off making your own colormap considering that your data is not symmetric around zero. You could do something like the following: -- import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as plc data = n

Re: [Matplotlib-users] please help with arrow drawing.

2011-10-18 Thread Ryan Nelson
As far as I know, the 'arrow' function is not recommended. The 'annotate' function has a lot more features. Here's your code with the annotate function: import pylab from scipy import optimize import numpy x1=numpy.arange(-4000,1000,0.1) x2=numpy.arange(-1000,4000,0.1) y1=100*numpy.square(x1+1500)

Re: [Matplotlib-users] color problems in scatter plot

2011-10-04 Thread Ryan Nelson
Mike, You may want to look into the matplotlib.cm and matplotlib.colors modules. I've had good success with matplotlib.colors.LinearSegmentedColormap and its 'from_list' method. The documentation is the best location for information on this topic. If you have a large number of locations, then the

Re: [Matplotlib-users] color problems in scatter plot

2011-10-03 Thread Ryan Nelson
Mike, sorry to send this twice... I should have sent it to the list as well... ___ Mike, If your locations were integers or floats rather than strings, you could just change the scatter call to the following: ax.scatter(dates,IDs,c= locations,marker='d') I don't know ab

[Matplotlib-users] Unexpected behavior with axes.twinx + pyplot.xticks

2011-09-04 Thread Ryan Nelson
Hello all, I noticed some unusual behavior with specific combinations of axes.twinx and pyplot.xticks. It seems that under certain conditions, the pyplot.xticks command can cause an x offset of the plots. Here's a relatively short example (as written, this works fine): import numpy as np import m

Re: [Matplotlib-users] order of plotting for 'layer' of data

2011-09-04 Thread Ryan Nelson
Rob, Have you tried the zorder argument. It is an integer that controls the relative 'height' of a plotting element: higher numbers are plotted over lower numbers. For example, the following code plots the scatter points on top of the plotted line (even though scatter was called first): import nu

Re: [Matplotlib-users] How do you Plot data generated by a python script?

2011-08-25 Thread Ryan Nelson
If I understand your question correctly, I may have a solution to your problem. First of all, the statement below, when converted to Python code, will generate an array of numbers the same length of your masses list. > 'y runs fron 0 to n where n == len(masses) ' However, this statement will give y

[Matplotlib-users] Unusual (?) spacing with sub-/superscripts

2011-01-16 Thread Ryan Nelson
Hello everyone, I frequently use subscripts and superscripts in text on my plots, but I've noticed that the line and character spacing (kerning ?) is not always as I would expect. For most things, this is not a problem. However, I would occasionally like various text objects to line up with on