SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S

1
(16)
2
(22)
3
(28)
4
(17)
5
(17)
6
(7)
7
8
(15)
9
(28)
10
(26)
11
(28)
12
(19)
13
(5)
14
(3)
15
(21)
16
(28)
17
(11)
18
(18)
19
(6)
20
(5)
21
(18)
22
(11)
23
(22)
24
(28)
25
(17)
26
(17)
27
(7)
28
(16)
29
(24)
30
(25)
31
(14)



Showing 18 results of 18

From: Friedrich R. <fri...@gm...> - 2010年03月18日 22:14:06
2010年3月18日 Ciarán Mooney <gen...@go...>:
> value = (log(x)/log(largest))*255
Just two thoughts:
1) I doubt the statement cited above is not correct, as it may also
yield negative values as soon as 0 < x < 1. In fact, you are
calculating log_{largest}(x). This crosses zero for x = 1. What I
deem correct instead, is a linear mapping of the log space (logmin,
log(largest)) onto (0, 1). There logmin may be negative.
2) When matplotlib does the job, maybe use:
axes = fig.add_axes([0, 0, 1, 1])
axes.imshow(...)
This lets the axes fill the whole figure space, without margins. You
can also turn off the ticks if you want.
Friedrich
From: Friedrich R. <fri...@gm...> - 2010年03月18日 22:01:18
2010年3月4日 Timo Heine <tim...@gm...>:
> Basically what I want to do is to draw a horizontal line with relative y
> co-ordinates and absolute xmin and xmax co-ordinate. Then I could draw a
> line when a bit is high and have it always in plot area even when zooming
> etc. Like axhline(...) but with relative y and absolute x
> co-ordinates.
I found a better solution candidate now, but I don't know whether it works:
import matplotlib.transforms
import matplotlib.lines
<create Axes instance by calling fig.add_axes() or fig.add_subplot()>
trans = matplotlib.transforms.blended_transform_factory(axes.transData,
axes.transAxes)
line = matplotlib.lines.Line2D([xmin, xmax], [yrel, yrel], transform =
trans, <whatever like color = 'r'>)
line.y_isdata = False
axes.add_line(line)
The code is taken from axes.py:Axes.axhline() with some alterations.
Friedrich
From: Gökhan S. <gok...@gm...> - 2010年03月18日 20:26:40
On Thu, Mar 18, 2010 at 7:01 AM, Philippe Crave <phi...@gm...>wrote:
> Hello,
>
> the following will display a figure with a plot. the figure will embed
> the classic toolbar.
>
> import matplotlib.pyplot as plt
> import numpy as np
> x=np.arange(0, 1, 0.1)
> fig = plt.figure()
> ax = fig.add_subplot(111)
> ax.plot(x)
> plt.show()
>
> from there, is it possible to add new buttons to the toolbar ? with
> new fonction ?
> or do I have to embed everythong in wxPython, GTK or others ?
>
> thank you,
> Philippe
>
Hi Pierre Raybaut a nice extension for what you are asking. You will need to
use Qt4Agg backend to use it. The code is at
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/backends/qt4_editor/
He doesn't seem like planning to add more onto this extension (
http://code.google.com/p/spyderlib/issues/detail?id=136)
This said, his code is easy to read and you should easily be able to extend
it according to your need.
-- 
Gökhan
From: Sven D. <du...@as...> - 2010年03月18日 20:23:11
I tried to follow the instructions given on
http://blog.hyperjeff.net/?p=160
and modified the make.osx accordingly to compile matplotlib on OS X 10.6.2 (Snow Leopard).
But after executing 
sudo make -f make.osx fetch deps mpl_build mpl_install
I get the following error message:
I had compiled and installed tar from source, so it could be that my tar is missing a binding, but otherwise I could do "tar xfz <file.tar.gz>" on gzip files. zlib and bunzip2 are also installed on my system.
If I do a "cat make.osx | grep tar" to find the possible location of the error in the makefile, I only get:
	rm -rf zlib-${ZLIBVERSION}.tar.gz libpng-${PNGVERSION}.tar.bz2 \
	freetype-${FREETYPEVERSION}.tar.bz2 bdist_mpkg-${BDISTMPKGVERSION}.tar.gz \
	${PYTHON} -c 'import urllib; urllib.urlretrieve("http://www.zlib.net/zlib-${ZLIBVERSION}.tar.gz", "zlib-${ZLIBVERSION}.tar.gz")' &&\
	${PYTHON} -c 'import urllib; urllib.urlretrieve("http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-${PNGVERSION}.tar.bz2", "libpng-${PNGVERSION}.tar.bz2")' &&\
	${PYTHON} -c 'import urllib; urllib.urlretrieve("http://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPEVERSION}.tar.bz2", "freetype-${FREETYPEVERSION}.tar.bz2")'
	tar xvfz zlib-${ZLIBVERSION}.tar.gz &&\
	tar xvfj libpng-${PNGVERSION}.tar.bz2
	tar xvfj freetype-${FREETYPEVERSION}.tar.bz2 &&\
