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





Showing 8 results of 8

From: Matt N. <new...@ca...> - 2005年02月16日 20:11:28
I haven't tried wxPython with Python2.4, but with WinXP, 
Python 2.3.2, wxPython 2.5.3.1, and matplotlib 0.72.0, 
 embedding_in_wx.py
 embedding_in_wx2.py
 embedding_in_wx3.py
all work ok for me. For completeness,
 embedding_in_wx4.py 
fails:
 Traceback (most recent call last):
 File "embedding_in_wx4.py", line 22, in ?
 from matplotlib.numerix import rand
 ImportError: cannot import name rand
but replacing
 from matplotlib.numerix import rand
with
 from matplotlib.numerix.random_array import random as rand
fixes that problem. I think embedding_in_wx4.py has some other
problems (Toolbar2 is not visible without a resize, the window
does not respond to all events, including closing the window),
but that's a separate topic.
I agree with John's assessment that the original poster probably
had a bad install of wx. Does the wx demo run ok?? Do any other
matplotlib examples run? If so, another suggestion would be to
try to replace MyApp(0) with PySimpleApp(0).
Hope that helps,
--Matt
From: Chris B. <Chr...@no...> - 2005年02月16日 19:17:35
John Hunter wrote:
> wx gurus, is app = MyApp(0) expected to work on wx-2.5.3 ?
I'm not sure, but
app = wx.GetApp()
should.
> Can anyone test this examples/embedding_in_wx3.py under a similar
> configuration?
I've been meaning to do this for ages, so I guess now's a good time. 
I'll report back if/when I get to it!
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
 		
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: John H. <jdh...@ac...> - 2005年02月16日 15:30:00
>>>>> "Bryan" == Bryan Cole <bry...@te...> writes:
 >>>> ax.xaxis.get_minor_formatter()
 Bryan> returns a NullFormatter (you would think it would return a
 Bryan> LogFormatter). This made me think that both major and
 Bryan> minor ticks were handled by the major formatter (which
 Bryan> distinguishes them based on it's internal isDecade() call).
Well, I use a NullFormatter because minor tick labels are turned off
by default. Otherwise the labels could get quite busy. Note that
there are 4 players here
 major and minor tick locators and
 major and minor tick formatters
The minor tick locator is a LogLocator which recognizes the subs --
the minor tick formatter by default is a NullFormatter. This places
tick lines and empty tick labels.
JDH
From: Bryan C. <bry...@te...> - 2005年02月16日 15:20:30
> 
> ax.xaxis.set_major_locator(majorLocator)
> ax.xaxis.set_major_formatter(majorFormatter)
> 
> #for the minor ticks, use no labels; default NullFormatter
> ax.xaxis.set_minor_locator(minorLocator)
> 
> From this you might guess ax.xaxis.set_minor_formatter.
> 
Yeay! Thanks for these pointers; it now works great.
Something that confused me is that for a log plot,
>>> ax.xaxis.get_minor_formatter()
returns a NullFormatter (you would think it would return a LogFormatter).
This made me think that both major and minor ticks were handled by the
major formatter (which distinguishes them based on it's internal
isDecade() call).
Anyway, thanks again for your help.
Bryan
From: John H. <jdh...@ac...> - 2005年02月16日 14:41:58
>>>>> "daniele" =3D=3D daniele <dga...@gm...> writes:
 daniele> Thank you very much for your advice. Unfortunately when
 daniele> I try to run the script I get:
 daniele> File
 daniele> "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scr=
iptutils.py",
 daniele> line 310, in RunScript exec codeObject in
 daniele> __main__.__dict__ File
 daniele> "C:\Python24\MathPlot_examples\examples\embedding_in_wx3.py"=
,
 daniele> line 156, in ? app =3D MyApp(0) File
 daniele> "C:\Python24\Lib\site-packages\wx-2.5.3-msw-ansi\wx\_core.py=
",
 daniele> line 5301, in __init__ self._BootstrapApp() File
 daniele> "C:\Python24\Lib\site-packages\wx-2.5.3-msw-ansi\wx\_core.py=
",
 daniele> line 4980, in _BootstrapApp return
 daniele> _core_.PyApp__BootstrapApp(*args, **kwargs) File
 daniele> "C:\Python24\MathPlot_examples\examples\embedding_in_wx3.py"=
,
 daniele> line 111, in OnInit self.panel =3D
 daniele> XRCCTRL(self.frame,"MainPanel") File
 daniele> "C:\Python24\Lib\site-packages\wx-2.5.3-msw-ansi\wx\xrc.py",
 daniele> line 203, in XRCCTRL return
 daniele> window.FindWindowById(XRCID(str_id)) AttributeError:
 daniele> 'NoneType' object has no attribute 'FindWindowById'
 daniele> Which frankly I don=B4t understand. Any further advice?
 daniele> Thank you, DG
This looks either like a wx version problem or a bad wx install.=20
wx gurus, is app =3D MyApp(0) expected to work on wx-2.5.3 ?
Can anyone test this examples/embedding_in_wx3.py under a similar
configuration?
JDH
From: John H. <jdh...@ac...> - 2005年02月16日 14:39:08
>>>>> "Robert" == Robert Leftwich <ro...@le...> writes:
 Robert> Is it possible to include a marker from one or more
 Robert> scatter plots in the legend? Robert
This is a bit tricky -- scatter plots can vary in size and color.
What should one use for the legend marker? So the short answer is no.
My question for you is, "how *should* it work?"
Not if you are using homogeneous marker sizes and colors, I suggest
using plot markers tweaking the properties, as in
 line, = plot(x,y,linestyle='None', marker='s', 
 markerfacecolor='red', markeredgecolor='g',
 markersize=20, markeredgewith=3)
or the pithy
 line, = plot(x, y, ls='None', marker='s', 
 mfc='red', mec='g', ms=20,, mew=3)
These you can add to the legend.
 legend((line,), ('label',))
In matplotlib-0.72, this will be as fast or faster than scatter for
the agg backend. Probably faster.
If this is not an option -- eg you need variation in size but not
color, you can use a line as a stand-in in your legend. Create the
line, don't add it to the axes, but pass it to the legend
 sizes = 20*rand(len(x))
 scatter(x,y,s=sizes, marker='o', c='red')
 # now create the proxy line but don't add it to axes for drawing
 line = Line2D(x,y,marker='o', color='red')
 legend((line,), ('label',))
This is untested, so let me know how it goes...
JDH
From: John H. <jdh...@ac...> - 2005年02月16日 14:32:23
>>>>> "Bryan" == Bryan Cole <bry...@te...> writes:
 Bryan> Is it possible to have labels on minor ticks, on log plots?
 Bryan> I've tried
 >>>> gca().get_major_formatter().label_minor(True)
 Bryan> but it doesn't work.
Just some advice on how to help you get to where you want to go. Have
you seen the matplotlib examples directory in the src distribution, at
http://matplotlib.sf.net/examples and zipped at
http://matplotlib.sourceforge.net/matplotlib_examples_0.72.zip ?
If you scroll through there, sometimes you see and example that will
help with the problem at hand. In this case major_minor_demo1.py,
major_minor_demo2.py, custom_ticker1.py, and log_demo.py will probably
all offer some insight. Though none explicitly address the problem at
hand, the would have shown you the right syntax to set minor
formatters. Eg from major_minor_demo1.py
 ax.xaxis.set_major_locator(majorLocator)
 ax.xaxis.set_major_formatter(majorFormatter)
 #for the minor ticks, use no labels; default NullFormatter
 ax.xaxis.set_minor_locator(minorLocator) 
From this you might guess ax.xaxis.set_minor_formatter.
Also, if you fire up a python shell, and get the type of ax.xaxis, you
can get more information
 >>> ax = subplot(111)
 >>> dir(ax.xaxis)
 >>> help(ax.xaxis.set_minor_formatter)
The class docs are also helpful here, eg the Axis docs at 
http://matplotlib.sourceforge.net/matplotlib.axis.html .
This is not meant as criticism or RTFM -- the docs are admittedly a
bit sparse -- just giving you some guidance to help you the next time.
Now on to your the problem at hand. Something like this...
 from pylab import *
 #formatter = LogFormatterMathtext(base=10, labelOnlyBase=False)
 minorFormatter = LogFormatter(base=10, labelOnlyBase=False)
 majorFormatter = LogFormatter(base=10, labelOnlyBase=True)
 ax = subplot(111)
 x = arange(1, 2000.0, 0.1)
 y = exp(-x/10)
 semilogx(x, y, subsx=(2,5)) # tick minors on 2s and 5s
 ax.xaxis.set_minor_formatter(minorFormatter)
 ax.xaxis.set_major_formatter(majorFormatter)
 show()
The LogFormatterMathtext does superscript tick formatting, eg 10^2.
This can look funny for minor ticks, because it does things like
10^{2.3} for 20.
You can of course, design your own formatter.....
 http://matplotlib.sf.net/matplotlib.ticker.html
Hope this helps,
JDH
From: Bryan C. <bry...@te...> - 2005年02月16日 13:13:02
Is it possible to have labels on minor ticks, on log plots?
I've tried 
>>> gca().get_major_formatter().label_minor(True)
but it doesn't work.
Any ideas?
Bryan

Showing 8 results of 8

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