Re: [Matplotlib-users] visualizing colormaps for complex functions
Hi Gary, Thanks for responding. It looks like the mpmath does what I'm looking for. Your code looks interesting, as it lowers the number of dependencies needed. I hope I'll find the time to really incorporate this features to something that can come as part to matplotlib. Regarding the plots I've pointed to, I didn't make them, so I don't know how the author did it (expect that he used Mathematica). Thanks, Guy On Sat, Apr 3, 2010 at 4:29 AM, Gary Ruben wrote: > Hi Guy, > > I am also interested in the answer to this. The cplot function in the > mpmath module does exactly this using matplotlib, but very inefficiently, as > it computes the colour of each pixel in the image in hls colour-space and > generates the corresponding rgb value directly. I suspect this is how it has > to be done, as colormaps in matplotlib are 1D sequences and the black-white > (lightness) value is really another dimension. However mpmath's method can > be improved by doing the mapping using array operations instead of computing > it for each pixel. > > I've attached a function I wrote to reproduce the Sage cplot command in my > own work. It's a bit old and can be improved. It takes the Arg and Abs of a > complex array as the first two arguments - you can easily change this to > compute these inside the function if you prefer. The line > np.vectorize(hls_to_rgb) can be replaced - recent versions of matplotlib > have a vectorized function called hsv_to_rgb() inside colors.py - so you > replace the return line with the commented-out version if you first import > hsv_to_rgb from colors. > > I hope this helps. > > I'm also curious: the plots you point to also show plots of the function > "extrema", which are the phase singularities - does mathematica have a > function that gives you these, or did you write your own function to find > them? > > regards, > Gary > > > Guy Rutenberg wrote: > >> Hi, >> >> Is there a way to generate colormaps for complex-valued functions using >> matplotlib? The type of plots I'm looking for are like the plots in: >> http://commons.wikimedia.org/wiki/User:Jan_Homann/Mathematics >> >> Thanks in advance, >> >> Guy >> > > def cplot_like(ph, intens=None, int_exponent=1.0, s=1.0, l_bias=1.0, > drape=0, is_like_mpmath=False): >''' >Implements the mpmath cplot-like default_color_function >The combined image is generated in hls colourspace then transformed to > rgb >*phase* >A filename or 2D n x m array containing phase data in the range > -pi->pi >*intens* >If None, set to 1.0 >A filename or 2D n x m array containing intensity or amplitude data > in the range 0->max >*int_exponent* >Default 1.0 applies the intens mask directly to the hls > lightness-channel >0.6 works well when drape==0 >*s* >saturation. Defaults to 1.0. mpmath uses 0.8. >*l_bias* >biases the mean lightness value away from 0.5. mpmath uses 1.0. >Examples are: l_bias=2 -> mean=0.33 (ie darker), l_bias=0.5 -> > mean=0.66 (lighter) >*drape* >If >1, drapes a structured maximum filter of size drape x drape over > the intensity data >*is_like_mpmath* >If True, sets int_exponent = 0.3, s = 0.8 >''' >from colorsys import hls_to_rgb > >if type(ph) is str: >cph = plt.imread(ph)/256.*2*pi-pi # -pi->pi >if len(cph.shape) == 3: cph = cph[...,0] # if ph is RGB or > RGBA, extract the R-plane >else: >cph = ph.copy() > >if intens is None: >cintens = np.ones_like(cph) >elif type(intens) is str: >cintens = plt.imread(intens)/255. # 0->1 >if len(cintens.shape) == 3: cintens = cintens[...,0] # if intens > is RGB or RGBA, extract the R-plane >else: >cintens = intens.copy() >cintens /= cintens.max() # autoscale intensity > data to 0->1 > >if drape > 1: ># envelope the intensity >cintens = maximum_filter(cintens, size=drape) > >h = ((cph + pi) / (2*pi)) % 1.0 > >if is_like_mpmath: ># apply mpmath values >int_exponent = 0.3 >s = 0.8 > >l = 1.0 - l_bias/(l_bias+cintens**int_exponent) >v_hls_to_rgb = np.vectorize(hls_to_rgb) > >#~ return hsv_to_rgb(dstack((h,np.ones_like(h),l))) >return dstack(v_hls_to_rgb(h,l,s)) > -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap/ orthographic projection plot doesn't respect globe boundary
Hey Jeff, It's somewhere between the two - the original satellite swath is converted to a regular 0.5 degree grid by truncating, binning, and averaging each point's lons and lats over the top of a 720 x 360 np.zeros array. the plotting still works fine for non ortho/ hemispherical projections, and I've no big problem with using global projections for the time being. Thanks for your help in the meantime anyway. Cheers, Will. Jeff Whitaker wrote: > > On 4/4/10 11:06 AM, Will Hewson wrote: >> Hi again Jeff et al... >> >> I've had a play around with the extra few lines of code - on paper this >> seems like it should solve the problems I'm experiencing. However, an >> error's being thrown up by the transform scalar function, as my lons and >> lats won't necessarily be increasing. The data I'm plotting is satellite >> data and so at the beginning and end of the orbit file lats go over the >> pole >> from 90 to -90, with a similar problem for the lons - whereby the data is >> taken across the satellite track. I've thought about sorting the data >> before >> passing it to transform_scalar but I'm always going to be left with the >> problem in either lats or lons. >> >> I've uploaded the file I'm currently working with this time. It's three >> columns of lons, lats and z values. >> >> Once again, many thanks for your help. >> >> Will. >> >> http://old.nabble.com/file/p28133659/test.plt test.plt >> > > Will: Is it a regular lat/lon grid or a satellite swath? If it's the > latter, you can't use my solution. > > -Jeff > > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Basemap--orthographic-projection-plot-doesn%27t-respect-globe-boundary-tp28117654p28138677.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Getting coordinates of the zoom rectangle
Dear ALL, Good morning... Here is a question that may already have been asked (and answered), but not to my knowledge. Matplotlib's figure windows come with that handy navigation bar, which includes a Pan/Zoom button and a Zoom-to-rectangle button. Once a zoom rectangle is defined on a figure, is it possible to get the coordinates of it (that is, the lower and upper corner coordinates which define the zoom rectangle)? If so, how can this be done? Thanks in advance for any reply. With best regards, -- Dr. Mauro J. Cavalcanti P.O. Box 46521, CEP 20551-970 Rio de Janeiro, RJ, BRASIL E-mail: [email protected] Web: http://sites.google.com/site/maurobio Linux Registered User #473524 * Ubuntu User #22717 -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap/ orthographic projection plot doesn't respect globe boundary
On 4/5/10 4:16 AM, Will Hewson wrote: > Hey Jeff, > > It's somewhere between the two - the original satellite swath is converted > to a regular 0.5 degree grid by truncating, binning, and averaging each > point's lons and lats over the top of a 720 x 360 np.zeros array. the > plotting still works fine for non ortho/ hemispherical projections, and I've > no big problem with using global projections for the time being. Thanks for > your help in the meantime anyway. > > Cheers, > > > Will. > Will: If it's a regular 0.5 degree lat/lon grid, it should work in transform_scalar. However, I don't see how to read the data in your test.plt file into a regular 360x720 grid. It seems to only contain the points in the swath with nonzero values. -Jeff > > > Jeff Whitaker wrote: > >> On 4/4/10 11:06 AM, Will Hewson wrote: >> >>> Hi again Jeff et al... >>> >>> I've had a play around with the extra few lines of code - on paper this >>> seems like it should solve the problems I'm experiencing. However, an >>> error's being thrown up by the transform scalar function, as my lons and >>> lats won't necessarily be increasing. The data I'm plotting is satellite >>> data and so at the beginning and end of the orbit file lats go over the >>> pole >>> from 90 to -90, with a similar problem for the lons - whereby the data is >>> taken across the satellite track. I've thought about sorting the data >>> before >>> passing it to transform_scalar but I'm always going to be left with the >>> problem in either lats or lons. >>> >>> I've uploaded the file I'm currently working with this time. It's three >>> columns of lons, lats and z values. >>> >>> Once again, many thanks for your help. >>> >>> Will. >>> >>> http://old.nabble.com/file/p28133659/test.plt test.plt >>> >>> >> Will: Is it a regular lat/lon grid or a satellite swath? If it's the >> latter, you can't use my solution. >> >> -Jeff >> >> >> -- >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> ___ >> Matplotlib-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> > -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap/ orthographic projection plot doesn't respect globe boundary
I should perhaps of explained my code (included in top post) a little better, the values in my attached file aren't on a regular grid to start with, I do a little bit of juggling as follows to get them into a regular grid: I'm firstly setting up my 2D grid of 0.5 degree lat lons, followed by identically sized grids of zeros for the data bin, and mean divisors: x = np.arange(-180, 180, 0.5); y = np.arange(-90, 90, 0.5) grid_lon, grid_lat = np.meshgrid(x,y) #regularly spaced 2D grid n_vals = np.zeros((360,720)) #mean divisor dat = np.zeros((360,720)) #2D grid of zeros I'm then taking my input data (e.g. the .plt file attached), and rounding the lat lons to the nearest 0 or 0.5: lon = (np.around(lon*2))/2 #round to nearest .0 or 0.5 lat = (np.around(lat*2))/2 #round to nearest .0 or 0.5 Then for each row in my input file where Z is greater than 0, I'm adding the n'th Z value to its corresponding position in the dat zeros array, and keeping a count of how many values are going into each cell in the mean divisor array: j=0 for i in slcol: if lon[j] < 0: grid_lon_ind = 360+(lon[j]*2) grid_lat_ind = 180+(lat[j]*2) else: grid_lon_ind = 360-(lon[j]*2) grid_lat_ind = 180+(lat[j]*2) if i > 0: dat[grid_lat_ind, grid_lon_ind] += i #add i'th value n_vals[grid_lat_ind, grid_lon_ind] += 1 #increase cell counter by 1 for each extra value j+=1 Finally the new dat array is divided by the mean divisor array to give me my mean Z values: dat = np.nan_to_num(dat/n_vals) I've done it this way as opposed to interpolating *properly* in order to (for instance) stop the values bleeding away from the edges of the satellite swath. Cheers, Will. Jeff Whitaker wrote: > > On 4/5/10 4:16 AM, Will Hewson wrote: >> Hey Jeff, >> >> It's somewhere between the two - the original satellite swath is >> converted >> to a regular 0.5 degree grid by truncating, binning, and averaging each >> point's lons and lats over the top of a 720 x 360 np.zeros array. the >> plotting still works fine for non ortho/ hemispherical projections, and >> I've >> no big problem with using global projections for the time being. Thanks >> for >> your help in the meantime anyway. >> >> Cheers, >> >> >> Will. >> > > Will: If it's a regular 0.5 degree lat/lon grid, it should work in > transform_scalar. However, I don't see how to read the data in your > test.plt file into a regular 360x720 grid. It seems to only contain the > points in the swath with nonzero values. > > -Jeff >> >> >> Jeff Whitaker wrote: >> >>> On 4/4/10 11:06 AM, Will Hewson wrote: >>> Hi again Jeff et al... I've had a play around with the extra few lines of code - on paper this seems like it should solve the problems I'm experiencing. However, an error's being thrown up by the transform scalar function, as my lons and lats won't necessarily be increasing. The data I'm plotting is satellite data and so at the beginning and end of the orbit file lats go over the pole from 90 to -90, with a similar problem for the lons - whereby the data is taken across the satellite track. I've thought about sorting the data before passing it to transform_scalar but I'm always going to be left with the problem in either lats or lons. I've uploaded the file I'm currently working with this time. It's three columns of lons, lats and z values. Once again, many thanks for your help. Will. http://old.nabble.com/file/p28133659/test.plt test.plt >>> Will: Is it a regular lat/lon grid or a satellite swath? If it's the >>> latter, you can't use my solution. >>> >>> -Jeff >>> >>> >>> -- >>> Download Intel® Parallel Studio Eval >>> Try the new software tools for yourself. Speed compiling, find bugs >>> proactively, and fine-tune applications for parallel performance. >>> See why Intel Parallel Studio got high marks during beta. >>> http://p.sf.net/sfu/intel-sw-dev >>> ___ >>> Matplotlib-users mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >>> >> > > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Basemap--orthographic-projection-plot-doesn%27t-respect-globe-boundary-
Re: [Matplotlib-users] speed up imports?
All of those calls to "open" are being generated from the pytz import --
which is why pytz seems like the likely candidate. Is it possible you
have pytz installed as a compressed egg, or on a remote disk, or
something that may be causing a file reading penalty?
As Eric said, make sure you time the "import pytz" in a clean Python
session -- if a module is already imported in the Python interpreter, it
won't be reimported.
Mike
Andrew Kelly wrote:
> import pytz only took 0.0 seconds.
>
> I actually just ran that pstats module and there is one line that
> stuck out at me:
> ncalls tottime percall cumtime percall filename:lineno(function)
> 10.0000.0000.0000.000
> C:\Python26\lib\os.py:35(_get_exports_list)
> 5603.1070.0063.1070.006 {open}
>
> That is ~50% of the load time. I have 0 idea what this is though.
>
> Let me try this on my os machine.
>
> -Andy
>
> On Fri, Apr 2, 2010 at 12:31 PM, Michael Droettboom > wrote:
>
> It looks like most of the time is being taken up by pytz (timezone
> library), which opens ~500 files. How does the total time of
> "import pytz" compare?
>
> Mike
>
> Andrew Kelly wrote:
>
> I see. I was wondering why it spit out a binary file.
>
> test.out is attached...
>
> -Andy
>
> On Fri, Apr 2, 2010 at 10:55 AM, Michael Droettboom
> mailto:[email protected]>
> >> wrote:
>
>Can you provide the actual saved profiler data? The output
> of the
>command itself doesn't provide enough information to
> diagnose the
>problem, since it doesn't have full file paths etc.
>
>When you do (thanks Gökhan for the less verbose version):
>
> python.exe -c "import cProfile; cProfile.run('import pylab',
>'test.out')"
>
>this should produce a binary file "test.out" that can be loaded
>with the pstats module and used by GUI tools such as
> KCacheGrind
>to help us get to the bottom of this.
>
>Mike
>
>Andrew Kelly wrote:
>
>I'm back.
>
>My backend is wx. "Import wx" does not really take
> much time
>to import at all. In fact time.time() before and after
> = 0.0
>
>Some computer details:
>Processor: AMD Phenom IIx4 810 Processor 2.6 GHz
>RAM: 8.00 GB
>
>As for the cProfiler output on pylab, I have attached the
>output as test.txt.
> -Andy
>
>On Fri, Apr 2, 2010 at 7:22 AM, Gökhan Sever
>mailto:[email protected]>
> >
>
>wrote:
>
>
>
> On Fri, Apr 2, 2010 at 8:28 AM, Michael Droettboom
> mailto:[email protected]>
> >
>
>
> My gut says it's probably the GUI framework
> import that is
> dominating
> the time. Which backend are you using? Does
> importing it
> take a large
> amount of time as well?
>
> Can you provide a profiler output file we can
> examine
>to narrow it
> down? The following from a command prompt should be
> sufficient to write
> out a file called "import.prof":
>
>python.exe -c "import cProfile;
> prof=cProfile.Profile();
> prof.run('import pylab', 'import.prof')"
>
> Mike
>
>
> Just for the records,
>
> It reads as:
>
> python -c "import cProfile; cProfile.run('import pylab',
> filename='test.out')
>
> in Python 2.6.2
>
> These helped me to load the profile output:
>
> import pstats
> stats = pstats.Stats("test.out")
> stats.print_stats()
>
> -- Gökhan
>
>
>
> --
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed
> compiling,
>find bugs
> proactively, and fi
Re: [Matplotlib-users] Getting coordinates of the zoom rectangle
On Mon, Apr 5, 2010 at 6:39 AM, Mauro Cavalcanti wrote: > Dear ALL, > > Good morning... Here is a question that may already have been asked > (and answered), but not to my knowledge. Matplotlib's figure windows > come with that handy navigation bar, which includes a Pan/Zoom button > and a Zoom-to-rectangle button. Once a zoom rectangle is defined on a > figure, is it possible to get the coordinates of it (that is, the > lower and upper corner coordinates which define the zoom rectangle)? > If so, how can this be done? > > Thanks in advance for any reply. > > With best regards, > > -- > Dr. Mauro J. Cavalcanti > P.O. Box 46521, CEP 20551-970 > Rio de Janeiro, RJ, BRASIL > E-mail: [email protected] > Web: http://sites.google.com/site/maurobio > Linux Registered User #473524 * Ubuntu User #22717 > Hi, Search for zoom_window.py and rectangle_selector.py in your matplotlib examples directory. -- Gökhan -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Bold Latex Tick-Labels
konstellationen wrote:
>
> Hi,
>
> I am making plots for a publication using matplotlib which requires the
> use of heavy fonts. I am rendering text in the graph with Latex, which has
> a limited capability to make fonts more heavy. I partially solved the
> problem using the \boldmath Latex command for the axis-labels and text
> inside the plot (see attached figure). The only remaining text to be
> "bolden" are the tick labels. I can change their size via the
> xtick.labelsize rc parameter, but do not know how to make them heavier.
>
> Does anybody know what can be done to solve this?
>
> Any help would be appreciated
>
> Best, Daniel
>
>
I ran into the same problem today trying to prepare figures for my thesis,
and I figured out a way to do it...it's not pretty, but it works:
import matplotlib.pyplt as plt
tick_locs = range(start, stop, increment)
plt.xticks(tick_locs, [r"$\mathbf{%s}$" % x for x in tick_locs])
Hope this helps!
--
View this message in context:
http://old.nabble.com/Bold-Latex-Tick-Labels-tp28037900p28129365.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Issues with Affine2D transform
The get/set_transform on an artist (any artist really), is an internal
implementation detail that transforms points from data space all the way
to pixels. It's not really useful to the end user, unless you want to
have very low-level control over plotting. If you want to change how
data points are converted into physical plot space, you probably want to
look at creating a custom scale or projection documented here instead:
http://matplotlib.sourceforge.net/devel/add_new_projection.html
Additionally, we should probably make private and/or undocument
get/set_transform, or at the very least make the docstring more explicit
that it is an internal function.
Mike
Thomas Robitaille wrote:
> Hi,
>
> I have been trying to use the Affine2D transformation with pcolor and
> contour, with no success. The following script and comments illustrates my
> problems:
>
> matplotlib.use('Agg')
> import matplotlib.pyplot as mpl
> from matplotlib.transforms import Affine2D
> import numpy as np
>
> image = np.random.random((100,100))
>
> fig = mpl.figure()
> ax = fig.add_subplot(1,1,1)
> ax.pcolor(image, transform=Affine2D()) # Does not work - the image is not
> there!
> fig.savefig('test1.png')
>
The image is there, it's just in the lower left corner of the figure,
outside of the axes.
> fig = mpl.figure()
> ax = fig.add_subplot(1,1,1)
> ax.contour(image, transform=Affine2D()) # Ok, but transformation wouldn't
> change anything anyway
> fig.savefig('test2.png')
>
> fig = mpl.figure()
> ax = fig.add_subplot(1,1,1)
> ax.contour(image, transform=Affine2D().scale(10.,10.)) # Does not work - the
> image is unchanged
> fig.savefig('test3.png')
>
Contour ignores the standard transformation member -- again just an
implementation detail.
Mike
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Tick line linewidth and linestyle don't work
On Sun, Apr 4, 2010 at 11:55 AM, Thomas Robitaille wrote: > It looks as though the set_linewidth and set_linestyle commands are silently > ignored. Is this normal? I have submitted a bug report here: linewidth and linestyle are (or looks) ignored because ticklines are actually "markers". To change width of the ticklines, you should use set_mew. A change of the linestyle should also be possible, but I'm not sure if there is a handy way to do that. Regards, -JJ -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Issues with Affine2D transform
On Mon, Apr 5, 2010 at 10:05 AM, Michael Droettboom wrote:
>> matplotlib.use('Agg')
>> import matplotlib.pyplot as mpl
>> from matplotlib.transforms import Affine2D
>> import numpy as np
>>
>> image = np.random.random((100,100))
>>
>> fig = mpl.figure()
>> ax = fig.add_subplot(1,1,1)
>> ax.pcolor(image, transform=Affine2D()) # Does not work - the image is not
>> there!
>> fig.savefig('test1.png')
>>
> The image is there, it's just in the lower left corner of the figure,
> outside of the axes.
Note that the transform is a transform to the canvas coordinate (in
pixel scale).
-JJ
--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Basemap/ orthographic projection plot doesn't respect globe boundary
On 4/5/10 7:25 AM, Will Hewson wrote: I should perhaps of explained my code (included in top post) a little better, the values in my attached file aren't on a regular grid to start with, I do a little bit of juggling as follows to get them into a regular grid: I'm firstly setting up my 2D grid of 0.5 degree lat lons, followed by identically sized grids of zeros for the data bin, and mean divisors: x = np.arange(-180, 180, 0.5); y = np.arange(-90, 90, 0.5) grid_lon, grid_lat = np.meshgrid(x,y) #regularly spaced 2D grid n_vals = np.zeros((360,720)) #mean divisor dat = np.zeros((360,720)) #2D grid of zeros I'm then taking my input data (e.g. the .plt file attached), and rounding the lat lons to the nearest 0 or 0.5: lon = (np.around(lon*2))/2 #round to nearest .0 or 0.5 lat = (np.around(lat*2))/2 #round to nearest .0 or 0.5 Then for each row in my input file where Z is greater than 0, I'm adding the n'th Z value to its corresponding position in the dat zeros array, and keeping a count of how many values are going into each cell in the mean divisor array: j=0 for i in slcol: if lon[j]< 0: grid_lon_ind = 360+(lon[j]*2) grid_lat_ind = 180+(lat[j]*2) else: grid_lon_ind = 360-(lon[j]*2) grid_lat_ind = 180+(lat[j]*2) if i> 0: dat[grid_lat_ind, grid_lon_ind] += i #add i'th value n_vals[grid_lat_ind, grid_lon_ind] += 1 #increase cell counter by 1 for each extra value j+=1 Finally the new dat array is divided by the mean divisor array to give me my mean Z values: dat = np.nan_to_num(dat/n_vals) I've done it this way as opposed to interpolating *properly* in order to (for instance) stop the values bleeding away from the edges of the satellite swath. Cheers, Will. Will: I made some slight modifications to your original script and it works fine with the ortho projection using either contourf on the original lat/lon grid or pcolormesh on the interpolated map projection grid. -Jeff Jeff Whitaker wrote: On 4/5/10 4:16 AM, Will Hewson wrote: Hey Jeff, It's somewhere between the two - the original satellite swath is converted to a regular 0.5 degree grid by truncating, binning, and averaging each point's lons and lats over the top of a 720 x 360 np.zeros array. the plotting still works fine for non ortho/ hemispherical projections, and I've no big problem with using global projections for the time being. Thanks for your help in the meantime anyway. Cheers, Will. Will: If it's a regular 0.5 degree lat/lon grid, it should work in transform_scalar. However, I don't see how to read the data in your test.plt file into a regular 360x720 grid. It seems to only contain the points in the swath with nonzero values. -Jeff Jeff Whitaker wrote: On 4/4/10 11:06 AM, Will Hewson wrote: Hi again Jeff et al... I've had a play around with the extra few lines of code - on paper this seems like it should solve the problems I'm experiencing. However, an error's being thrown up by the transform scalar function, as my lons and lats won't necessarily be increasing. The data I'm plotting is satellite data and so at the beginning and end of the orbit file lats go over the pole from 90 to -90, with a similar problem for the lons - whereby the data is taken across the satellite track. I've thought about sorting the data before passing it to transform_scalar but I'm always going to be left with the problem in either lats or lons. I've uploaded the file I'm currently working with this time. It's three columns of lons, lats and z values. Once again, many thanks for your help. Will. http://old.nabble.com/file/p28133659/test.plt test.plt Will: Is it a regular lat/lon grid or a satellite swath? If it's the latter, you can't use my solution. -Jeff -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX: (303)497-644
Re: [Matplotlib-users] Basemap/ orthographic projection plot doesn't respect globe boundary
Jeff, this is great, works fine - many thanks for all your help over the last few days, it really is appreciated. I'm trying to build the case within my office for switching over to Basemap from IDL, ironing out niggles like this is really useful in this respect. All the best, Will. Jeff Whitaker wrote: > > On 4/5/10 7:25 AM, Will Hewson wrote: >> I should perhaps of explained my code (included in top post) a little >> better, >> the values in my attached file aren't on a regular grid to start with, I >> do >> a little bit of juggling as follows to get them into a regular grid: >> >> I'm firstly setting up my 2D grid of 0.5 degree lat lons, followed by >> identically sized grids of zeros for the data bin, and mean divisors: >> >> x = np.arange(-180, 180, 0.5); y = np.arange(-90, 90, 0.5) >> grid_lon, grid_lat = np.meshgrid(x,y) #regularly spaced 2D grid >> n_vals = np.zeros((360,720)) #mean divisor >> dat = np.zeros((360,720)) #2D grid of zeros >> >> I'm then taking my input data (e.g. the .plt file attached), and rounding >> the lat lons to the nearest 0 or 0.5: >> >> lon = (np.around(lon*2))/2 #round to nearest .0 or 0.5 >> lat = (np.around(lat*2))/2 #round to nearest .0 or 0.5 >> >> Then for each row in my input file where Z is greater than 0, I'm adding >> the >> n'th Z value to its corresponding position in the dat zeros array, and >> keeping a count of how many values are going into each cell in the mean >> divisor array: >> >> j=0 >> for i in slcol: >>if lon[j]< 0: >> grid_lon_ind = 360+(lon[j]*2) >> grid_lat_ind = 180+(lat[j]*2) >>else: >> grid_lon_ind = 360-(lon[j]*2) >> grid_lat_ind = 180+(lat[j]*2) >>if i> 0: >> dat[grid_lat_ind, grid_lon_ind] += i #add i'th value >> n_vals[grid_lat_ind, grid_lon_ind] += 1 #increase cell counter by 1 >> for >> each extra value >>j+=1 >> >> Finally the new dat array is divided by the mean divisor array to give me >> my >> mean Z values: >> >> dat = np.nan_to_num(dat/n_vals) >> >> I've done it this way as opposed to interpolating *properly* in order to >> (for instance) stop the values bleeding away from the edges of the >> satellite >> swath. >> >> Cheers, >> >> Will. >> > > Will: I made some slight modifications to your original script and it > works fine with the ortho projection using either contourf on the > original lat/lon grid or pcolormesh on the interpolated map projection > grid. > > -Jeff >> >> Jeff Whitaker wrote: >> >>> On 4/5/10 4:16 AM, Will Hewson wrote: >>> Hey Jeff, It's somewhere between the two - the original satellite swath is converted to a regular 0.5 degree grid by truncating, binning, and averaging each point's lons and lats over the top of a 720 x 360 np.zeros array. the plotting still works fine for non ortho/ hemispherical projections, and I've no big problem with using global projections for the time being. Thanks for your help in the meantime anyway. Cheers, Will. >>> Will: If it's a regular 0.5 degree lat/lon grid, it should work in >>> transform_scalar. However, I don't see how to read the data in your >>> test.plt file into a regular 360x720 grid. It seems to only contain the >>> points in the swath with nonzero values. >>> >>> -Jeff >>> Jeff Whitaker wrote: > On 4/4/10 11:06 AM, Will Hewson wrote: > > >> Hi again Jeff et al... >> >> I've had a play around with the extra few lines of code - on paper >> this >> seems like it should solve the problems I'm experiencing. However, an >> error's being thrown up by the transform scalar function, as my lons >> and >> lats won't necessarily be increasing. The data I'm plotting is >> satellite >> data and so at the beginning and end of the orbit file lats go over >> the >> pole >> from 90 to -90, with a similar problem for the lons - whereby the >> data >> is >> taken across the satellite track. I've thought about sorting the data >> before >> passing it to transform_scalar but I'm always going to be left with >> the >> problem in either lats or lons. >> >> I've uploaded the file I'm currently working with this time. It's >> three >> columns of lons, lats and z values. >> >> Once again, many thanks for your help. >> >> Will. >> >> http://old.nabble.com/file/p28133659/test.plt test.plt >> >> >> > Will: Is it a regular lat/lon grid or a satellite swath? If it's the > latter, you can't use my solution. > > -Jeff > > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why
Re: [Matplotlib-users] Changing the font
I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. Thanks for the debug tip, I don't think posting the whole thing is necessary because this line seems to be the problem: findfont: Could not match :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. Returning C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf So I guess the font's missing from the folder. Can I add it somehow? Michael Droettboom-3 wrote: > > Can you set "verbose.level" to "debug-annoying" in your matplotlibrc > file, and then send the output to this list. That may help us track > down where the font lookup is failing. Also, what platform and version > of matplotlib are you running? > > Mike > > Alex S wrote: >> Hi, sorry I wasn't too clear... I changed that, but I don't seem to be >> able >> to choose between the different serif fonts, it just always gives me the >> default... >> >> >> >> Alex S wrote: >> >>> Hi there, >>> I'm trying to change the font default on my graph to New Century >>> Schoolbook. I'm trying to do this by editing the matplotlibrc file. >>> Unfortunately, although I'm able to change the font.family, I can't >>> figure >>> out how to make it use something other than the default in the family... >>> I tried changing the list further down to only include the font I want, >>> like this: >>> >>> font.serif : New Century Schoolbook #Bitstream Vera Serif, New >>> Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, >>> Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif >>> >>> (note I commented out the other fonts, just rearranging the list to put >>> New Century Schoolbook first didn't seem to work either) >>> >>> Could anyone tell me what I'm doing wrong? >>> Thanks a lot! >>> Alex >>> >>> >>> >> >> > > -- > Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Changing-the-font-tp28111472p28141094.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] EPS files with LaTeX are invalid
On Fri, Apr 2, 2010 at 11:20 AM, Michael Droettboom wrote: > It seems the relevant change is in r8102: "fix some issues in the bbox > after the postscript distiller is run". This change removed a commented > out call to ps2eps. I'm a bit out of my depth here as to why that > change was made, and why .eps files seemingly haven't been true .eps > files for a long time prior to that change. Anyone else? > To my best knowledge, the bbox of the eps output before r8102 was incorrect for some cases. r8102 was my attempt to fix some of the issues. The ps backend is quite complicated in how final output is produced (psfrag, distiller, pstoeps), and this often messes up the initially specified bbox and results in incorrect ones. While I think I fixed some of the issues, there still could be some left. And I hope someone who is more knowledgeable than me take a look. For the reported issue, I haven't take a time to investigate (but I will soon), but I doubt if it is an issue of pstoeps function (as I said, it seems to write a matching save-restore pair). Regards, -JJ -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Changing the font
It would still be helpful to see the whole listing (send it to me offlist) because that will indicate where fonts are being looked for, and hopefully *why* this is failing. It should search for fonts in the standard Windows location (usually C:\Windows\Fonts). Have you tried setting font.family to "New Century Schoolbook" directly? (I wonder if the secondary lookup is failing). Cheers, Mike Alex S wrote: > I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. > Thanks for the debug tip, I don't think posting the whole thing is necessary > because this line seems to be the problem: > > findfont: Could not match > :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. > Returning > C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf > > So I guess the font's missing from the folder. Can I add it somehow? > > > > Michael Droettboom-3 wrote: > >> Can you set "verbose.level" to "debug-annoying" in your matplotlibrc >> file, and then send the output to this list. That may help us track >> down where the font lookup is failing. Also, what platform and version >> of matplotlib are you running? >> >> Mike >> >> Alex S wrote: >> >>> Hi, sorry I wasn't too clear... I changed that, but I don't seem to be >>> able >>> to choose between the different serif fonts, it just always gives me the >>> default... >>> >>> >>> >>> Alex S wrote: >>> >>> Hi there, I'm trying to change the font default on my graph to New Century Schoolbook. I'm trying to do this by editing the matplotlibrc file. Unfortunately, although I'm able to change the font.family, I can't figure out how to make it use something other than the default in the family... I tried changing the list further down to only include the font I want, like this: font.serif : New Century Schoolbook #Bitstream Vera Serif, New Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, Bookman, Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif (note I commented out the other fonts, just rearranging the list to put New Century Schoolbook first didn't seem to work either) Could anyone tell me what I'm doing wrong? Thanks a lot! Alex >>> >>> >> -- >> Michael Droettboom >> Science Software Branch >> Operations and Engineering Division >> Space Telescope Science Institute >> Operated by AURA for NASA >> >> >> -- >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> ___ >> Matplotlib-users mailing list >> [email protected] >> 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 -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] legend markerscale does not work
On Sun, Apr 4, 2010 at 2:56 AM, Levi Kilcher wrote: > And what the heck are the line objects in the legend? Are there > separate marker objects that I am missing? > Yes. l = legend() l.get_lines()[0]._legmarker.set_ms(5) The line objects in the legend handles have a _legmarker attribute which is another line objects responsible for drawing markers. This was necessary for such cases like when number of marker is 1. But, still, I recommend you to stick with your workaround, which is a preferred way. Regards, -JJ -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Changing the font
Ah ok, I've sent it on to you. I've just tried setting font.family to "New Century Schoolbook" directly but it generates something similar. I'm starting to think part of the problem is that I've set the home directory to U: somehow, U: being a shared drive which doesn't have a font directory... I don't know how I set this, it's not mentioned in the rc file anywhere that I can see... Michael Droettboom-3 wrote: > > It would still be helpful to see the whole listing (send it to me > offlist) because that will indicate where fonts are being looked for, > and hopefully *why* this is failing. > > It should search for fonts in the standard Windows location (usually > C:\Windows\Fonts). Have you tried setting font.family to "New Century > Schoolbook" directly? (I wonder if the secondary lookup is failing). > > Cheers, > Mike > > Alex S wrote: >> I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. >> Thanks for the debug tip, I don't think posting the whole thing is >> necessary >> because this line seems to be the problem: >> >> findfont: Could not match >> :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. >> Returning >> C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf >> >> So I guess the font's missing from the folder. Can I add it somehow? >> >> >> >> Michael Droettboom-3 wrote: >> >>> Can you set "verbose.level" to "debug-annoying" in your matplotlibrc >>> file, and then send the output to this list. That may help us track >>> down where the font lookup is failing. Also, what platform and version >>> of matplotlib are you running? >>> >>> Mike >>> >>> Alex S wrote: >>> Hi, sorry I wasn't too clear... I changed that, but I don't seem to be able to choose between the different serif fonts, it just always gives me the default... Alex S wrote: > Hi there, > I'm trying to change the font default on my graph to New Century > Schoolbook. I'm trying to do this by editing the matplotlibrc file. > Unfortunately, although I'm able to change the font.family, I can't > figure > out how to make it use something other than the default in the > family... > I tried changing the list further down to only include the font I > want, > like this: > > font.serif : New Century Schoolbook #Bitstream Vera Serif, > New > Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, > Bookman, > Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif > > (note I commented out the other fonts, just rearranging the list to > put > New Century Schoolbook first didn't seem to work either) > > Could anyone tell me what I'm doing wrong? > Thanks a lot! > Alex > > > > >>> -- >>> Michael Droettboom >>> Science Software Branch >>> Operations and Engineering Division >>> Space Telescope Science Institute >>> Operated by AURA for NASA >>> >>> >>> -- >>> Download Intel® Parallel Studio Eval >>> Try the new software tools for yourself. Speed compiling, find bugs >>> proactively, and fine-tune applications for parallel performance. >>> See why Intel Parallel Studio got high marks during beta. >>> http://p.sf.net/sfu/intel-sw-dev >>> ___ >>> Matplotlib-users mailing list >>> [email protected] >>> 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 > > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ___ > Matplotlib-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Changing-the-font-tp28111472p28141683.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users
Re: [Matplotlib-users] Changing the font
For the benefit of future users Googling this problem --> After an off-list discussion, we realized there were a couple of fonts on Alex' system with the names "Century Schoolbook" and "New Century Schoolbook LT Std". Using one of those names instead resolved the problem. Mike Alex S wrote: > Ah ok, I've sent it on to you. I've just tried setting font.family to "New > Century Schoolbook" directly but it generates something similar. I'm > starting to think part of the problem is that I've set the home directory to > U: somehow, U: being a shared drive which doesn't have a font directory... > I don't know how I set this, it's not mentioned in the rc file anywhere that > I can see... > > > Michael Droettboom-3 wrote: > >> It would still be helpful to see the whole listing (send it to me >> offlist) because that will indicate where fonts are being looked for, >> and hopefully *why* this is failing. >> >> It should search for fonts in the standard Windows location (usually >> C:\Windows\Fonts). Have you tried setting font.family to "New Century >> Schoolbook" directly? (I wonder if the secondary lookup is failing). >> >> Cheers, >> Mike >> >> Alex S wrote: >> >>> I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. >>> Thanks for the debug tip, I don't think posting the whole thing is >>> necessary >>> because this line seems to be the problem: >>> >>> findfont: Could not match >>> :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. >>> Returning >>> C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf >>> >>> So I guess the font's missing from the folder. Can I add it somehow? >>> >>> >>> >>> Michael Droettboom-3 wrote: >>> >>> Can you set "verbose.level" to "debug-annoying" in your matplotlibrc file, and then send the output to this list. That may help us track down where the font lookup is failing. Also, what platform and version of matplotlib are you running? Mike Alex S wrote: > Hi, sorry I wasn't too clear... I changed that, but I don't seem to be > able > to choose between the different serif fonts, it just always gives me > the > default... > > > > Alex S wrote: > > > >> Hi there, >> I'm trying to change the font default on my graph to New Century >> Schoolbook. I'm trying to do this by editing the matplotlibrc file. >> Unfortunately, although I'm able to change the font.family, I can't >> figure >> out how to make it use something other than the default in the >> family... >> I tried changing the list further down to only include the font I >> want, >> like this: >> >> font.serif : New Century Schoolbook #Bitstream Vera Serif, >> New >> Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, >> Bookman, >> Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif >> >> (note I commented out the other fonts, just rearranging the list to >> put >> New Century Schoolbook first didn't seem to work either) >> >> Could anyone tell me what I'm doing wrong? >> Thanks a lot! >> Alex >> >> >> >> >> > > > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] 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 >> >> >> -- >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> ___ >> Matplotlib-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> > > -- Michael Droettboom Science Software Branch Operations
Re: [Matplotlib-users] Changing the font
Yup, thanks for the help everyone Michael Droettboom-3 wrote: > > For the benefit of future users Googling this problem --> > > After an off-list discussion, we realized there were a couple of fonts > on Alex' system with the names "Century Schoolbook" and "New Century > Schoolbook LT Std". Using one of those names instead resolved the > problem. > > Mike > > Alex S wrote: >> Ah ok, I've sent it on to you. I've just tried setting font.family to >> "New >> Century Schoolbook" directly but it generates something similar. I'm >> starting to think part of the problem is that I've set the home directory >> to >> U: somehow, U: being a shared drive which doesn't have a font >> directory... >> I don't know how I set this, it's not mentioned in the rc file anywhere >> that >> I can see... >> >> >> Michael Droettboom-3 wrote: >> >>> It would still be helpful to see the whole listing (send it to me >>> offlist) because that will indicate where fonts are being looked for, >>> and hopefully *why* this is failing. >>> >>> It should search for fonts in the standard Windows location (usually >>> C:\Windows\Fonts). Have you tried setting font.family to "New Century >>> Schoolbook" directly? (I wonder if the secondary lookup is failing). >>> >>> Cheers, >>> Mike >>> >>> Alex S wrote: >>> I think I'm using MPL .99.1 (is there a command to check?) on Windows XP. Thanks for the debug tip, I don't think posting the whole thing is necessary because this line seems to be the problem: findfont: Could not match :family=serif:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0. Returning C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf So I guess the font's missing from the folder. Can I add it somehow? Michael Droettboom-3 wrote: > Can you set "verbose.level" to "debug-annoying" in your matplotlibrc > file, and then send the output to this list. That may help us track > down where the font lookup is failing. Also, what platform and > version > of matplotlib are you running? > > Mike > > Alex S wrote: > > >> Hi, sorry I wasn't too clear... I changed that, but I don't seem to >> be >> able >> to choose between the different serif fonts, it just always gives me >> the >> default... >> >> >> >> Alex S wrote: >> >> >> >>> Hi there, >>> I'm trying to change the font default on my graph to New Century >>> Schoolbook. I'm trying to do this by editing the matplotlibrc file. >>> Unfortunately, although I'm able to change the font.family, I can't >>> figure >>> out how to make it use something other than the default in the >>> family... >>> I tried changing the list further down to only include the font I >>> want, >>> like this: >>> >>> font.serif : New Century Schoolbook #Bitstream Vera Serif, >>> New >>> Century Schoolbook, Century Schoolbook L, Utopia, ITC Bookman, >>> Bookman, >>> Nimbus Roman No9 L, Times New Roman, Times, Palatino, Charter, serif >>> >>> (note I commented out the other fonts, just rearranging the list to >>> put >>> New Century Schoolbook first didn't seem to work either) >>> >>> Could anyone tell me what I'm doing wrong? >>> Thanks a lot! >>> Alex >>> >>> >>> >>> >>> >> >> >> > -- > Michael Droettboom > Science Software Branch > Operations and Engineering Division > Space Telescope Science Institute > Operated by AURA for NASA > > > -- > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ___ > Matplotlib-users mailing list > [email protected] > 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 >>> >>> >>> -- >>> Download Intel® Parallel Studio Eval >>> Try the new software tools for yourself. Speed compiling, find bugs >>> proactively, and fine-tune applications for parallel performance. >>> See why Intel Parallel Studio got high marks during beta. >>> http://p.sf.net/sfu/intel-sw-dev >>>
Re: [Matplotlib-users] speed up imports?
Michael Droettboom wrote: > All of those calls to "open" are being generated from the pytz import -- > which is why pytz seems like the likely candidate. Is it possible you > have pytz installed as a compressed egg, or on a remote disk, or > something that may be causing a file reading penalty? Mike, The pytz import time, at nearly 1/3 of the total mpl import time, is crazy even on linux, given that it adds only a tiny bit of functionality, and as far as I can see, even that is only rarely used. Therefore I have committed a change so that it is imported only if and when it is required. Our examples still work, after I modified one that was trying to import timezone from mpl.dates (although it was not actually using timezone). This probably illustrates the way in which this change may break some user code: user programs requiring pytz.timezone and pytz.tzinfo will have to import them directly instead of getting them from mpl.dates. I hope this is acceptable; importing them from mpl.dates seems like bad practice anyway, since mpl.dates was not using them or modifying them but was just passing them on from pytz. I suspect pytz could be redesigned so that it would not be so horrendously slow to import, but I am not going to tackle that. After the change: efir...@manini:~$ time python -c "import pylab" real0m0.441s user0m0.372s sys 0m0.064s Before the change: efir...@manini:~$ time python -c "import pylab" real0m0.626s user0m0.480s sys0m0.124s Again, this is recent linux on a 3-year-old laptop. Eric > > As Eric said, make sure you time the "import pytz" in a clean Python > session -- if a module is already imported in the Python interpreter, it > won't be reimported. > > Mike > > -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to overlay an image on a multi plot?
Alan, Thanks much for that link. I started playing with this code and after some hacking I might get what I need. If I cobble this together successfully I'll post the results and the code. Josh - Josh Hemann Statistical Advisor http://www.vni.com/ Visual Numerics jhemann at vni dizzot com -- View this message in context: http://old.nabble.com/How-to-overlay-an-image-on-a-multi-plot--tp28111498p28143553.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to overlay an image on a multi plot? (Edit: how to plot sparklines on an existing plot)
OK, I am in business. I read through the code that Alan linked to which helped me understand what to do, which does not involve overlaying any images. So, this thread is a dead end with respect to the original question. Here is the new graphic. http://old.nabble.com/file/p28144782/Full5%252B8%252B2_vs_Bulk1%252B2.png In a publication I think I would need to mention the date range for the sparklines. I like this, it is visually dense (marginal time series behavior, marginal density, and relationship between two variables) but does not seem cluttered. I'll post code tonight... - Josh Hemann Statistical Advisor http://www.vni.com/ Visual Numerics jhemann at vni dizzot com -- View this message in context: http://old.nabble.com/How-to-overlay-an-image-on-a-multi-plot--tp28111498p28144782.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to overlay an image on a multi plot? (Edit: how to plot sparklines on an existing plot)
On 4/5/2010 5:08 PM, Josh Hemann wrote: > Here is the new graphic. > > http://old.nabble.com/file/p28144782/Full5%252B8%252B2_vs_Bulk1%252B2.png > Nice. You might want to see http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001OR if you have not already. Alan Isaac -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Getting coordinates of the zoom rectangle
On Mon, Apr 5, 2010 at 3:17 PM, Mauro Cavalcanti wrote: > Dear Gökhan, > > Thanks for your reply, but unfortunately it was not entirely helpful. > > The rectangle_selector.py exemple indeed seems to do what I want, by > means of a callback function, however in the example program this > function should print the rectangle coordinates to the screen but it > does nothing. > > Check the shell where you called the script. It updates when select a region and release the mouse. > BTW, where is the documentation for the matplotlib.widgets classes? I > could find none. > Just browse the actual source .../lib/matplotlib/widgets.py. Classes are methods are nicely documented. I would suggest you to use IPython to access the docstrings with ease. import matplotlib.widgets as w w? w. > > Best regards, > > 2010/4/5 Gökhan Sever : > > > > > > On Mon, Apr 5, 2010 at 6:39 AM, Mauro Cavalcanti > wrote: > >> > >> Dear ALL, > >> > >> Good morning... Here is a question that may already have been asked > >> (and answered), but not to my knowledge. Matplotlib's figure windows > >> come with that handy navigation bar, which includes a Pan/Zoom button > >> and a Zoom-to-rectangle button. Once a zoom rectangle is defined on a > >> figure, is it possible to get the coordinates of it (that is, the > >> lower and upper corner coordinates which define the zoom rectangle)? > >> If so, how can this be done? > >> > >> Thanks in advance for any reply. > >> > >> With best regards, > >> > >> -- > >> Dr. Mauro J. Cavalcanti > >> P.O. Box 46521, CEP 20551-970 > >> Rio de Janeiro, RJ, BRASIL > >> E-mail: [email protected] > >> Web: http://sites.google.com/site/maurobio > >> Linux Registered User #473524 * Ubuntu User #22717 > > > > Hi, > > > > Search for zoom_window.py and rectangle_selector.py in your matplotlib > > examples directory. > > > > -- > > Gökhan > > > > > > -- > Dr. Mauro J. Cavalcanti > P.O. Box 46521, CEP 20551-970 > Rio de Janeiro, RJ, BRASIL > E-mail: [email protected] > Web: http://sites.google.com/site/maurobio > Linux Registered User #473524 * Ubuntu User #22717 > -- Gökhan -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How to overlay an image on a multi plot? (Edit: how to plot sparklines on an existing plot)
AlanIsaac wrote: > > Nice. > You might want to see > http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001OR > if you have not already. > > Alan Isaac > Thanks again Alan. I know I am abusing the term "sparkline" because I am not embedding the visualization within text, but I am not sure what else to call it. I do think that showing the time series not bound within a set of axes, without labels, underscores that the time series is a "quick hit", just like the histograms are. The main focus should be on the scatter plot, with the marginal visualizations there to aid in quick assessment of distribution and behavior over time. For true sparklines, here is http://bitworking.org/news/Sparklines_in_data_URIs_in_Python another nice example in Python . - Josh Hemann Statistical Advisor http://www.vni.com/ Visual Numerics jhemann at vni dizzot com -- View this message in context: http://old.nabble.com/How-to-overlay-an-image-on-a-multi-plot--tp28111498p28147118.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