which doesn't give me any hint, since all this formats should be support.
Did anyone encounter this problem?
From: <tom...@gm...> - 2010年03月18日 19:41:58
Thanks, adding the axes ([0,0,1,1]) helped! 
:)
I'll just be careful so that my calculation domain 
is from 0 - 1 in x and y direction, this is something
I have to do anyway. This will definitely work!
Thanks again, 
Tomislav
----- Original Message -----
From: Friedrich Romstedt
Sent: 03/17/10 07:18 PM
To: tom...@gm...
Subject: Re: [Matplotlib-users] figure: centering data and plot.svg borders
Maybe:
from matplotlib import pyplot as plt
figureOne = plt.figure()
axesOne = figureOne.add_axes([0, 0, 1, 1])
axesOne.plot([-1, 1], [-2, 2])
axesOne.plot([-2, 2], [-1, 1])
axesOne.set_xlim((-3, 3))
axesOne.set_ylim((-3, 3))
figureOne.set_figwidth(2)
figureOne.set_figheight(2)
plt.savefig("Friedrich.png")
Friedrich
From: David <ld...@gm...> - 2010年03月18日 19:34:38
Dear Mike, dear list,
thanks for the continued help!
Here are my 'news':
On 18/03/10 22:22, Michael Droettboom wrote:
>> import matplotlib
>> matplotlib.use('GtkCairo')
>>
>> Incidentally, if I uncomment those two lines, then the (Western) font
>> of my graph actually changes.
> I'm completely stumped by this.
Just now I couldn't reproduce this. However, the fonts in the png and 
eps are quite different.
When I run my dea.py with the attached matplotlibrc, then I get both a 
png and an eps, however, the Chinese is still not rendered (see attachments)
I noticed the following in the ~rc:
cairo.format : png # png, ps, pdf, svg
But having it in or out makes no difference.
I
> do see in the matplotlibrc that you attached that the "TkAgg" backend is
> being specified, not "GtkCairo".
I changed this now.
>
> I am able to get the Cairo backend to work just fine using matplotlib
> 0.99.0. What version of cairo and pycairo do you have installed?
python-cairo: 1.8.6-1ubuntu1
In [15]: cairo.version
Out[15]: '1.8.6'
I wasn't able to find pycairo on my system (even after installing 
python-cairo-dev). I belive pycairo and python-cairo are in fact the 
same thing.
Google found this:
"Just for your info if your interested in programming with cairo on 
ubuntu. I wanted to add svg, ps and pdf support to cairo (the ubuntu 
packages don't support these cairo render backends yet.)"
https://wiki.ubuntu.com/CairoPythonUbuntu
Could this be the reason for my troubles (under Ubuntu)?
>>>> ps.fonttype=42
>>>> pdf.fonttype=42
>>
>> I haven taken those out again, because I got an error message.
> The error message may be related to using '=' rather than a ':'. In any
> case, these settings don't affect by the Cairo backend so should have no
> effect.
I changed the = for a colon, yielding a nasty message:
david@ubuntu:~/Documents/PhD/Dissertation/LaTeX/figures$ python dea.py
/usr/lib/pymodules/python2.6/matplotlib/__init__.py:653: UserWarning: 
Duplicate key in file "/etc/matplotlibrc", line #329
 warnings.warn('Duplicate key in file "%s", line #%d'%(fname,cnt))
Hopefully we will get to the bottom of this! I am sorry to bother you 
with all this -- and appreciate your efforts!
Greeting from Beijing,
David
From: Chloe L. <ch...@be...> - 2010年03月18日 18:30:05
Oh, nice.
I've been flagging particularly useful-looking answers on the 
matplotlib mailing list for a while; I have four or five hundred 
marked. I don't want to do all the cleanup to make them an inoculant 
for a new site, but perhaps they would be useful for people to do a 
few each or throw in their own favorites?
modulo concerns over attribution, etc
Chloe
On Mar 18, 2010, at 18 Mar, 10:20 AM, Gökhan Sever wrote:
> Hello,
>
> Please tolerate my impatience for being the first announcing the new 
> discussion platform :) and my cross-posting over the lists.
>
> The new site is beating at ask.scipy.org . David Warde-Farley is 
> moving the questions from the old-site at advice.mechanicalkern.com 
> (announced at SciPy09 by Robert Kern)
>
> We welcome you to join the discussions there. I have kicked-off the 
> new questions chain by http://ask.scipy.org/en/topic/11-what-is-your-favorite-numpy-feature
> (Also cross-posted at http://stackoverflow.com/questions/2471872/what-is-your-favorite-numpy-feature 
> to pull more attention to ask.scipy)
>
> Please share your questions and comments, and have fun with your 
> discussions.
>
> -- 
> Gökhan
> ------------------------------------------------------------------------------
> Download Intel&#174; 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
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Chloe Lewis
Graduate student, Amundson Lab
Ecosystem Sciences
137 Mulford Hall
Berkeley, CA 94720-3114
http://nature.berkeley.edu/~chlewis
From: --- <ran...@we...> - 2010年03月18日 17:42:46
Hello,
I am trying to plot multiple intersecting lines from a given 
array. In order to visualize the amount of crossing points I am
setting a certain alpha. However the crossings do not get darker as I
expected.
That is what I tried::
 import numpy as np
 import matplotlib.pyplot as plt
 x = np.random.randn(1000)
 y = np.random.randn(1000)
 plt.plot(x, y, alpha=.2, lw=1)
 plt.show()
