Re: [Matplotlib-users] Can I change placement of X-Axis?
John - My version of mpl (0.90.1) only has a function ax.xaxis.get_ticklocs(), not ax.xaxis.get_majorticklocs(). New feature? Mark On Feb 2, 2008 10:27 PM, John Hunter wrote: > Send Matplotlib-users mailing list submissions to >matplotlib-users@lists.sourceforge.net > > To subscribe or unsubscribe via the World Wide Web, visit >https://lists.sourceforge.net/lists/listinfo/matplotlib-users > or, via email, send a message with subject or body 'help' to >[EMAIL PROTECTED] > > You can reach the person managing the list at >[EMAIL PROTECTED] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Matplotlib-users digest..." > > > Today's Topics: > > 1. Re: Can I change placement of X-Axis? (John Hunter) > > > -- > > Message: 1 > Date: Sat, 2 Feb 2008 15:27:52 -0600 > From: "John Hunter" <[EMAIL PROTECTED]> > Subject: Re: [Matplotlib-users] Can I change placement of X-Axis? > To: "Eric Firing" <[EMAIL PROTECTED]> > Cc: volcs0 <[EMAIL PROTECTED]>, matplotlib-users@lists.sourceforge.net > Message-ID: ><[EMAIL PROTECTED]> > Content-Type: text/plain; charset="iso-8859-1" > > On Feb 2, 2008 3:06 PM, Eric Firing <[EMAIL PROTECTED]> wrote: > > volcs0 wrote: > > > I saw one post related to arbitrary axis positioning from 2005, but > there was > > > no solution. > > > > It is still on the wish list. > > Though with a little hacking, you can emulate it by manually drawing > everything yourself -- this is the approach SAGE takes. Eg, > > import numpy as np > from pylab import figure, show > import matplotlib.lines as lines > > def make_xaxis(ax, yloc, offset=0.05, **props): >xmin, xmax = ax.get_xlim() >locs = [loc for loc in ax.xaxis.get_majorticklocs() >if loc>=xmin and loc<=xmax] >tickline, = ax.plot(locs, [yloc]*len(locs),linestyle='', >marker=lines.TICKDOWN, **props) >axline, = ax.plot([xmin, xmax], [yloc, yloc], **props) >tickline.set_clip_on(False) >axline.set_clip_on(False) >for loc in locs: >ax.text(loc, yloc-offset, '%1.1f'%loc, >horizontalalignment='center', >verticalalignment='top') > > def make_yaxis(ax, xloc=0, offset=0.05, **props): >ymin, ymax = ax.get_ylim() >locs = [loc for loc in ax.yaxis.get_majorticklocs() >if loc>=ymin and loc<=ymax] >tickline, = ax.plot([xloc]*len(locs), locs, linestyle='', >marker=lines.TICKLEFT, **props) >axline, = ax.plot([xloc, xloc], [ymin, ymax], **props) >tickline.set_clip_on(False) >axline.set_clip_on(False) > >for loc in locs: >ax.text(xloc-offset, loc, '%1.1f'%loc, >verticalalignment='center', >horizontalalignment='right') > > > props = dict(color='black', linewidth=2, markeredgewidth=2) > x = np.arange(200.) > y = np.sin(2*np.pi*x/200.) + np.random.rand(200)-0.5 > fig = figure(facecolor='white') > ax = fig.add_subplot(111, frame_on=False) > ax.axison = False > ax.plot(x, y, 'd', markersize=8, markerfacecolor='blue') > ax.set_xlim(0, 200) > ax.set_ylim(-1.5, 1.5) > make_xaxis(ax, 0, offset=0.1, **props) > make_yaxis(ax, 0, offset=5, **props) > fig.savefig('manual_axis.png', dpi=100, facecolor='white', > edgecolor='white') > show() > -- next part -- > A non-text attachment was scrubbed... > Name: test.py > Type: application/octet-stream > Size: 1691 bytes > Desc: not available > -- next part -- > A non-text attachment was scrubbed... > Name: manual_axis.png > Type: image/png > Size: 35563 bytes > Desc: not available > > -- > > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ > > -- > > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > End of Matplotlib-users Digest, Vol 21, Issue 5 > *** > - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Appending values to bar graphs
Hi people, I'm producing a bar graph and was wondering if there is an easy method for displaying the absolute value of each column on the graph, next to the relevant column Thanks Andy - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] stix fonts don't work with ghostscript
Hi Michael! Thanks a lot, I've applied the changes to mathtext in my installation and it works now! Bernhard On Feb 1, 2008 8:16 PM, Michael Droettboom <[EMAIL PROTECTED]> wrote: > Well, this is a really good puzzle. > > I think the difference in ghostscript versions is a red herring. > Ghostscript can be used to "distill" eps files, and therefore could be > part of the production pipeline, but only if you set the ps.usedistiller > rcParam. > > The problem in the broken .eps file you sent me was that it was > including two STIXGeneral fonts, one with the characters produced by the > mathtext engine, and one with the characters produced by the regular > text engine. Since they both had the same Postscript name, the > Postscript interpreter presumably got confused and didn't know where to > get characters from. > > Why was this happening? I have a theory. The mathtext engine looks for > the fonts directly, since it knows they should be in the matplotlib > installation directory, whereas the regular text engine was looking up > the fonts through a more complex "font-finding" algorithm that finds > fonts in a number of places on the system. It's possible (and this is a > huge guess) that on your "broken" machine, you have the STIXGeneral font > installed somewhere other than the matplotlib installation directory > (~/.fonts or /usr/share/fonts or something). Matplotlib assumes that if > two fonts have different paths that they are different fonts and *boom* > you get two fonts with the same name in the Postscript file. All that > is just conjecture about your situation, but I was able to reproduce it > here by copying the STIX fonts to ~/.fonts. > > I have fixed mathtext so it uses the font-finding mechanism, so that > whenever anyone asks for "STIXGeneral", it should always get the same > thing. That has been fixed in SVN r4928. > > The problem with Ps+Type42+STIXGeneral still persists. I'm pretty > certain this is due to the size of the font file. For that reason, > Type3 is just a better option anyway, so I don't consider it a high > priority -- but if you have a use case where it really matters, > certainly let me know. > > Cheers, > Mike > > > Bernhard Voigt wrote: > >> Well, I was able to fix the spacing problem with PDF+Type42. That has > >> now been fixed in SVN r4915 (and on the maintenance branch). It's a > >> simple patch that I'll forward to you. > > > > Thanks, that works! > > > >>> At home, using another gs version (8.15.0, instead of 8.15.2) also the > >>> eps is ok with ps.fonttype 3, though the one with fonttype 42 is still > >>> erroneous. > >> It's always fun when an external dependency breaks something... ;) I > >> only have the fairly old gs 7.07, and it seems to always work with type > >> 3, and sometimes break with type 42. Can you do me a favor to save me > >> the trouble of having to install a bunch of versions of ghostscript? > >> Can you send me an eps of the same plot produced through gs 8.15.0 and > >> 8.15.2? I hope that by examining the differences there will be some > >> clue as to the breakage. > > > > Attachted are plots produced with type 3. I thought it's the viewer > > which produces the problems and gs is not involved in writing these > > files, though. Isn't the ps backend producing the ps files on its own? > > > > Well, but somehow there is a difference in the eps files. I've on both > > machines the same matplot version, but as I said, the eps produced at > > home with type3 is ok, it's also ok viewing it a work with the newer > > gs interpreter. The other way around does not work, files produced at > > work produce errors when viewing on both machines. > > > > Hope the files are helpflull! Bernhard > > > > > >> Thanks, > >> Mike > >> > >>> Thanks! Bernhard > >>> > >>> > >>> On Jan 31, 2008 4:45 PM, Michael Droettboom <[EMAIL PROTECTED]> wrote: > Can you send the source of your plot, and also your matplotlibrc file? > > Bernhard Voigt wrote: > > -- > > Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > > >> -- > >> > >> Michael Droettboom > >> Science Software Branch > >> Operations and Engineering Division > >> Space Telescope Science Institute > >> Operated by AURA for NASA > >> > > -- > > Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] STIX fonts outside of mathtext
In your matplotlibrc file, you can set the following: font.family : serif font.serif : STIXGeneral Also note the numerals and Latin characters are extremely similar if not identical to Times (or "Times New Roman"), so you could also use that for titles/labels etc., but it doesn't really matter. Cheers, Mike John Travers wrote: > Hello, > I'm very pleased with the STIX fonts support in mathtext. Thanks for > getting this working! However, I would like to use the same font in > labels which do not contain mathtext, for consistency. I cannot work out > how to do this. Can anyone help with this? > Thanks, > John > > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] STIX fonts outside of mathtext
On Mon, Feb 04, 2008 at 08:22:57AM -0500, Michael Droettboom wrote: > In your matplotlibrc file, you can set the following: > > font.family : serif > font.serif : STIXGeneral > > Also note the numerals and Latin characters are extremely similar if not > identical to Times (or "Times New Roman"), so you could also use that > for titles/labels etc., but it doesn't really matter. > > Cheers, > Mike > > John Travers wrote: >> Hello, >> I'm very pleased with the STIX fonts support in mathtext. Thanks for >> getting this working! However, I would like to use the same font in >> labels which do not contain mathtext, for consistency. I cannot work out >> how to do this. Can anyone help with this? >> Thanks, >> John >> Thanks for the quick response. I'm using the stixsans font for mathtext, so I need sans-serif fonts for the rest of the text. STIXGeneral appears to be serif only (changing the rc options to sans-serif etc. does not work). Should I use Vera instead? Or have I miss understood something (I'm not particularly informed about fonts)? Thanks again, John - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] titles for legends
Hello, I sometimes want to add titles to legends in matplotlib. I couldn't find an existing way to do this (but if there is one, then please tell me!). So I have hacked together a patch to add a title keyword to the legend class, which adds the title to the top of the legend. I'm not sure it conforms very well to matplotlib style, but I have attached it to this message in case anyone else finds it useful. Cheers, John Index: lib/matplotlib/legend.py === --- lib/matplotlib/legend.py (revision 4937) +++ lib/matplotlib/legend.py (working copy) @@ -92,7 +92,8 @@ handletextsep = None, # the space between the legend line and legend text axespad = None, # the border between the axes and legend edge - shadow = None + shadow = None, + title = None ): """ parent# the artist that contains the legend @@ -104,6 +105,7 @@ pad = 0.2 # the fractional whitespace inside the legend border markerscale = 0.6 # the relative size of legend markers vs. original shadow# if True, draw a shadow behind legend + title # set a title for the legend The following dimensions are in axes coords labelsep = 0.005 # the vertical space between the legend entries @@ -178,7 +180,22 @@ # based on it's bbox left, top = 0.5, 0.5 textleft = left+ self.handlelen+self.handletextsep -self.texts = self._get_texts(labels, textleft, top) + +ntop = top +self.title = None +if title != None: +ntop = ntop - self._approx_text_height() +text = Text( +x=textleft, y=top, +text=title, +fontproperties=self.prop, +verticalalignment='top', +horizontalalignment='center' +) +self._set_artist_props(text) +self.title = text + +self.texts = self._get_texts(labels, textleft, ntop) self.legendHandles = self._get_handles(handles, self.texts) self._drawFrame = True @@ -208,6 +225,9 @@ h.draw(renderer) if 0: bbox_artist(h, renderer) +if self.title != None: +self.title.draw(renderer) + for t in self.texts: if 0: bbox_artist(t, renderer) t.draw(renderer) @@ -223,6 +243,11 @@ bboxesAll = bboxesText bboxesAll.extend(bboxesHandles) + +if self.title != None: +bboxesTitle = self.title.get_window_extent(renderer) +bboxesAll.extend([bboxesTitle]) + bbox = Bbox.union(bboxesAll) self.save = bbox @@ -491,6 +516,11 @@ h += 2*self.labelsep hpos.append( (b,h) ) +if self.title != None: +x,y = self.title.get_position() +l,b,w,h = get_tbounds(self.texts[0]) +self.title.set_position( (x, b+3*h) ) + for handle, tup in zip(self.legendHandles, hpos): y,h = tup if isinstance(handle, Line2D): - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] displaying multiple plots
I've done this on my system at home, but it doesn't seem to be working at work. I generate a series of imshow() plots, each followed by a show() command. When I run the script, it should pause after each show() until I exit the plot, and then display the next plot. But now it isn't working. The first plot gets displayed and pauses, and then it falls through to the end. numpy 1.0.3.1, matplotlib 0.90.1 -- from numpy import arange, array, mgrid, cos, random import scipy.stats as stats import scipy.signal as signal #--- # 2D filters #--- # from Scipy cookbook def gauss_kern(size, sizey=None): """ Returns a normalized 2D gauss kernel array for convolutions """ size = int(size) if not sizey: sizey = size else: sizey = int(sizey) x, y = mgrid[-size:size+1, -sizey:sizey+1] g = exp(-(x**2/float(size)+y**2/float(sizey))) return g / g.sum() # from Scipy cookbook def blur_image(im, n, ny=None) : """ blurs the image by convolving with a gaussian kernel of typical size n. The optional keyword argument ny allows for a different size in the y direction. """ g = gauss_kern(n, sizey=ny) improc = signal.convolve(im,g, mode='valid') return(improc) # test section if __name__ == '__main__' : X,Y = mgrid[-70:70,-70:70] Z = cos((X**2+Y**2)/200.) + random.normal(size=X.shape) from matplotlib.pylab import * imshow(Z, hold=True) show() # gaussian blur, 5x5 NewZ = blur_image(Z,15) imshow(NewZ, hold=True) show() - - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] STIX fonts outside of mathtext
John Travers wrote: > On Mon, Feb 04, 2008 at 08:22:57AM -0500, Michael Droettboom wrote: >> In your matplotlibrc file, you can set the following: >> >> font.family : serif >> font.serif : STIXGeneral >> >> Also note the numerals and Latin characters are extremely similar if not >> identical to Times (or "Times New Roman"), so you could also use that >> for titles/labels etc., but it doesn't really matter. >> >> Cheers, >> Mike >> >> John Travers wrote: >>> Hello, >>> I'm very pleased with the STIX fonts support in mathtext. Thanks for >>> getting this working! However, I would like to use the same font in >>> labels which do not contain mathtext, for consistency. I cannot work out >>> how to do this. Can anyone help with this? >>> Thanks, >>> John >>> > > Thanks for the quick response. I'm using the stixsans font for mathtext, > so I need sans-serif fonts for the rest of the text. STIXGeneral appears > to be serif only (changing the rc options to sans-serif etc. does not > work). Should I use Vera instead? Or have I miss understood > something (I'm not particularly informed about fonts)? I just assumed you were using the STIX serif mode. Unfortunately, the sans-serif stuff in the STIX fonts are at math-specific code points in the same font file, so you can't just tell matplotlib to use it and have it work, unfortunately. Support specifically for that could be added to matplotlib, but it's not straightforward. You could use another sans-serif font, but I'm not sure specifically which one STIX is based on (the information is pretty thin on the STIX website). It's definitely not Helvetica/Arial etc. Does anyone else know? And slightly OT -- if there's any other font geeks out there. I just found the "identifont" website which asks a series of questions about a font you want to identify and then presents a list of fonts that meet that criteria. It failed to identify the STIX sans-serif characters -- I suppose its database isn't big enough. But still an interesting solution to the problem nonetheless. Cheers, Mike -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] histogram
Are there any plans to add to hist() the ability to do non-bar style histograms? I mean something like the following: <> Right now, all histograms have lines on the side of each "bar" going all the way to the base of the plot. I had to write some custom code to make this figure, but I use it all the time. Cheers, Jessica - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] histogram
On Monday 04 February 2008 12:28:21 jlu wrote: > Are there any plans to add to hist() the ability to do non-bar style > histograms? I mean something like the following: What about using plot w/ linestyle='steps' ? Or change the linewidth to 0 in bar - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] STIX fonts outside of mathtext
Hello, I'm very pleased with the STIX fonts support in mathtext. Thanks for getting this working! However, I would like to use the same font in labels which do not contain mathtext, for consistency. I cannot work out how to do this. Can anyone help with this? Thanks, John - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] PS backend does not respect kwargs
This should be fixed now in SVN r4938. The graphics context was "sticking". Cheers, Mike [EMAIL PROTECTED] wrote: > When using the PostScript backend, and plotting several lines with the same > call to plot (or when plotting a LineCollection), kwargs are applied to the > first line only, and not to every line. > > Included is a minimal script that exhibits this problem. The saved figure > shows only one thick red line where we would expect two such lines. > > Paul Novak > > #!/usr/bin/env python > > import matplotlib > matplotlib.use('PS') > from pylab import * > > x = arange(0.0, 5.0) > y = 2 * x > plot(x, x, x, y, color='red', linewidth = 5) > > savefig('image') > > show() > > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] histogram
linestyle='steps' only works for plot() not hist(). To use that, I have to generate points at the edges of each histogram step... this is what my custom code does now. IDL's histogram code does this automatically. Linewidth=0 doesn't work because it removes ALL lines. I also need fill=None and this added to linewidth=0 doesn't plot anything. Cheers, Jessica On Feb 4, 2008, at 9:42 AM, Pierre GM wrote: > On Monday 04 February 2008 12:28:21 jlu wrote: >> Are there any plans to add to hist() the ability to do non-bar style >> histograms? I mean something like the following: > > What about using plot w/ linestyle='steps' ? Or change the linewidth > to 0 in > bar > > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] axes.set_aspect
Hi Folks, I have acquired some code that was running on a previous version of matplotlib. I am now using version 0.91.2. The code I acquired uses the following code fragment: import pylab from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas figure = matplotlib.pylab.Figure( figsize=(8,6), # 8"x6" is default facecolor='r' ) canvas = FigureCanvas( figure ) # ( left, bottom, width, height ) axes_ts = figure.add_axes( ( 0.05, 0.0, 0.75, 0.04 ) ) axes_ts.set_axis_off() subplots = [] axes_ll = figure.add_axes( ( 0.05, 0.05, 0.9, 0.9 ) ) # l, l subplots.append( (axes_ll, data_sets[ 0 ]) ) for subplot in subplots: axes = subplot[ 0 ] data_set = subplot[ 1 ] axes.set_xlim( -1.0, 1.0 ) axes.set_ylim( -1.0, 1.0 ) axes.set_aspect( 'equal' , fixLimits=True ) <+++ axes.set_axis_off() data_set.render( axes, fm, to ) It seems that axes.set_aspect does not have a keyword of fixLimits. Did it ever? Does it depend on the backend? The original code used GTKAgg. I am not using GTKAgg. I am just using a default backend. -- Ms. Carol A. Leger SRI International Phone: (650) 859-4114 333 Ravenswood Avenue G-273 Menlo Park, CA 94025e-mail: [EMAIL PROTECTED] - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] axes.set_aspect
Carol Leger wrote: > Hi Folks, > > I have acquired some code that was running on a previous version of > matplotlib. I am now using version 0.91.2. > > The code I acquired uses the following code fragment: > import pylab > from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas > > figure = matplotlib.pylab.Figure( figsize=(8,6), # 8"x6" is default >facecolor='r' ) > canvas = FigureCanvas( figure ) > > # ( left, bottom, width, height ) > axes_ts = figure.add_axes( ( 0.05, 0.0, 0.75, 0.04 ) ) > axes_ts.set_axis_off() > > > subplots = [] > > axes_ll = figure.add_axes( ( 0.05, 0.05, 0.9, 0.9 ) ) # l, l > subplots.append( (axes_ll, data_sets[ 0 ]) ) > > for subplot in subplots: > axes = subplot[ 0 ] > data_set = subplot[ 1 ] > axes.set_xlim( -1.0, 1.0 ) > axes.set_ylim( -1.0, 1.0 ) > axes.set_aspect( 'equal' , fixLimits=True ) <+++ > axes.set_axis_off() > data_set.render( axes, fm, to ) > > > It seems that axes.set_aspect does not have a keyword of fixLimits. Did > it ever? Does it depend on the backend? The original code used GTKAgg. > I am not using GTKAgg. I am just using a default backend. Carol, That kwarg was eliminated a little less than 2 years ago as part of a major reworking of aspect ratio handling. It never depended on the backend. The kwarg equivalent to fixLimits=True is adjustable='box'. Quite a bit has changed in the last two years, though, so there may be other things in your code that need to be updated. Eric - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users