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


Showing 21 results of 21

From: PGM <pgm...@gm...> - 2006年08月03日 22:21:02
On Thursday 03 August 2006 17:44, Gregory Pi=F1ero wrote:
> So all you changed was to add in align=3D'center' ? I assume me using
> figure.gca() is equivalent to your use of ax?
Yes, gca() is "get the current axes object".
> Is it hard to upgrade to the latest version from svn? Any directions?
[From=20
'http://projects.scipy.org/neuroimaging/ni/wiki/DevelopmentInstallFedora']
svn co https://svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib=20
matplotlib-trunk
cd matplotlib-trunk
python setup.py build
sudo python setup.py install
cd ..
But Greg, if it's only for that, try to put an empty label in front of the=
=20
others:
figure.gca().set_yticklabels(('', 'Tom', 'Dick', 'Harry', 'Slim', 'Jim'))
That might do the trick
From: <gre...@gm...> - 2006年08月03日 21:45:02
On 8/3/06, John Hunter <jdh...@ac...> wrote:
> The following, with svn mpl, works. If it doesn't work for you, make
> sure to upgrade your matplotlib; note the use of "align" which is a
> fairly recent addition to mpl
>
> val = [2,5,3,6,3] # the bar lengths
> pos = arange(5)+.5 # the bar centers on the y axis
>
> p1 = figure.gca().barh(pos,val, align='center')
> ax = figure.gca()
> ax.set_yticks(pos)
> ax.set_yticklabels(('Tom', 'Dick', 'Harry', 'Slim', 'Jim'))
> ax.set_xlabel('Perfomance')
> ax.set_title('How fast do you want to go today?')
> canvas=FigureCanvasAgg(figure)
So all you changed was to add in align='center' ? I assume me using
figure.gca() is equivalent to your use of ax?
Is it hard to upgrade to the latest version from svn? Any directions?
-Greg
From: John H. <jdh...@ac...> - 2006年08月03日 21:39:27
>>>>> "Gregory" =3D=3D Gregory Pi=F1ero <gre...@gm...> writes:
 Gregory> On 8/3/06, John Hunter <jdh...@ac...>
 Gregory> wrote:
 >> >>>>> "Gregory" =3D=3D Gregory Pi=F1ero <gre...@gm...>
 >> writes:
 Gregory> bar centers on the y axis p1 =3D figure.gca().barh(pos,val)
 Gregory> figure.gca().set_yticks(pos)
 Gregory> figure.gca().set_yticklabels(('Tom', 'Dick', 'Harry',
 Gregory> 'Slim', 'Jim')) figure.gca().set_xlabel('Perfomance')
 Gregory> figure.gca().set_title('How fast do you want to go
 Gregory> today?') canvas=3DFigureCanvasAgg(figure) return canvas
 >>
 Gregory> I changed the code to above but it still gives a similair
 Gregory> result.
The following, with svn mpl, works. If it doesn't work for you, make
sure to upgrade your matplotlib; note the use of "align" which is a
fairly recent addition to mpl
 val =3D [2,5,3,6,3] # the bar lengths
 pos =3D arange(5)+.5 # the bar centers on the y axis
 =20
 p1 =3D figure.gca().barh(pos,val, align=3D'center')
 ax =3D figure.gca()
 ax.set_yticks(pos)
 ax.set_yticklabels(('Tom', 'Dick', 'Harry', 'Slim', 'Jim'))
 ax.set_xlabel('Perfomance')
 ax.set_title('How fast do you want to go today?')
 canvas=3DFigureCanvasAgg(figure)
JDH
From: <gre...@gm...> - 2006年08月03日 21:27:44
Attachments: test.png
On 8/3/06, John Hunter <jdh...@ac...> wrote:
> >>>>> "Gregory" =3D=3D Gregory Pi=F1ero <gre...@gm...> writes:
> Gregory> bar centers on the y axis p1 =3D figure.gca().barh(pos,val)
 figure.gca().set_yticks(pos)
> Gregory> figure.gca().set_yticklabels(('Tom', 'Dick', 'Harry',
> Gregory> 'Slim', 'Jim')) figure.gca().set_xlabel('Perfomance')
> Gregory> figure.gca().set_title('How fast do you want to go
> Gregory> today?') canvas=3DFigureCanvasAgg(figure) return canvas
>
I changed the code to above but it still gives a similair result.
From: John H. <jdh...@ac...> - 2006年08月03日 21:13:56
>>>>> "Gregory" =3D=3D Gregory Pi=F1ero <gre...@gm...> writes:
 Gregory> bar centers on the y axis p1 =3D figure.gca().barh(pos,val)
 Gregory> figure.gca().set_yticklabels(('Tom', 'Dick', 'Harry',
 Gregory> 'Slim', 'Jim')) figure.gca().set_xlabel('Perfomance')
 Gregory> figure.gca().set_title('How fast do you want to go
 Gregory> today?') canvas=3DFigureCanvasAgg(figure) return canvas
In the example you are following, the code reads
 yticks(pos, ('Tom', 'Dick', 'Harry', 'Slim', 'Jim'))
This sets the ytick locations and labels. You are only setting the
locations, and so you are incorrectly placing a tick and label at 0.
You want
 ax.set_yticks(pos)
 ax.set_yticklabels(('Tom', 'Dick', 'Harry', 'Slim', 'Jim'))
JDH
From: <gre...@gm...> - 2006年08月03日 21:10:19
Attachments: test.png
Hi guys,
I can't figure out why my code below is generating the attached image.
 What am I doing wrong? I tried to copy
http://matplotlib.sourceforge.net/examples/barh_demo.py but also
convert it so I can use the AGG backend.
Any help is appriciated.
Greg Pinero
<code>
from __future__ import division
import cgi,cgitb
import os,sys
import datetime
import tempfile
import matplotlib
matplotlib.use('Agg') # force the antigrain backend
from matplotlib.dates import YearLocator, MonthLocator,
WeekdayLocator, DateFormatter, date2num
from matplotlib import rc
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
from matplotlib.cbook import iterable
import matplotlib.numerix as nx
from Numeric import arange #makes arrays
def start_chart(height,width):
 """Handles the parts of a chart that are common to all charts. """
 assert height>0 and width>0
 fig = Figure(figsize=(width,height))
 #add an axes at left, bottom, width, height; (in fractions of figure size)
 ax = fig.add_axes([0.2, 0.3, 0.7, 0.6])
 return fig
def make_sideways_bar_chart_proto(figure):
 """ """
 val = [2,5,3,6,3] # the bar lengths
 pos = arange(5)+.5 # the bar centers on the y axis
 p1 = figure.gca().barh(pos,val)
 figure.gca().set_yticklabels(('Tom', 'Dick', 'Harry', 'Slim', 'Jim'))
 figure.gca().set_xlabel('Perfomance')
 figure.gca().set_title('How fast do you want to go today?')
 canvas=FigureCanvasAgg(figure)
 return canvas
def test_routine():
 height,width=3,4
 figure=start_chart(float(height),float(width))
 canvas=make_sideways_bar_chart_proto(figure)
 canvas.print_figure('test.png', dpi=150)
if __name__=='__main__':
 test_routine()
</code>
From: <gre...@gm...> - 2006年08月03日 18:50:45
Ok, figured it out. My values had to be floats. They were strings.
Sorry for the trouble.
On 8/3/06, Gregory Pi=F1ero <gre...@gm...> wrote:
> Hi Fine Matplotlib folks,
>
> I'm getting this error message and I can figure it out:
>
> Traceback (most recent call last):
> ...
> File "C:\automated tasks\GMVIEW-DEV\chart_gen.debug.py", line 26, in ?
> p1 =3D figure.gca().barh(ind, ddata['value'], width, color=3D'r')
> File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 2499, in =
barh
> bottom =3D y - height/2.
> ValueError: frames are not aligned
>
> Here is the relevant code:
> <code>
> from __future__ import division
> import os,sys
> import datetime
> import tempfile
> import matplotlib
> matplotlib.use('Agg') # force the antigrain backend
> from matplotlib.dates import YearLocator, MonthLocator,
> WeekdayLocator, DateFormatter, date2num
> from matplotlib import rc
> from matplotlib.backends.backend_agg import FigureCanvasAgg
> from matplotlib.figure import Figure
> from matplotlib.cbook import iterable
> import matplotlib.numerix as nx
>
> ddata=3D{'label': ['REP1', 'REP2', 'REP3', 'REP4', 'REP5'], 'type':
> 'bar_sideways', 'value': ['23.00', '1381.56', '4606.69', '259.00',
> '50.00'], 'money_format': '1', 'title': 'Sales from 2006年08月01日 to
> 2006年08月02日'}
> height,width=3D3,4
> figure =3D Figure(figsize=3D(width,height))
> ax =3D figure.add_axes([0.2, 0.3, 0.7, 0.6])
> from Numeric import arange #makes arrays
> N=3Dlen(ddata['value'])
> ind =3D arange(N) # the x locations for the groups
> width=3D(figure.get_size_inches()[0]/len(ddata['value']))
> width_gap=3D(.3*width)
> width=3Dwidth-width_gap # the width of the bars
>
> #OFFENDING LINE
> p1 =3D figure.gca().barh(ind, ddata['value'], width, color=3D'r')
>
> figure.gca().set_ylabel('$Amount')
> if title:
> figure.gca().set_title('title', bbox=3D{'facecolor':'0.8', 'pad':5})
> locs =3D figure.gca().set_xticks(ind+width_gap)
> labels =3D figure.gca().set_xticklabels(ddata['label'])
> figure.gca().set_xlim(-width,len(ind))
> #try to autoscale here
> y_height=3Dmax(ddata['value'])+.2*max(ddata['value'])
> y_increment=3Dround(y_height/5,-1)
> figure.gca().set_yticks(arange(0,y_height,y_increment))
> canvas =3D FigureCanvasAgg(figure)
> </code>
>
> any help is greatly appriciated!
>
> --
> Gregory Pi=F1ero
> Chief Innovation Officer
> Blended Technologies
> (www.blendedtechnologies.com)
>
--=20
Gregory Pi=F1ero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)
From: <gre...@gm...> - 2006年08月03日 18:26:03
Hi Fine Matplotlib folks,
I'm getting this error message and I can figure it out:
Traceback (most recent call last):
...
 File "C:\automated tasks\GMVIEW-DEV\chart_gen.debug.py", line 26, in ?
 p1 =3D figure.gca().barh(ind, ddata['value'], width, color=3D'r')
 File "C:\Python24\Lib\site-packages\matplotlib\axes.py", line 2499, in ba=
rh
 bottom =3D y - height/2.
ValueError: frames are not aligned
Here is the relevant code:
<code>
from __future__ import division
import os,sys
import datetime
import tempfile
import matplotlib
matplotlib.use('Agg') # force the antigrain backend
from matplotlib.dates import YearLocator, MonthLocator,
WeekdayLocator, DateFormatter, date2num
from matplotlib import rc
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
from matplotlib.cbook import iterable
import matplotlib.numerix as nx
ddata=3D{'label': ['REP1', 'REP2', 'REP3', 'REP4', 'REP5'], 'type':
'bar_sideways', 'value': ['23.00', '1381.56', '4606.69', '259.00',
'50.00'], 'money_format': '1', 'title': 'Sales from 2006年08月01日 to
2006年08月02日'}
height,width=3D3,4
figure =3D Figure(figsize=3D(width,height))
ax =3D figure.add_axes([0.2, 0.3, 0.7, 0.6])
from Numeric import arange #makes arrays
N=3Dlen(ddata['value'])
ind =3D arange(N) # the x locations for the groups
width=3D(figure.get_size_inches()[0]/len(ddata['value']))
width_gap=3D(.3*width)
width=3Dwidth-width_gap # the width of the bars
#OFFENDING LINE
p1 =3D figure.gca().barh(ind, ddata['value'], width, color=3D'r')
figure.gca().set_ylabel('$Amount')
if title:
 figure.gca().set_title('title', bbox=3D{'facecolor':'0.8', 'pad':5})
locs =3D figure.gca().set_xticks(ind+width_gap)
labels =3D figure.gca().set_xticklabels(ddata['label'])
figure.gca().set_xlim(-width,len(ind))
#try to autoscale here
y_height=3Dmax(ddata['value'])+.2*max(ddata['value'])
y_increment=3Dround(y_height/5,-1)
figure.gca().set_yticks(arange(0,y_height,y_increment))
canvas =3D FigureCanvasAgg(figure)
</code>
any help is greatly appriciated!
--=20
Gregory Pi=F1ero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)
From: Charlie M. <cw...@gm...> - 2006年08月03日 18:20:55
On 8/3/06, John Hunter <jdh...@ac...> wrote:
> >>>>> "Kenny" == Kenny Ortmann <ya...@em...> writes:
>
> Kenny> When pylab tries to call numerix\__init__.py it is trying
> Kenny> to figure out whether to call numpy, numeric, or numarray.
> Kenny> Since it defaults to numeric I've tried to change the
> Kenny> default to numpy, and that returned no luck.
>
> Find your matplotlib rc file -- it is probably in the folder
>
> C:\Documents and Settings\yourname\.matplotlib
>
> and edit it to change the "numerix setting" to "numpy". Eg,
>
> numerix : numpy # numpy, Numeric or numarray
Before you have to write back.... the latest matplotlib release only
works with numpy-0.9.8.
From: John H. <jdh...@ac...> - 2006年08月03日 18:11:43
>>>>> "Kenny" == Kenny Ortmann <ya...@em...> writes:
 Kenny> When pylab tries to call numerix\__init__.py it is trying
 Kenny> to figure out whether to call numpy, numeric, or numarray.
 Kenny> Since it defaults to numeric I've tried to change the
 Kenny> default to numpy, and that returned no luck.
Find your matplotlib rc file -- it is probably in the folder
 C:\Documents and Settings\yourname\.matplotlib 
and edit it to change the "numerix setting" to "numpy". Eg,
 numerix : numpy # numpy, Numeric or numarray
JDH
From: Kenny O. <ya...@em...> - 2006年08月03日 18:08:25
I am very new to matplotlib. Trying to start the <a
href="http://matplotlib.sourceforge.net/tutorial.html">tutorial, </a> the
very first script, the first line of the script, throws me this error. I
have installed scipy version 0.5.0 for windows, and numpy version 1.0b1
i followed the instructions and made sure to install numy version 1.0b1
first. I have also tried to uninstall scipy and drop back to the latest
0.4.9 version and had no luck. Does anyone know what I can do to fix this
error?
When pylab tries to call numerix\__init__.py it is trying to figure out
whether to call numpy, numeric, or numarray. Since it defaults to numeric
I've tried to change the default to numpy, and that returned no luck.
>>> from pylab import *
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "C:\PYTHON23\Lib\site-packages\pylab.py", line 1, in ?
 from matplotlib.pylab import *
 File "C:\PYTHON23\Lib\site-packages\matplotlib\pylab.py", line 196, in ?
 import cm
 File "C:\PYTHON23\Lib\site-packages\matplotlib\cm.py", line 5, in ?
 import colors
 File "C:\PYTHON23\Lib\site-packages\matplotlib\colors.py", line 33, in ?
 from numerix import array, arange, take, put, Float, Int, where, \
 File "c:\python23\lib\site-packages\matplotlib\numerix\__init__.py",
line 60,
in ?
 from Numeric import *
ImportError: No module named Numeric
>>>
From: John H. <jdh...@ac...> - 2006年08月03日 17:40:33
>>>>> "marek" == marek <md...@gm...> writes:
 marek> I need to make plots in which the axes and text labels
 marek> display in either English, Spanish, or Portuguese.
Does the unicode demo work for you?
http://matplotlib.sourceforge.net/examples/unicode_demo.py
JDH
From: John H. <jdh...@ac...> - 2006年08月03日 17:38:16
>>>>> "Daniel" == Daniel Poelzleithner <po...@po...> writes:
 Daniel> Hi, I'm developing a websuite for open meshed networks
 Daniel> written in django. I must admit, matplotlib and such was
 Daniel> kinda hard stuff to step into. Most examples and
 Daniel> documentation is only based on the pylab api, which isn't
 Daniel> well suited for my purpos, because Django runs best with
 Daniel> mod-python.
There are a few resources
 http://matplotlib.sourceforge.net/faq.html#OO
and 
 http://matplotlib.sourceforge.net/leftwich_tut.txt
and Ken McIvorhas converted many of the pylab examples to OO style (link?)
See also
 http://matplotlib.sourceforge.net/examples/pythonic_matplotlib.py
and 
 http://matplotlib.sourceforge.net/examples/webapp_demo.py
 Daniel> Anyways. I'm wrote a function which generates tiles for
 Daniel> google maps and those should be overlayers with
 Daniel> transparent background.
 Daniel> My code currently looks like this:
 Daniel> from matplotlib.toolkits.basemap import Basemap from
 Daniel> matplotlib.backends.backend_agg import FigureCanvasAgg as
 Daniel> FigureCanvas from matplotlib.figure import Figure
 Daniel> [...]
 Daniel> def mktopo(ll_lng, ll_lat, ur_lng, ur_lat, aspect,
 Daniel> filename, state): """Generates atopo tile for given
 Daniel> latitude/longitude pairs""" dpi = 64 fig = Figure() canvas
 Daniel> = FigureCanvas(fig) # what does this do ???
 Daniel> #fig.set_facecolor((1.0,1.0,0,0.0))
To make the figure background transparent, do:
 fig.figurePatch.set_alpha(0.0)
You can set the alpha channel of any matplotlib artist (Text, Line2D,
Rectangle, etc.). The two of most interest to you will be
 fig.figurePatch (a rectangle)
and 
 ax.axesPatch (ditto)
JDH
 
From: marek <md...@gm...> - 2006年08月03日 17:31:33
I need to make plots in which the axes and text labels display in
either English, Spanish, or Portuguese.
I have code that successfully adds the labels in English but when
using Spanish or Portuguese characters the labels show up mangled.
I then switched to trying to get the simple_plot.py example to work. Adding a:
# -*- coding: utf-8 -*-
to the top of the file and replacing the English text. Again with no success.
Has anyone had success in using matplotlib with unicode and
specifically the utf-8 encoding?
I am using the system in non-interactive mode with the Agg backend if
that could make a difference.
Any help is very appreciated!
--Marek
From: Steve S. <el...@gm...> - 2006年08月03日 16:35:34
Attachments: tick_test.py
Alexander Michael wrote:
> On 8/3/06, *Steve Schmerler* <el...@gm... <mailto:el...@gm...>> 
> wrote:
> 
> Hi all
> 
> How can I change the default behavior of the tick labeling from say
> 
> 1 2 3 4 x1e-5
> 
> to
> 
> 1e-5 2e-5 3e-5 4e-5 ?
> 
> My thesis supervisor wants it that way :(
> 
> cheers,
> steve
> 
> 
> There is problably a better way, but onne way is to set the label 
> formatter yourself:
> 
> import pylab
> import matplotlib
> 
> pylab.plot([1.0E-5,2.5E-5,3.0E-5], [1.0, 3.0, 2.0])
> 
> ax = pylab.gca()
> ax.xaxis.set_major_formatter(
> matplotlib.ticker.FormatStrForm
> atter('%g'))
> 
> pylab.show()
> 
> You can craft an arbitrarily constructed string by using 
> matplotlib.ticker.FuncFormatter
> instead of matplotlib.ticker.FormatStrFormatter.
> 
> Hope this helps,
> Alex
> 
Yes, after a look at the docs I found that FuncFormatter is what I
wanted. With the help of a little function (which I wrote some time ago)
that converts a float number into a raw string I can use FuncFormatter
straightforward (see attached file).
cheers,
steve
-- 
Random number generation is the art of producing pure gibberish as
quickly as possible.
From: Steve S. <el...@gm...> - 2006年08月03日 16:35:08
Darren Dale wrote:
> On Thursday 03 August 2006 11:59, Alexander Michael wrote:
>> On 8/3/06, Steve Schmerler <el...@gm...> wrote:
>>> Hi all
>>>
>>> How can I change the default behavior of the tick labeling from say
>>>
>>> 1 2 3 4 x1e-5
>>>
>>> to
>>>
>>> 1e-5 2e-5 3e-5 4e-5 ?
>>>
>>> My thesis supervisor wants it that way :(
>>>
>>> cheers,
>>> steve
>> There is problably a better way, but onne way is to set the label
>> formatter yourself:
>>
>> import pylab
>> import matplotlib
>>
>> pylab.plot([1.0E-5,2.5E-5,3.0E-5], [1.0, 3.0, 2.0])
>>
>> ax = pylab.gca()
>> ax.xaxis.set_major_formatter(
>> matplotlib.ticker.FormatStrFormatter('%g'))
> 
> Use OldScalarFormatter instead.
> 
OK, I'll try that one too ...
Thanks.
-- 
Random number generation is the art of producing pure gibberish as
quickly as possible.
From: Darren D. <dd...@co...> - 2006年08月03日 16:16:05
On Thursday 03 August 2006 11:59, Alexander Michael wrote:
> On 8/3/06, Steve Schmerler <el...@gm...> wrote:
> > Hi all
> >
> > How can I change the default behavior of the tick labeling from say
> >
> > 1 2 3 4 x1e-5
> >
> > to
> >
> > 1e-5 2e-5 3e-5 4e-5 ?
> >
> > My thesis supervisor wants it that way :(
> >
> > cheers,
> > steve
>
> There is problably a better way, but onne way is to set the label
> formatter yourself:
>
> import pylab
> import matplotlib
>
> pylab.plot([1.0E-5,2.5E-5,3.0E-5], [1.0, 3.0, 2.0])
>
> ax = pylab.gca()
> ax.xaxis.set_major_formatter(
> matplotlib.ticker.FormatStrFormatter('%g'))
Use OldScalarFormatter instead.
From: Alexander M. <lxa...@gm...> - 2006年08月03日 15:59:20
On 8/3/06, Steve Schmerler <el...@gm...> wrote:
>
> Hi all
>
> How can I change the default behavior of the tick labeling from say
>
> 1 2 3 4 x1e-5
>
> to
>
> 1e-5 2e-5 3e-5 4e-5 ?
>
> My thesis supervisor wants it that way :(
>
> cheers,
> steve
>
There is problably a better way, but onne way is to set the label formatter
yourself:
import pylab
import matplotlib
pylab.plot([1.0E-5,2.5E-5,3.0E-5], [1.0, 3.0, 2.0])
ax = pylab.gca()
ax.xaxis.set_major_formatter(
 matplotlib.ticker.FormatStrFormatter('%g'))
pylab.show()
You can craft an arbitrarily constructed string by using
matplotlib.ticker.FuncFormatter
 instead of matplotlib.ticker.FormatStrFormatter.
Hope this helps,
Alex
From: Steve S. <el...@gm...> - 2006年08月03日 15:43:51
Hi all
How can I change the default behavior of the tick labeling from say
1 2 3 4 x1e-5
to
1e-5 2e-5 3e-5 4e-5 ?
My thesis supervisor wants it that way :(
cheers,
steve
-- 
Random number generation is the art of producing pure gibberish as 
quickly as possible.
From: Philip A. <pa...@eo...> - 2006年08月03日 03:46:13
Daniel Poelzleithner writes:
 > I'm developing a websuite for open meshed networks written in django. I
 > must admit, matplotlib and such was kinda hard stuff to step into. Most
 > examples and documentation is only based on the pylab api, which isn't
 > well suited for my purpos, because Django runs best with
 > mod-python.
Note Part II of this nice tutorial by Andrew Dalke:
http://www.dalkescientific.com/writings/diary/archive/2005/04/23/matplotlib_without_gui.html
Regards, Phil Austin
From: Daniel P. <po...@po...> - 2006年08月03日 00:46:52
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I'm developing a websuite for open meshed networks written in django. I
must admit, matplotlib and such was kinda hard stuff to step into. Most
examples and documentation is only based on the pylab api, which isn't
well suited for my purpos, because Django runs best with mod-python.
Anyways. I'm wrote a function which generates tiles for google maps and
those should be overlayers with transparent background.
My code currently looks like this:
from matplotlib.toolkits.basemap import Basemap
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
[...]
def mktopo(ll_lng, ll_lat, ur_lng, ur_lat, aspect, filename, state):
 """Generates atopo tile for given latitude/longitude pairs"""
 dpi = 64
 fig = Figure()
 canvas = FigureCanvas(fig)
 # what does this do ???
 #fig.set_facecolor((1.0,1.0,0,0.0))
 m =
Basemap(llcrnrlon=ll_lng,llcrnrlat=ll_lat,urcrnrlon=ur_lng,urcrnrlat=ur_lat,
 resolution='c',area_thresh=1000.,projection='merc',lat_ts=-8.0)
 m.ax = fig.add_axes([0, 0, 1, 1], axisbg=(1.0,1.0,0.0,0.0),
frameon=False )
 # 72 dpi
 # we need 256x256 pixel images
 fig.set_figsize_inches(256/dpi, 256/dpi)
 nodes = Node.objects.exclude(gps_position_lat=False)
 lats=[]
 lons=[]
 for node in nodes:
 lons.append(node.gps_position_lng)
 lats.append(node.gps_position_lat)
 #print node
 #a = m(node.gps_position_lat,node.gps_position_lng)
 #print a
 x,y = m(lons,lats)
 m.plot(x,y,'bo')
 canvas.print_figure(filename, dpi=dpi)
kindly regards
 Daniel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: GnuPT 2.7.2
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFE0Udmy/mkIQp7AD0RAtLGAJsGK23BKKCr7vAMIqjyuYdRlHdf7wCgnvCI
Oj32/fRh2SClDf7+dUaKQEM=
=6zWI
-----END PGP SIGNATURE-----

Showing 21 results of 21

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 によって変換されたページ (->オリジナル) /