What is the right way to do it?
Thanks & cheers,
Moritz
From: Gökhan S. <gok...@gm...> - 2010年03月18日 17:20:59
Hello,
Please tolerate my impatience for being the first announcing the new
discussion platform :) and my cross-posting over the lists.
The new site is beating at ask.scipy.org . David Warde-Farley is moving the
questions from the old-site at advice.mechanicalkern.com (announced at
SciPy09 by Robert Kern)
We welcome you to join the discussions there. I have kicked-off the new
questions chain by
http://ask.scipy.org/en/topic/11-what-is-your-favorite-numpy-feature
(Also cross-posted at
http://stackoverflow.com/questions/2471872/what-is-your-favorite-numpy-featureto
pull more attention to ask.scipy)
Please share your questions and comments, and have fun with your
discussions.
-- 
Gökhan
From: Ciarán M. <gen...@go...> - 2010年03月18日 15:10:28
Hi,
I am trying to create an image from an array using PIL, numpy and a
colourmap from matplotlib.
I got the colourmap by using ipython and the following code
colourmap = []
for i in xrange(256):
 r,g,b,a = cm.jet(i)
 r = int(round((r * 255),0))
 g = int(round((g * 255),0))
 b = int(round((b* 255),0))
 colourmap.append((r,g,b))
The following is used to plot an array:
def array2image(array, scale="log", filename="tmp"):
	
#	create image of the correct size
	new_image = Image.new("RGB", array.shape)
#	scan through a matrix and use Image.putdata() to put it in.
	x_size, y_size = array.shape
	largest = array.max()
	a_list = array.ravel()
	new_list = []
	
	for x in a_list:
		if x == 0:
			new_list.append((0,0,0))
		else:
			value = (log(x)/log(largest))*255
			value = int(round(value,0))
			value = blues_colourmap[value]
			#print value
			new_list.append(value)
	new_image.putdata(new_list)
	new_image.save(filename+".bmp")
