The dpi value, which can be overridden, will determine the size of the
output image. It looks to me like you just want the output to always
be the same size as your input image, so use imsave() instead of
imshow() followed by savefig() for this:
i.e. just do
map = Basemap(..)
pilImg =
As you show it, mass will be a string, so you'll need to convert it to
a float first, then add it to a list. You can then manipulate the
values in the list to compute your mean, or whatever, which matplotlib
can use as input to its plot() function or whichever type of plot
you're after.
Thanks Eric and JJ,
Both of your answers are solutions to my problem actually.
I spent a while trying to figure this out and didn't get anywhere.
This was an exercise in frustration with matplotlib's documentation.
Thankfully this list and its members are here to save us. I assumed it
was just a
Usually imshow(arr, aspect='auto') or imshow(arr, aspect=2.0) will
display the image with pixels having some aspect ratio other than 1:1
However, I cannot get this to work when using imshow within an AxesGrid axis.
Is there a way to get an array shown with imshow() within an AxesGrid
axis to have
Hi Ben,
Comments inline...
On Fri, Jul 22, 2011 at 1:31 AM, Benjamin Root ben.r...@ou.edu wrote:
On Thu, Jul 21, 2011 at 1:10 AM, gary ruben gary.ru...@gmail.com wrote:
I'm trying to make a surface plot using the latest version of mplot3d
from the git trunk and I have a couple of questions
I haven't had a chance to look properly at the new mplot3d
improvements that Ben Root has been working on, but I wonder whether
it is easy now to set the axis properties so that the patches that
form the axes no longer have an alpha value of 0.5? I really want them
to be solid. The use case is
:
On Tue, Jul 19, 2011 at 9:25 PM, gary ruben gru...@bigpond.net.au wrote:
I haven't had a chance to look properly at the new mplot3d
improvements that Ben Root has been working on, but I wonder whether
it is easy now to set the axis properties so that the patches that
form the axes no longer
The pre-defined hsv colour map has this property - can you use that?
Otherwise, yes, it is possible to define any map you like.
Gary R
On Fri, Jul 8, 2011 at 12:55 PM, Ben Elliston b...@air.net.au wrote:
Hi.
I have a set of data with a range of (say) 0 to 100. Is it possible
to get
If you generate a big list of all the edges from the triangle data,
you should get repeat entries only for all the internal edges. You
could then find all the duplicates using this recipe
Um, how about r$80--120$ instead of r$80--120 ?
On Wed, Apr 6, 2011 at 9:56 AM, Sean Lake odysseus9...@gmail.com wrote:
Hello all,
I'm trying to specify a range of numbers in a particular legend using LaTeX.
In order to do so I'm feeding it the string: r$80--120. The output should
be have
I haven't seen this done before so I don't know if there's a standard
way. The idea seems to be to take some points which are real data,
create a random variable for each point with the points' position as
the mean, then choose some number of points from each distribution to
create some new points
You might want to try out the visvis module instead of matplotlib for
interactive viewing of large 2D images - my system is also Win64 with
4GB and visvis.imshow() handles a 4k*4k image. You'll probably also
want to disable ipython's object caching if you're doing a lot of this
interactive viewing
No problem. This caught me out a long time ago and has also caught out
a few people I know.
On Fri, Jan 14, 2011 at 8:23 PM, CASOLI Jules jules.cas...@cea.fr wrote:
Hooo, well done! This is it.
I didn't knew about caching...
I was indeed using ipython, but I did led some test using the basic
You're not doing this from ipython are you? It's cache hangs onto the
plot object references and stops python's garbage collector from
releasing them. If so, you can disable the cache as a workaround. A
better option would be if ipython implemented an option to avoid
caching references to
= asb.size_bar.get_children()[0]
mypatch.set_path_effects([Stroke(joinstyle='miter',
capstyle='butt')]) # override
joinstyle and capstyle
add_sizebar(plt.gca(), 0.5)
plt.draw()
plt.show()
On Mon, Dec 13, 2010 at 9:16 AM, gary ruben gru...@bigpond.net.au wrote
I've been helping a fairly new Python user (an astronomer using
numpy/scipy/matplotlib) in my office get up to speed with matplotlib and
thought I'd pass on a couple of small thoughts about the documentation
which we think would make life clearer for new users. I'm putting this
out for
Hi Tymoteusz,
I think this does what you want (see attached).
I'm not sure about 3D though.
Gary R.
Tymoteusz Jankowski wrote:
Hi!
Can anyone help me to achive this?
I'd like to plot rgb spectrum with matplotlib.
For example let the x axis be green element, and for example... let the y
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
I haven't tried it, but maybe it's to do with the fact that you're
quantising the colourmap to 256 values; I think matplotlib computes the
exact rgb values using interpolation. If the only reason you're using
PIL is to get a .bmp file, maybe you could save the file straight from
matplotlib as
Hi Nico,
I'm pretty sure the functionality is buried in there but unfortunately I
couldn't figure out how to put it into the imsave function, so for now I
think you have to resort to using PIL to do this.
Gary R.
Nico Schlömer wrote:
Hi,
I see that with imsave() it's possible to save an
I just installed the latest EPD 6.0.2 Python 2.6-based distribution in
WinXP. The mpl version is 0.99.1.1 and I installed basemap using the
basemap-0.99.4.win32-py2.6.exe binary installer. I'm getting this
traceback. Any ideas?
Gary
--
In [1]: from mpl_toolkits.basemap import Basemap
Hang on - I just noticed EPD says it contains basemap already, so maybe
installing over the top of it did something - I'll trying uninstalling
and doing a repair of EPD.
Gary
Gary Ruben wrote:
I just installed the latest EPD 6.0.2 Python 2.6-based distribution in
WinXP. The mpl version
OK, that worked. Sorry for the noise. I forgot basemap gets put under
site-packages/mpl_toolkits. When I installed a second copy using the
basemap binary installer, it went under site-packages and caused some
sort of conflict.
Gary
Gary Ruben wrote:
Hang on - I just noticed EPD says
I'm happy for it to remain just a suggestion and not a reality. I
mentioned it in case it was easy to implement alongside the color cycle
but it seems it is not. Thanks for considering it anyway Eric,
Gary
Eric Firing wrote:
Dominik Szczerba wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash:
One nice thing about gnuplot is the option its GUI provides to toggle
between using coloured lines and using black lines with various dashed
patterns. I think it would be nice in matplotlib to also be able to have
a default series of dashed patterns that could automatically be cycled
through.
Wayne Watson wrote:
I thought the console was the only way to use IPython. I go to
Start-Allprograms-IPython, and select IPython. Oh, I see *Console is
something of a replacement for the Win Cmd Console. Is there some site
that shows off it's features?
Not that I know of.
By the way, in
In Windows I recommend running iPython inside Console
http://sourceforge.net/projects/console/
particularly for its vastly improved copy and pasting.
Gary R.
phob...@geosyntec.com wrote:
Third Google result for copy paste in DOS prompt
Hi Michael,
Take a look at the quiver demo
http://matplotlib.sourceforge.net/examples/pylab_examples/quiver_demo.html
and the annotation2 demo
http://matplotlib.sourceforge.net/examples/pylab_examples/quiver_demo.html
More generally, have a look through the examples and gallery pages
IMO I don't think the traffic level on either pure mpl or basemap
warrants a split.
Gary R.
Dr. Phillip M. Feldman wrote:
It seems as though there are enough basemap-related posts that it might be
worth creating a separate basemap-specific sub-forum of the matplotlib
forum.
that
illustrates the problem - it tries to plot an icosahedron on the
Mollweide plot.
Gary R.
Jeff Whitaker wrote:
Gary Ruben wrote:
I'm plotting a coverage map of a sphere using the Mollweide plot in
basemap. The attachment is an example that is produced by sending an
array of polygons (one polygon per row
Hi Ariel,
You might find the attached function helpful here. Try creating a new
colormap using the example in the docstring (you could also try setting
high=0.8) - basically this will let you turn down the saturation which
will hopefully solve your problem. You may also find the plot option
Thank you Jeff. I'll try out this solution.
Gary.
Jeff Whitaker wrote:
snip
Gary: You might be able to use the _geoslib module to compute the
intersections of those polygons with the map boundary. I do a similar
thing with the coastline polygons in the _readboundarydata function.
Yes. Use interpolation='nearest' instead.
Gary R.
Michael Hearne wrote:
Running the test script below gives me the image I have attached, which
looks like it has been smoothed.
Does imshow perform some sort of smoothing on the data it displays? If
so, is there a way to turn this off?
Hi Per,
You need 2*N, not N*2 arrays here. I think you're also trying to use
absolute values so you probably need something like this:
plt.errorbar([1,2,3],[1,2,3],yerr=np.abs(a.T-[1,2,3]))
I hope this is what you're after,
Gary R.
per freem wrote:
hi all,
i am trying to plot asymmetric
gray() sets the default colormap for raster-based plot commands like
imshow(), matshow() and figimage(). For scatter(), you need to set the
colors of plot elements invidually. Setting the facecolor in the
scatter() command will work for the example you tried:
scatter(x,y,s=area, marker='^',
I haven't tried it myself, but this converter may do the trick. If it
works, can you report back? I'd be interested to know:
http://sk1project.org/modules.php?name=Productsproduct=uniconvertor
Gary R.
Shixin Zeng wrote:
Hi,
Could someone tell me what's the best format that matplotlib can
Hi Per,
The just-released mpl 0.99 contains Jae-Joon Lee's AxesGrid Toolkit
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html
and Andrew Straw's support for axis spines
http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html?highlight=spine
Many of the axes_grid examples in the thumbnail gallery don't work out
of the box with the latest matplotlib 0.99 because they rely on
demo_image and demo_axes_divider modules. Should these have been
packaged with 0.99 or were they left out deliberately?
Gary R.
Thanks John.
John Hunter wrote:
On Mon, Aug 10, 2009 at 5:05 AM, Gary Rubengru...@bigpond.net.au wrote:
Many of the axes_grid examples in the thumbnail gallery don't work out
of the box with the latest matplotlib 0.99 because they rely on
demo_image and demo_axes_divider modules. Should these
Is this an ideas thread?
How about a copy image to clipboard button for the toolbar.
Gary R.
Pierre GM wrote:
Eh, can I play ?
* Something I'd really like to see is a way to access a given patch/
line/collection/... by a string (a name) instead of having to find the
corresponding element
When I f.e. change
#xtick.labelsize : 14 (from '12')
#xtick.direction : out (from 'in')
Uncomment the lines.
#xtick.labelsize : 14
#xtick.direction : out
to
xtick.labelsize : 14
xtick.direction : out
Hi Etienne,
Sorry to hear about your disappointment. You can read about the attempt
to resurrect the 3D plotting capabilities here:
http://www.nabble.com/Updating-MPlot3D-to-a-more-recent-matplotlib.-td22302256.html
Unfortunately, this doesn't help you right now.
Depending on the type of 3D
Whilst agreeing with Kaushik's sentiments on the greatness of
matplotlib, I thought his example plot nicely illustrates a layout wart
that I think is easily fixed by changing the default xtick.major.pad,
xtick.minor.pad, ytick.major.pad and ytick.minor.pad values from 4 to 6.
As well as
versions of some of the GUI toolkits (notably gtk+). If you find
a script that produces a leak reproducibly, please share so we can track
down the cause.
Gary Ruben wrote:
Doing plot(rand(100)) or matshow(rand(1000,1000)) for example eats
a big chunk of memory (tried with TkAgg
Is there a summary somewhere of the current state of knowledge about
memory leaks when using the pylab interface interactively? Doing
plot(rand(100)) or matshow(rand(1000,1000)) for example eats a big
chunk of memory (tried with TkAgg and WxAgg in Windows (mpl v0.98.5.2)
and Linux (mpl
Hi all,
I've attached a candidate imsave() to complement imread() in the
image.py module. Would my use of pyplot instead of the oo interface
preclude its inclusion in image.py? Also, I noticed some problems when I
ran the tests with the Wx backends with mpl 0.98.5.2 in Win32. Both of
the Wx
Hi Norbert,
Both of your proposals (b) and (c) sound better to me than the current
behaviour, although they don't sound as obvious to me as simply
defaulting to always setting the mec to the line colour unless
overridden using mec=k - you could label this proposal (d).
Since others seem to
It just occurred to me that another option might be to simply add a new
colour option line for mec and mfc which would instruct them to pick
up the current line colour.
Gary
--
This SF.net email is sponsored by:
Has the mec always been black? I thought it used to be the same as the
line colour. I expected it to default to the line colour, as Che expected.
Gary R.
Norbert Nemec wrote:
Sorry for my misleading words - I did not correctly recall my own work
from back then...
In fact, the code as it
simple
selection without users having to search through the mailing list to
find Norbert's solution. If I was publishing a colour plot with line
markers I would definitely want to do this.
Gary
John Hunter wrote:
On Mon, Jan 26, 2009 at 6:17 AM, Gary Ruben wrote:
Has the mec always been black? I
I'm wondering whether someone can reproduce the following problem I'm
seeing in Ubuntu Intrepid.
I often use matplotlib to save images created with imshow to take
advantage of matplotlib's colour maps. I've noticed that the behaviour
is different for 0.98.3 between Windows XP-32 and Ubuntu
I just realised that the example I gave may not be the best since it's
not obvious what the autoscaling will do when all array values are
equal. Nevertheless, even when the array contains a range of values and
I use a greyscale colourmap, I'm seeing the leftmost pixel column set to
all white
Thanks for the rapid fix Mike.
regards,
Gary
Michael Droettboom wrote:
There is an explicit offset of one pixel on the left when it sets up a
clip box in Agg. I don't know why this is there, but it dates back to
0.98.0, and earlier versions did something completely different. I can
only
Hi Michael,
Michael Droettboom wrote:
Well, that was a good puzzle!
Glad I got your neurons firing.
This seems like a safe fix to me, but anyone who currently extends the
Wx Frame (meaning the whole window etc.) and is unknowingly compensating
for this effect may have problems after my
Gary Ruben wrote:
The attached test.py
Oops. Here it is.
Gary R.
import matplotlib as mpl
#~ mpl.use('PDF')
#~ mpl.use('Agg')
#~ mpl.use('TkAgg')
mpl.use('WXAgg')
#~ mpl.use('SVG')
#~ mpl.use('PS')
from pylab import *
pts = 128
rcFig = {'figsize': (2,1),
'dpi': pts
Just an idea: Maybe you could also auto cycle between dash types if only
the colour and not the dash type is specified in a plot command. The
gnuplot default would be one model, or the predefined patterns in
CorelDraw or Inkscape etc. Personally I don't see this as a high
priority though.
Hi Jibo,
I'm not sure of your reasons for wanting to do this, but you might find
the psychopy package of interest:
http://www.psychopy.org/
Gary R.
He Jibo wrote:
Hi, Everyone,
I want to create a scatter plot onto a background image. Anybody could
help me?Thank you!
The
Beautiful!
Many thanks John.
Gary R.
John Hunter wrote:
snip
You can manually turn off autoscaling on the axes instance with the
following, and both scatter and plot should then work as you want.
ax1 = subplot(121)
axis('off')
ax1.imshow(rand(20,20))
ax2 = subplot(122)
axis('off')
Hi listees,
I often generate plots using the pylab interface plot() function to
overlay an imshow() image. The minimal script below demonstrates a
problem, which may be a bug, or may be a deliberate change introduced
into mpl 0.91.1. It works fine with mpl 0.90.1 but gives a traceback
with
Retrying. Sorry if this appears twice.
Hi listees,
I often generate plots using the pylab interface plot() function to
overlay an imshow() image. The minimal script below demonstrates a
problem, which may be a bug, or may be a deliberate change introduced
into mpl 0.91.1. It works fine with mpl
IDL uses the Hershey vector fonts
http://www.ifi.uio.no/it/latex-links/STORE/opt/rsi/idl/help/online_help/Hershey_Vector_Font_Samples.html
The problem is that these are not trutype fonts, so the easiest solution
is probably to find some free sans-serif font that looks close to
Hershey on a free
Hi Mark,
this thread may help:
http://thread.gmane.org/gmane.comp.python.numeric.general/13399/focus=13421
Essentially, pylab uses a compatibility layer to ease the task of
supporting the three array packages - currently this uses the Numeric
version of the ones and zeros functions giving the
I have to agree with Giorgio in general. Unfortunately, the threading
support required by matplotlib isn't implemented in pyScripter, which
means that it's a nice environment until you want to do some plotting,
when it becomes a bit flaky. I haven't checked eclipse's behaviour with
matplotlib.
I just picked up a problem posted over on the numpy list. I noticed that
from pylab import * is importing the oldnumeric-wrapper versions of
zeros(), ones() and empty(), and presumably other things too, into the
interactive namespace. Shouldn't it be picking up the versions from
numpy's main
I haven't tried it, but my guess is the '\' character is the problem.
pylab.xlabel('10$^3$ M$_\odot$')
Try
pylab.xlabel(r'10$^3$ M$_\odot$')
^
Add raw string marker.
or maybe
pylab.xlabel('10$^3$ M$_\\odot$')
Gary R.
Nicolas Champavert wrote:
Hello,
I have
Sorry John,
I see this was fixed a while ago - I was still using 0.87.3 from the
last Enthought edition. Now that there's a scipy installer, I should
upgrade numpy/scipy/mpl to something more current.
Gary R.
Gary Ruben wrote:
While I think of it, I think the default zorder of legends should
There may be problems i.e. bugs in the eps and svg backends, as I often
try (sometimes unsuccessfully) to edit these in inkscape and/or
CorelDraw and sometimes, but not always, get 'badly formed eps file'
messages from Corel, or spurious lines appearing in svg files in
inkscape and Corel, for
While I think of it, I think the default zorder of legends should be
bigger so that, by default it overlays all plot lines and symbols.
Gary R.
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's
Perhaps NetworkX https://networkx.lanl.gov/ will do what you want,
depending on how much control you need over the node placement. There
are a few more suggestions for general graph plotting solutions here:
https://networkx.lanl.gov/wiki/Drawing.
hth
Gary R.
R. Padraic Springuel wrote:
Can
I see weird behaviour like this in Windows too. In my case, the
horizontal size of the plot window increases as the pointer is moved
inside a plot region. i.e. the aspect ratio of the window changes
erratically, I think between two sizes. Sometimes it remains at the
incorrect shape when the
from the windows explorer, it doesn't show up. On my win98
desktop, however, it shows up regardless.
Gary Ruben wrote:
Note: I just verified that this was introduced into 0.87.4.
0.87.3 doesn't exhibit the problem. See attachment.
Gary R.
[EMAIL PROTECTED] wrote:
The following minimal script
Note: I just verified that this was introduced into 0.87.4.
0.87.3 doesn't exhibit the problem. See attachment.
Gary R.
[EMAIL PROTECTED] wrote:
The following minimal script reveals a rendering problem with displaying a
histogram on a log vertical axis.
I'm using matplotlib0.87.4 in WinXP
I tried it out and it is fixed in the latest Enthought release 1.0.0beta4
Gary Ruben wrote:
Hi Rob,
A couple of us reported this last week on the scipy list and I think it
should be fixed in the version which was just released by Enthought, so
if your friend will persevere and grab
Hi Rob,
A couple of us reported this last week on the scipy list and I think it
should be fixed in the version which was just released by Enthought, so
if your friend will persevere and grab the latest version, it should be
OK - I hope to try it out today.
Gary R.
Rob Hetland wrote:
I am
Christopher Barker wrote:
To script that test, I need to be able to set numerix in a script,
rather than in matplotlibrc. Can that be done?
Yep, just do
from pylab import *
rcParams['numerix'] = 'numpy'
While we're at it, it would be great if ANY of the config items in
matplotlibrc could,
On this topic, here is something I used the other day (just some
different dash sequences):
e, = plot(x, y, 'k', label=r'$\theta_3=%1.2f$'%(th3))
setp(e, dashes={0:(1,0), 1:(2,2), 2:(10,4), 3:(10,4,4,4), 4:(10,2,2,2),
5:(15,2,6,2)}[i])
Maybe we should just blatantly copy the gnuplot sequence,
76 matches
Mail list logo