The image that is outputted is certainly correct for the data, however
it is just no where near as "pretty" as the image you get from using
plt.imshow(am_array)
I'd like to get something that looks the same. I don't think the
problems are because of the colourmap but rather because of my log
scaling. Could someone please explain how matplotlib scales the image
to make it look so nice?
Regards,
Ciarán
From: Armin M. <arm...@st...> - 2010年03月18日 15:07:13
Hi,
you can create your supporting points on a regular r, phi grid and
transform them then to cartesian coordinates:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import numpy as np
from matplotlib import cm
from matplotlib import pyplot as plt
step = 0.04
maxval = 1.0
fig = plt.figure()
ax = Axes3D(fig)
# create supporting points in polar coordinates
r = np.linspace(0,1.25,50)
p = np.linspace(0,2*np.pi,50)
R,P = np.meshgrid(r,p)
# transform them to cartesian system
X,Y = R*np.cos(P),R*np.sin(P)
Z = ((R**2 - 1)**2)
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
ax.set_zlim3d(0, 1)
ax.set_xlabel(r'$\phi_\mathrm{real}$')
ax.set_ylabel(r'$\phi_\mathrm{im}$')
ax.set_zlabel(r'$V(\phi)$')
ax.set_xticks([])
plt.show()
hth
Armin
klukas schrieb:
> I'm guessing this is currently impossible with the current mplot3d
> functionality, but I was wondering if there was any way I could generate a
> 3d graph with r, phi, z coordinates rather than x, y, z? 
> 
> The point is that I want to make a figure that looks like the following:
> http://upload.wikimedia.org/wikipedia/commons/7/7b/Mexican_hat_potential_polar.svg
> 
> Using the x, y, z system, I end up with something that has long tails like
> this:
> http://upload.wikimedia.org/wikipedia/commons/4/44/Mecanismo_de_Higgs_PH.png
> 
> If I try to artificially cut off the data beyond some radius, I end up with
> jagged edges that are not at all visually appealing.
> 
> I would appreciate any crazy ideas you can come up with.
> 
> Thanks,
> Jeff
> 
> P.S. Code to produce the ugly jaggedness is included below:
> 
> -------------------------------------------------------
> from mpl_toolkits.mplot3d import Axes3D
> import matplotlib
> import numpy as np
> from matplotlib import cm
> from matplotlib import pyplot as plt
> 
> step = 0.04
> maxval = 1.0
> fig = plt.figure()
> ax = Axes3D(fig)
> X = np.arange(-maxval, maxval, step)
> Y = np.arange(-maxval, maxval, step)
> X, Y = np.meshgrid(X, Y)
> R = np.sqrt(X**2 + Y**2)
> Z = ((R**2 - 1)**2) * (R < 1.25)
> ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
> ax.set_zlim3d(0, 1)
> #plt.setp(ax.get_xticklabels(), visible=False)
> ax.set_xlabel(r'$\phi_\mathrm{real}$')
> ax.set_ylabel(r'$\phi_\mathrm{im}$')
> ax.set_zlabel(r'$V(\phi)$')
> ax.set_xticks([])
> plt.show()
> 
-- 
Armin Moser
Institute of Solid State Physics
Graz University of Technology
Petersgasse 16
8010 Graz
Austria
Tel.: 0043 316 873 8477
From: Jeff K. <kl...@wi...> - 2010年03月18日 15:00:34
The code below works perfectly. I think this should be included as an
mplot3d codex. I'll look into what's required to submit a new example
to the documentation.
Thanks Armin!
|| Jeff Klukas, Research Assistant, Physics
|| University of Wisconsin -- Madison
|| jeff.klukas@gmail | jeffyklukas@aim | jeffklukas@skype
|| http://www.hep.wisc.edu/~jklukas/
On Thu, Mar 18, 2010 at 9:42 AM, Armin Moser
<arm...@st...> wrote:
> Hi,
>
> you can create your supporting points on a regular r, phi grid and
> transform them then to cartesian coordinates:
>
> from mpl_toolkits.mplot3d import Axes3D
> import matplotlib
> import numpy as np
> from matplotlib import cm
> from matplotlib import pyplot as plt
> step = 0.04
> maxval = 1.0
> fig = plt.figure()
> ax = Axes3D(fig)
>
> # create supporting points in polar coordinates
> r = np.linspace(0,1.25,50)
> p = np.linspace(0,2*np.pi,50)
> R,P = np.meshgrid(r,p)
> # transform them to cartesian system
> X,Y = R*np.cos(P),R*np.sin(P)
>
> Z = ((R**2 - 1)**2)
> ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
> ax.set_zlim3d(0, 1)
> ax.set_xlabel(r'$\phi_\mathrm{real}$')
> ax.set_ylabel(r'$\phi_\mathrm{im}$')
> ax.set_zlabel(r'$V(\phi)$')
> ax.set_xticks([])
> plt.show()
>
> hth
> Armin
>
>
> klukas schrieb:
>> I'm guessing this is currently impossible with the current mplot3d
>> functionality, but I was wondering if there was any way I could generate a
>> 3d graph with r, phi, z coordinates rather than x, y, z?
>>
>> The point is that I want to make a figure that looks like the following:
>> http://upload.wikimedia.org/wikipedia/commons/7/7b/Mexican_hat_potential_polar.svg
>>
>> Using the x, y, z system, I end up with something that has long tails like
>> this:
>> http://upload.wikimedia.org/wikipedia/commons/4/44/Mecanismo_de_Higgs_PH.png
>>
>> If I try to artificially cut off the data beyond some radius, I end up with
>> jagged edges that are not at all visually appealing.
>>
>> I would appreciate any crazy ideas you can come up with.
>>
>> Thanks,
>> Jeff
>>
>> P.S. Code to produce the ugly jaggedness is included below:
>>
>> -------------------------------------------------------
>> from mpl_toolkits.mplot3d import Axes3D
>> import matplotlib
>> import numpy as np
>> from matplotlib import cm
>> from matplotlib import pyplot as plt
>>
>> step = 0.04
>> maxval = 1.0
>> fig = plt.figure()
>> ax = Axes3D(fig)
>> X = np.arange(-maxval, maxval, step)
>> Y = np.arange(-maxval, maxval, step)
>> X, Y = np.meshgrid(X, Y)
>> R = np.sqrt(X**2 + Y**2)
>> Z = ((R**2 - 1)**2) * (R < 1.25)
>> ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
>> ax.set_zlim3d(0, 1)
>> #plt.setp(ax.get_xticklabels(), visible=False)
>> ax.set_xlabel(r'$\phi_\mathrm{real}$')
>> ax.set_ylabel(r'$\phi_\mathrm{im}$')
>> ax.set_zlabel(r'$V(\phi)$')
>> ax.set_xticks([])
>> plt.show()
>>
>
>
> --
> Armin Moser
> Institute of Solid State Physics
> Graz University of Technology
> Petersgasse 16
> 8010 Graz
> Austria
> Tel.: 0043 316 873 8477
>
From: Michael D. <md...@st...> - 2010年03月18日 14:23:03
David wrote:
> Dear Michael,
>
> On 17/03/10 20:34, Michael Droettboom wrote:
>
>>> I have tried
>>>
>>> import matplotlib
>>> matplotlib.use('GtkCairo')
>>>
>>> as you suggested, but they had no effect whatsoever. Even the error
>>> output is the same.
>> I'm surprised that isn't having any effect. The Cairo backend should not
>> be running any code in backend_ps.py -- where the source of the error
>> is. If you put "backend: GtkCairo" in your matplotlibrc, does that work?
>
> No, in fact, after adding that line to matplotlibrc the CJK isn't even 
> rendered in the png anymore! *
>
> My error message has changed:
>
> In [1]: run dea.py
> /usr/lib/pymodules/python2.6/matplotlib/backends/backend_gtk.py:614: 
> DeprecationWarning: Use the new widget gtk.Tooltip
> self.tooltips = gtk.Tooltips()
This is just a warning, and a benign one. It is not an exception as before.
>
> (this with "backend: GtkCairo" in matplotlibrc and the following two 
> lines in my dea.py:
>
> import matplotlib
> matplotlib.use('GtkCairo')
>
> Incidentally, if I uncomment those two lines, then the (Western) font 
> of my graph actually changes.
I'm completely stumped by this. The font rendering does look slightly 
different in the Cairo backend vs. the Agg backends, but I wouldn't 
expect major differences -- the font choice itself should be the same. 
I do see in the matplotlibrc that you attached that the "TkAgg" backend 
is being specified, not "GtkCairo".
I am able to get the Cairo backend to work just fine using matplotlib 
0.99.0. What version of cairo and pycairo do you have installed?
>
>> What version of matplotlib are you running?
>
> In [2]: matplotlib.__version__
> Out[2]: '0.99.0'
>
>>> Note: in line 327 and 328 of the matplotlibrc I have added
>>>
>>> ps.fonttype=42
>>> pdf.fonttype=42
>
> I haven taken those out again, because I got an error message.
The error message may be related to using '=' rather than a ':'. In any 
case, these settings don't affect by the Cairo backend so should have no 
effect.
I think this is just a problem related to configuration. Once you get 
the Cairo backend selected (and confirm that is the case), then 
hopefully all will work.
Mike
>
> I continue to be at a loss!
>
> David
>
> * I had the same problem yesterday, I solved it by reinstalling a 
> backup of matplotlibrc. Weird.
>
>
>>>
>>> whereas I have uncommented
>>>
>>> pdf.fonttype : 3
>>>
>>> Any ideas? I would most welcome any hint and suggestion!
>> I don't think these settings will resolve the problem -- either font
>> type (42 or 3) still expects glyph names.
>>
>> Mike
>>>
>>>
>>>
>>>
>>> On 17/03/10 04:15, Michael Droettboom wrote:
>>>> The font you are using (SimHei) does not have any glyph names -- these
>>>> are used in the Postscript backend to refer to glyphs outside of the
>>>> ASCII range. More specifically, it looks like it has at least one
>>>> invalid glyph name (glyph names can only contain ASCII characters) --
>>>> loading it in FontForge complains about this. I haven't come across 
>>>> such
>>>> a font before, but maybe that's common in CJK fonts. I don't know. I'm
>>>> looking through the spec to find a way that glyphs can be referenced
>>>> without a name, but I'm not finding one. Note, the PDF backend has the
>>>> same issue.
>>>>
>>>> Do you have the same problem if you remove "SimHei" from the
>>>> font.sans-serif list and thus use "Adobe Song Std" instead? (I was 
>>>> able
>>>> to find an online download of SimHei to test with, but not Adobe Song
>>>> Std).
>>>>
>>>> As a workaround, the Cairo backend seems to handle this font just 
>>>> fine.
>>>> You can add
>>>>
>>>> import matplotlib
>>>> matplotlib.use('GtkCairo')
>>>>
>>>> to the top of your script.
>>>>
>>>> Mike
>>>>
>>>> David wrote:
>>>>> Hello everybody,
>>>>>
>>>>> I have a final problem with my graph. As a last step I produce an
>>>>> *.eps file that I use in conjunction with LaTeX.
>>>>>
>>>>> Here is the last part of my code:
>>>>>
>>>>> # plt.title('Title')
>>>>> xlab = plt.xlabel(u'输入 1')
>>>>> #xlab.set_position((0.2, 0.1))
>>>>> ylab = plt.ylabel(u'输入 2')
>>>>> plt.grid(True)
>>>>> plt.subplots_adjust(bottom=0.2)
>>>>> plt.show()
>>>>> plt.savefig('dea.eps')
>>>>>
>>>>>
>>>>> plt.show() produces the correct output,
>>>>>
>>>>> but
>>>>>
>>>>> plt.savefig('dea.eps') produces an error (the error message is
>>>>> attached).
>>>>>
>>>>> The error is clearly linked to the Chinese, as it runs through if I
>>>>> take the Chinese out of the code.
>>>>> Also, plt.savefig('dea.png') works fine.
>>>>>
>>>>> Could anyone indicate where I would have to look for the mistake? The
>>>>> matplotlibrc should be fine, but I am not sure.
>>>>>
>>>>> Your help would be greatly appreciated!
>>>>>
>>>>> Many thanks,
>>>>>
>>>>> David
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------ 
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------ 
>>>>>
>>>>>
>>>>>
>>>>> Download Intel&#174; 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
>>>>> Mat...@li...
>>>>> 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
From: Ben A. <BAx...@co...> - 2010年03月18日 14:17:39
I don't see a reason why this can't be implemented. It is probably pretty simple to change the surface plot code to use a polar grid instead of a rectangular grid. Of course this won't change the look of the rectangular axes, but maybe that is not a problem.
I invite you to take a shot at implementing this. You will find the mplot3d code pretty straightforward. (And a lot smaller than you might expect).
-Ben
-----Original Message-----
From: klukas [mailto:kl...@wi...] 
Sent: Wednesday, March 17, 2010 4:34 PM
To: mat...@li...
Subject: [Matplotlib-users] Polar 3D plot?
I'm guessing this is currently impossible with the current mplot3d functionality, but I was wondering if there was any way I could generate a 3d graph with r, phi, z coordinates rather than x, y, z? 
The point is that I want to make a figure that looks like the following:
http://upload.wikimedia.org/wikipedia/commons/7/7b/Mexican_hat_potential_polar.svg
Using the x, y, z system, I end up with something that has long tails like
this:
http://upload.wikimedia.org/wikipedia/commons/4/44/Mecanismo_de_Higgs_PH.png
If I try to artificially cut off the data beyond some radius, I end up with jagged edges that are not at all visually appealing.
I would appreciate any crazy ideas you can come up with.
Thanks,
Jeff
P.S. Code to produce the ugly jaggedness is included below:
-------------------------------------------------------
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import numpy as np
from matplotlib import cm
from matplotlib import pyplot as plt
step = 0.04
maxval = 1.0
fig = plt.figure()
ax = Axes3D(fig)
X = np.arange(-maxval, maxval, step)
Y = np.arange(-maxval, maxval, step)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = ((R**2 - 1)**2) * (R < 1.25)
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) ax.set_zlim3d(0, 1) #plt.setp(ax.get_xticklabels(), visible=False)
ax.set_xlabel(r'$\phi_\mathrm{real}$')
ax.set_ylabel(r'$\phi_\mathrm{im}$')
ax.set_zlabel(r'$V(\phi)$')
ax.set_xticks([])
plt.show()
--
View this message in context: http://old.nabble.com/Polar-3D-plot--tp27937798p27937798.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Download Intel&#174; 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
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Philippe C. <phi...@gm...> - 2010年03月18日 12:01:15
Hello,
the following will display a figure with a plot. the figure will embed
the classic toolbar.
import matplotlib.pyplot as plt
import numpy as np
x=np.arange(0, 1, 0.1)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x)
plt.show()
from there, is it possible to add new buttons to the toolbar ? with
new fonction ?
or do I have to embed everythong in wxPython, GTK or others ?
thank you,
Philippe
From: Werner F. B. <wer...@fr...> - 2010年03月18日 08:04:23
Looking at set_ticks_position doc it says that "default" will reset 
ticks to be on both sides and labels on left, and set_label_position 
only allows for left or right.
Is there any way to have ticks and ticks labels on both left and right?
Werner
From: Gökhan S. <gok...@gm...> - 2010年03月18日 03:21:05
On Wed, Mar 17, 2010 at 9:29 PM, Vincent Davis <vi...@vi...>wrote:
> I am doing a fairly basic plot plot(ydata) but would like to condition the
> marker on another array, for example if I have ydata and markerdata then for
> markerdata > 0 use use a '+' and for markerdata <0 use a '-' and for
> markerdata = 0 '.'
>
> How do I do this?
>
This is my solution. The main idea is based on using numpy array masking.
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(100)
a = np.arange(-50,50)
plt.plot(x[a>0], a[a>0], "+")
plt.plot(x[a==0], a[a==0], ".")
plt.plot(x[a<0], a[a<0], "--")
plt.show()
-- 
Gökhan
From: Vincent D. <vi...@vi...> - 2010年03月18日 02:58:07
I am doing a fairly basic plot plot(ydata) but would like to condition the
marker on another array, for example if I have ydata and markerdata then for
markerdata > 0 use use a '+' and for markerdata <0 use a '-' and for
markerdata = 0 '.'
How do I do this?
 *Vincent Davis
720-301-3003 *
vi...@vi...
 my blog <http://vincentdavis.net> |
LinkedIn<http://www.linkedin.com/in/vincentdavis>

Showing 18 results of 18

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /