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





Showing results of 346

<< < 1 .. 5 6 7 8 9 .. 14 > >> (Page 7 of 14)
From: Thomas R. <tho...@gm...> - 2009年11月19日 00:46:19
Attachments: fancyarrow.png
Hello,
I'm trying to plot two perpendicular arrows and getting them to start 
from the exact same point. If I try the following:
---
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as mpl
from matplotlib.patches import FancyArrowPatch
fig = mpl.figure()
ax = fig.add_subplot(111)
arrow1 = FancyArrowPatch(posA=(0.5, 0.5), posB=(0.6, 0.5), \
 arrowstyle='-|>', mutation_scale=20.)
arrow2 = FancyArrowPatch(posA=(0.5, 0.5), posB=(0.5, 0.6), \
 arrowstyle='-|>', mutation_scale=20.)
ax.add_patch(arrow1)
ax.add_patch(arrow2)
fig.savefig('fancyarrow.png')
---
then the result are two perpendicular arrows but the arrows don't 
touch at their origin (see attached image). Is there a way to fix this?
Cheers,
Tom
From: Michael D. <md...@st...> - 2009年11月18日 16:24:43
Sébastien Barthélemy wrote:
> Hello,
>
> I'm using the matplotlib Sphinx extension which automatically includes 
> the source
> code and the figures it produces into the Sphinx document. This is a 
> very handy
> feature whose use goes far beyond documenting matplotlib itself. 
> (thanks for that by the way)
>
> However I have trouble when the python file passed to the plot 
> directive contains
> non-ascii characters. I set up a simple example located there :
> http://github.com/sbarthelemy/SphinxEncoding
>
> running "make html" on it raises:
> Exception occurred:
> File "/usr/lib/pymodules/python2.6/sphinx/highlighting.py", line 
> 167, in highlight_block
> source = source.decode()
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 
> 37: ordinal not in range(128)
> The full traceback has been saved in /tmp/sphinx-err-5kW6ih.log, if 
> you want to report the issue to the author.
>
> So, I've got a few questions:
>
> - is this expected ?
> - is there a workaround ?
> - if not, how hard would it be to fix this problem, maybe I could help 
> a bit (with proper guidance).
>
> Thank you for any help !
>
> PS: I use sphinx 0.6.2-1 and matplotlib 0.99.0-1ubuntu1, both shipped 
> from ubuntu karmic
This is a bug -- but it has a fairly straightforward fix: to use 
Sphinx's "include" directive rather than roll our own as we currently 
do. This has been fixed in SVN r7972. plot-directive now takes an 
"encoding" option, exactly like the Sphinx include directive. It does 
not do automatic encoding detection (meaning it ignores the "# coding: 
latin1" comments), just as the Sphinx include directive does.
I'm not sure if there's a workaround "outside" of matplotlib, other than 
to ensure the source files are encoding in pure ascii (by using unicode 
escapes in literals instead of the real characters). But that's not a 
great workaround.
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Sébastien B. <bar...@cr...> - 2009年11月18日 14:19:36
Attachments: sphinx-err-5kW6ih.log
Hello,
I'm using the matplotlib Sphinx extension which automatically includes the
source
code and the figures it produces into the Sphinx document. This is a very
handy
feature whose use goes far beyond documenting matplotlib itself. (thanks for
that by the way)
However I have trouble when the python file passed to the plot directive
contains
non-ascii characters. I set up a simple example located there :
http://github.com/sbarthelemy/SphinxEncoding
running "make html" on it raises:
 Exception occurred:
 File "/usr/lib/pymodules/python2.6/sphinx/highlighting.py", line 167, in
highlight_block
 source = source.decode()
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 37:
ordinal not in range(128)
 The full traceback has been saved in /tmp/sphinx-err-5kW6ih.log, if you
want to report the issue to the author.
So, I've got a few questions:
- is this expected ?
- is there a workaround ?
- if not, how hard would it be to fix this problem, maybe I could help a bit
(with proper guidance).
Thank you for any help !
PS: I use sphinx 0.6.2-1 and matplotlib 0.99.0-1ubuntu1, both shipped from
ubuntu karmic
From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2009年11月18日 05:05:58
In gnuplot, I can do the following:
set format x "%.0s %cHz"
...and this will set the x-axis labels (on a semilogx style plot) to
be "10 Hz", "100 Hz", "1 kHz", "10 kHz", etc.
Is there an easy way to do this in matplotlib? I spent a while in the
matplotlib.ticker docs, but couldn't find anything.
Cheers,
Jason
From: John H. <jd...@gm...> - 2009年11月17日 23:33:49
On Tue, Nov 17, 2009 at 4:04 PM, Christopher Barker
<Chr...@no...> wrote:
> Peter McGregor wrote:
>> The problem with those examples is, when I comment the following line (for example in http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html):
>>
>>     self.add_toolbar() # comment this out for no toolbar
>>
>> then I have no possibility to make the window react to mouse events.
>
> Give wxMPL a try:
>
> http://agni.phys.iit.edu/~kmcivor/wxmpl/
>
> It handles some, if not all, of this for you.
>
> However, you bring up a good point, unless you have missed something --
> the code for the various interactive modes really should be separate
> from the toolbar that activates those modes.
Well, they are -- they all reside in the baseclass which the GUI
toolbars override. Peter can subclass
backend_bases.NavigationToolbar2 and make a custom toolbar. If a "is
a" relation doesn't work for him, with a little work he should be able
to do a "has a" with the baseclass.
JDH
From: Marius J. K. <mj...@ny...> - 2009年11月17日 22:16:53
> Marius Jan Klein <mjk524@ny...> writes:
>
>> I want to edit the metadata of pdf- or png-files when creating one of
>> these files. I do not want to use for example Pypdf because then
>> Python must read the file first before it can be edited.
>
> Concerning pdf files, there is no current support for that, 
>Jouni K. Seppänen <jks@ik...> writes:
>
>Now there is (in the trunk, revision 7964), via the PdfPages mechanism:
>
>>from matplotlib.backends.backend_pdf import PdfPages
>>from pylab import *
>>pdf = PdfPages('testing.pdf')
>>plot([3,1,4])
>>pdf.savefig()
>>d = pdf.infodict()
>>d['Title'] = 'Testing'
>>d['Author'] = u'Jouni K. Sepp\xe4nen'
>>pdf.close()
>
Thanks for your help concerning the pdf files! It was exactly what I was looking for. Is there anything similar for png-files?
From: Christopher B. <Chr...@no...> - 2009年11月17日 22:02:02
Peter McGregor wrote:
> The problem with those examples is, when I comment the following line (for example in http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html):
> 
> self.add_toolbar() # comment this out for no toolbar
> 
> then I have no possibility to make the window react to mouse events.
Give wxMPL a try:
http://agni.phys.iit.edu/~kmcivor/wxmpl/
It handles some, if not all, of this for you.
However, you bring up a good point, unless you have missed something -- 
the code for the various interactive modes really should be separate 
from the toolbar that activates those modes.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Peter M. <pet...@ya...> - 2009年11月17日 21:43:19
Thanks for your reply, but:
>See the embedding_in_wx examples at
>http://matplotlib.sourceforge.net/examples/user_interfaces/index.html.
The problem with those examples is, when I comment the following line (for example in http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html):
 self.add_toolbar() # comment this out for no toolbar
then I have no possibility to make the window react to mouse events.
>Take a look at the source code in matplotlib/backend_bases.py at the
>NavigationToolbar2 implementation to see how we manage the pan/zoom
>state, etc....
I see how the states are handled in NavigationToolbar2. But this would require that I rewrite the complete event handler. Or how do I tell the NavigationToolbar2 "You are now in pan state. Wait for the next mouse button press and then start panning the window."?
Thank you
Peter
________________________________
Von: John Hunter <jd...@gm...>
An: Peter McGregor <pet...@ya...>
CC: mat...@li...
Gesendet: Dienstag, den 17. November 2009, 22:25:42 Uhr
Betreff: Re: [Matplotlib-users] 'remote control' matplotlib window
On Tue, Nov 17, 2009 at 1:51 PM, Peter McGregor
<pet...@ya...> wrote:
> I have a question, how to control matplotlib from another application.
>
> Let me explain. We want to monitor some sensor data. The monitoring
> application already offers a toolbar to choose the view for several embedded
> windows. For example, buttons like "Reset view","Back/Forward", "Pan",
> "Zoom" and many more are available. The same functions that are shown in
> each TkAgg matplotlib window (like the six buttons in the bottom of
> http://postneo.com/pix/matplotlib.png, for example).
>
> Because we don't want to duplicate the buttons, we want to
> * Hide the buttons in the matplotlib window
> * Show only the plot without any decorations
> * Embed the matplotlib window into out wxPython application (this step is
> nice-to-have, but we can also work with another toplevel window, which is
> not embedded)
> * Finally, but most important: control from our wxPython application when to
> set the matplotlib window into Zoom/Pan/Rotate mode
>
> How can we implement the last step? Do we have to implement our own Backend?
> What we need is documented for Chaco in detail, but has it been done with
> matplotlib before? We prefer matplotlib because it is more advanced except
> for the UI integration.
See the embedding_in_wx examples at
http://matplotlib.sourceforge.net/examples/user_interfaces/index.html.
Take a look at the source code in matplotlib/backend_bases.py at the
NavigationToolbar2 implementation to see how we manage the pan/zoom
state, etc....
JDH
 
From: John H. <jd...@gm...> - 2009年11月17日 21:25:56
On Tue, Nov 17, 2009 at 1:51 PM, Peter McGregor
<pet...@ya...> wrote:
> I have a question, how to control matplotlib from another application.
>
> Let me explain. We want to monitor some sensor data. The monitoring
> application already offers a toolbar to choose the view for several embedded
> windows. For example, buttons like "Reset view","Back/Forward", "Pan",
> "Zoom" and many more are available. The same functions that are shown in
> each TkAgg matplotlib window (like the six buttons in the bottom of
> http://postneo.com/pix/matplotlib.png, for example).
>
> Because we don't want to duplicate the buttons, we want to
> * Hide the buttons in the matplotlib window
> * Show only the plot without any decorations
> * Embed the matplotlib window into out wxPython application (this step is
> nice-to-have, but we can also work with another toplevel window, which is
> not embedded)
> * Finally, but most important: control from our wxPython application when to
> set the matplotlib window into Zoom/Pan/Rotate mode
>
> How can we implement the last step? Do we have to implement our own Backend?
> What we need is documented for Chaco in detail, but has it been done with
> matplotlib before? We prefer matplotlib because it is more advanced except
> for the UI integration.
See the embedding_in_wx examples at
http://matplotlib.sourceforge.net/examples/user_interfaces/index.html.
 Take a look at the source code in matplotlib/backend_bases.py at the
NavigationToolbar2 implementation to see how we manage the pan/zoom
state, etc....
JDH
From: Peter M. <pet...@ya...> - 2009年11月17日 19:51:18
I have a question, how to control matplotlib from another application.
Let me explain. We want to monitor some sensor data. The monitoring application already offers a toolbar to choose the view for several embedded windows. For example, buttons like "Reset view","Back/Forward", "Pan", "Zoom" and many more are available. The same functions that are shown in each TkAgg matplotlib window (like the six buttons in the bottom of http://postneo.com/pix/matplotlib.png, for example).
Because we don't want to duplicate the buttons, we want to
* Hide the buttons in the matplotlib window
* Show only the plot without any decorations
* Embed the matplotlib window into out wxPython application (this step is nice-to-have, but we can also work with another toplevel window, which is not embedded)
* Finally, but most important: control from our wxPython application when to set the matplotlib window into Zoom/Pan/Rotate mode
How can we implement the last step? Do we have to implement our own Backend? What we need is documented for Chaco in detail, but has it been done with matplotlib before? We prefer matplotlib because it is more advanced except for the UI integration.
Please guide us in the right direction
Peter
 
From: Christopher B. <Chr...@no...> - 2009年11月17日 16:58:49
Pavlo Shchelokovskyy wrote:
 is there is a consistent
> way to scale at once thickness of everything drawn on figure, i.e.
> axis, plots, fonts?..
I think what you want is to set a dpi that works for you:
http://www.scipy.org/Cookbook/Matplotlib/AdjustingImageSize
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Pavlo S. <shc...@gm...> - 2009年11月17日 09:30:43
Hi all,
while I was using matplotlib mostly in interactive mode, the thickness
of lines displayed was OK for me, by now I want to generate a plot to
use on slides for beamer, and the thickness of all lines is totally
not sufficient, especially when using transparent figure/axis
background.
I know how to change the thickness of the line I've plotted, but was
unable to find how to change the thickness of y and x axes (not only
the ticks). Can it be done? Or even better, is there is a consistent
way to scale at once thickness of everything drawn on figure, i.e.
axis, plots, fonts?..
Thanks in advance,
Pavlo.
From: Eric F. <ef...@ha...> - 2009年11月16日 23:55:05
Brendan Arnold wrote:
> Hmm, after a little more work it seems that the problem is actually
> with the 'clabel' command. To expand on Eric's example,
> 
> x = arange(5)
> y = arange(7)
> X, Y = meshgrid(x,y)
> z = X+Y
> c=contour(X, Y, z, [5])
> clabel(c, inline=1)
> 
> (causes exceptions in a fresh ipython session)
> 
> clabel causes problems if only a single contour level is specified and returned.
> 
> Maybe this is a bug?
Fixed in svn 7970, 7971 (branch and trunk).
Eric
From: Manuel W. <man...@gm...> - 2009年11月16日 23:37:15
********Problem solved!**********
Thanks for all the tipps, but they didn't fix the problem. There never
was a problem with usecols or something. My mistake was, that I've
used the plot-script-file as the datainput-file, by accident.
Sorry for wasting your time with this.
I think it's too late (00:34 AM here), I have to go to bed and get
some sleep....
Manuel
2009年11月16日 Gökhan Sever <gok...@gm...>:
>
>
> On Mon, Nov 16, 2009 at 4:34 PM, Manuel Wittchen <man...@gm...>
> wrote:
>>
>> Hi,
>>
>> I'm trying to make my first matplotlib-plot from a datafile. The
>> datafile is tab-separated and looks like this:
>> # x-axis    y-axis
>> 0    1
>> 1    2
>> 2    3
>> 3    4
>> 4    5
>> 5    6
>>
>> So my ploting-script is:
>>
>> #!/usr/bin/env python
>> from pylab import *
>> import numpy as np
>>
>> inputfile = '/home/manu/matplotlib-examples/simple_plot.py'
>>
>> x,y = np.loadtxt(inputfile, dtype='float', comments='#',
>> delimiter="\t", converters=None, skiprows=0, usecols=(0,1),
>> unpack=True)
>> plot(x, y, linewidth=1.0)
>> xlabel('time (s)')
>> ylabel('voltage (mV)')
>> title('About as simple as it gets, folks')
>> grid(True)
>> show()
>>
>> It worked fine for me once, but as I tried to start the script again I
>> get an IndexError:
>>
>> Traceback (most recent call last):
>> File "./simple_plot.py", line 7, in <module>
>>  x,y = np.loadtxt(inputfile, dtype='float', comments='#',
>> delimiter="\t", converters=None, skiprows=0, usecols=(0,1),
>> unpack=True)
>> File "/usr/lib/python2.6/dist-packages/numpy/lib/io.py", line 486, in
>> loadtxt
>>  vals = [vals[i] for i in usecols]
>> IndexError: list index out of range
>>
>> Seems to me that usecols has "to much input" (don't know how to call
>> it), but why did it work before?
>
> This is an interesting behaviour. I don't exactly know why it happens as you
> described, but If you would like something working try this:
>
> Slightly modify your data file to be consistent --equal spaces or tabs
>
> x,y = np.loadtxt("data", dtype='float', delimiter=" ", skiprows=1).T
>
> As simple as it gets, the above line successfully loads the data.
>
> Give it a try...
>
>>
>> Manuel
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> Gökhan
>
From: Christopher B. <Chr...@no...> - 2009年11月16日 23:28:09
> On Fri, Nov 13, 2009 at 10:39 AM, Gregor Thalhammer
> <Gre...@i-...> wrote:
>> 1) I would like to stay independent of the backend, therefore I would
>> prefer a approach like in idle_and_timeout
>> http://matplotlib.sourceforge.net/examples/event_handling/idle_and_timeout.html
>> However, with my default backend WXAgg I do not continuously idle
>> events, but only once e.g. after each mouse movement. Can someone give
>> me more information about the intended behaviour, current status and
>> support of idle events?
Well, yes, that is how wx idle events work. I have no idea how any 
other toolkits do idle events. As a result, I've found that I never use 
EVT_IDLE with wx -- it just isn't useful, you get a whole bunch of them 
when someone is doing something like moving the mouse slowly, and none 
when the user is doing nothing.
What I have done is use a wx.Timer instead -- if you want something to 
happen when the user isn't doing anything, you can start a timer, and 
have it fire whenever you want. You can also have the timer started by 
an IDLE event, and have each subsequent IDLE event
I don't know if MPL has a Timer that wraps the GUI toolkit timers, but 
that may be a good idea.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Gökhan S. <gok...@gm...> - 2009年11月16日 23:17:38
On Mon, Nov 16, 2009 at 2:30 PM, John Didion <jd...@em...> wrote:
>
>
> I am trying to generate a figure of some genomic data. Basically, I want to
> show how many times a certain event happens within each one megabase window
> of each chromosome. The X axis is the chromosomal position (unit is
> megabases) and the Y axis is chromosome number (1-19, X, Y, M in mouse). For
> each chromosome, I want a subplot on which I will draw a bar graph. So
> basically, there will be 22 subplots, each with their own axes, and also X
> and Y axes for the entire figure.
>
> I know how to do subplots, I just don't know how to get the overall figure
> axes. Can anyone help?
>
> I will try to sketch out below with some ascii art what I want in case this
> description isn't clear.
>
>
> | ||||||||||| | | |||| |||| |
> 1 |--------------------------------------
> | |||| || ||||||| |||||
> 2 |--------------------------------------
> |
> . |
> ||||| || | | ||| |||| ||
> 19 |--------------------------------------
> | |||||| | ||| | | ||
> X |--------------------------------------
> || ||| |||||
> Y |--------------------------------------
> | || ||||| |||||
> M |--------------------------------------
> |
> --------------------------------------
> 0 50 100 150 200
> Megabases
>
>
> Thanks!
>
>
Spines should do what you are seeking after. Check the example:
http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html#pylab-examples-spine-placement-demo
> --
> John Didion
> Computational Biology, PhD Student
> Fernando Pardo-Manuel de Villena Lab
> UNC Chapel Hill
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
-- 
Gökhan
From: Gökhan S. <gok...@gm...> - 2009年11月16日 22:53:43
On Mon, Nov 16, 2009 at 4:34 PM, Manuel Wittchen
<man...@gm...>wrote:
> Hi,
>
> I'm trying to make my first matplotlib-plot from a datafile. The
> datafile is tab-separated and looks like this:
> # x-axis y-axis
> 0 1
> 1 2
> 2 3
> 3 4
> 4 5
> 5 6
>
> So my ploting-script is:
>
> #!/usr/bin/env python
> from pylab import *
> import numpy as np
>
> inputfile = '/home/manu/matplotlib-examples/simple_plot.py'
>
> x,y = np.loadtxt(inputfile, dtype='float', comments='#',
> delimiter="\t", converters=None, skiprows=0, usecols=(0,1),
> unpack=True)
> plot(x, y, linewidth=1.0)
> xlabel('time (s)')
> ylabel('voltage (mV)')
> title('About as simple as it gets, folks')
> grid(True)
> show()
>
> It worked fine for me once, but as I tried to start the script again I
> get an IndexError:
>
> Traceback (most recent call last):
> File "./simple_plot.py", line 7, in <module>
> x,y = np.loadtxt(inputfile, dtype='float', comments='#',
> delimiter="\t", converters=None, skiprows=0, usecols=(0,1),
> unpack=True)
> File "/usr/lib/python2.6/dist-packages/numpy/lib/io.py", line 486, in
> loadtxt
> vals = [vals[i] for i in usecols]
> IndexError: list index out of range
>
> Seems to me that usecols has "to much input" (don't know how to call
> it), but why did it work before?
>
This is an interesting behaviour. I don't exactly know why it happens as you
described, but If you would like something working try this:
Slightly modify your data file to be consistent --equal spaces or tabs
x,y = np.loadtxt("data", dtype='float', delimiter=" ", skiprows=1).T
As simple as it gets, the above line successfully loads the data.
Give it a try...
>
> Manuel
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Gökhan
From: Ryan M. <rm...@gm...> - 2009年11月16日 22:50:06
On Mon, Nov 16, 2009 at 4:34 PM, Manuel Wittchen
<man...@gm...> wrote:
> Hi,
>
> I'm trying to make my first matplotlib-plot from a datafile. The
> datafile is tab-separated and looks like this:
> # x-axis    y-axis
> 0    1
> 1    2
> 2    3
> 3    4
> 4    5
> 5    6
>
> So my ploting-script is:
>
> #!/usr/bin/env python
> from pylab import *
> import numpy as np
>
> inputfile = '/home/manu/matplotlib-examples/simple_plot.py'
>
> x,y = np.loadtxt(inputfile, dtype='float', comments='#',
> delimiter="\t", converters=None, skiprows=0, usecols=(0,1),
> unpack=True)
> plot(x, y, linewidth=1.0)
> xlabel('time (s)')
> ylabel('voltage (mV)')
> title('About as simple as it gets, folks')
> grid(True)
> show()
>
> It worked fine for me once, but as I tried to start the script again I
> get an IndexError:
>
> Traceback (most recent call last):
> File "./simple_plot.py", line 7, in <module>
>  x,y = np.loadtxt(inputfile, dtype='float', comments='#',
> delimiter="\t", converters=None, skiprows=0, usecols=(0,1),
> unpack=True)
> File "/usr/lib/python2.6/dist-packages/numpy/lib/io.py", line 486, in loadtxt
>  vals = [vals[i] for i in usecols]
> IndexError: list index out of range
>
> Seems to me that usecols has "to much input" (don't know how to call
> it), but why did it work before?
Check your data file. What you posted to the list is copy/pasting as
8 spaces for me, but you are specifying delimiter='\t'. I'd try just
not specifying delimiter or passing in delimiter=None.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Manuel W. <man...@gm...> - 2009年11月16日 22:34:52
Hi,
I'm trying to make my first matplotlib-plot from a datafile. The
datafile is tab-separated and looks like this:
# x-axis	y-axis
0	1
1	2
2	3
3	4
4	5
5	6
So my ploting-script is:
#!/usr/bin/env python
from pylab import *
import numpy as np
inputfile = '/home/manu/matplotlib-examples/simple_plot.py'
x,y = np.loadtxt(inputfile, dtype='float', comments='#',
delimiter="\t", converters=None, skiprows=0, usecols=(0,1),
unpack=True)
plot(x, y, linewidth=1.0)
xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
show()
It worked fine for me once, but as I tried to start the script again I
get an IndexError:
Traceback (most recent call last):
 File "./simple_plot.py", line 7, in <module>
 x,y = np.loadtxt(inputfile, dtype='float', comments='#',
delimiter="\t", converters=None, skiprows=0, usecols=(0,1),
unpack=True)
 File "/usr/lib/python2.6/dist-packages/numpy/lib/io.py", line 486, in loadtxt
 vals = [vals[i] for i in usecols]
IndexError: list index out of range
Seems to me that usecols has "to much input" (don't know how to call
it), but why did it work before?
Manuel
From: Eric F. <ef...@ha...> - 2009年11月16日 20:36:37
Brendan Arnold wrote:
> Hmm, after a little more work it seems that the problem is actually
> with the 'clabel' command. To expand on Eric's example,
> 
> x = arange(5)
> y = arange(7)
> X, Y = meshgrid(x,y)
> z = X+Y
> c=contour(X, Y, z, [5])
> clabel(c, inline=1)
> 
> (causes exceptions in a fresh ipython session)
> 
> clabel causes problems if only a single contour level is specified and returned.
> 
> Maybe this is a bug?
It certainly is. If no one comes up with a fix within a day or two, 
please file a ticket.
Eric
> 
> Kind regards,
> 
> Brendan
> 
> On Wed, Nov 4, 2009 at 6:01 PM, Eric Firing <ef...@ha...> wrote:
>> John Hunter wrote:
>>> On Wed, Nov 4, 2009 at 11:16 AM, Brendan Arnold <bre...@gm...>
>>> wrote:
>>>> Ah, I was a little confused by what you wrote John (I though I had to
>>>> access contour through the axes object and the meaning of R, F, dR was
>>>> a little unclear..) however using the 'levels' keyword now works. i.e.
>>>>
>>>> plt.contour(x, y, z, levels=[0])
>>>>
>>>> Incidentally, this keyword (levels) is not documented at
>>>>
>>>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.contour
>>>> and in fact the documentation implies that contour(kx, ky, z, [0])
>>>> should work when it does not.
>> But it does work, as it should:
>>
>> x = arange(5)
>> y = arange(7)
>> X, Y = meshgrid(x,y)
>> z = X+Y
>> contour(X, Y, z, [5])
>>
>>
>> Drop the above into "ipython -pylab".
>>
>> Eric
>>
>>>> Perhaps the docs could be updated to reflect this?
>>> Thanks for the heads up -- I updated the docstring in svn HEAD
>>>
>>> Sorry the original example was confusing -- I cut and pasted from some
>>> code I was working on, and forgot to import the mindreading module
>>>
>>> JDH
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>> 30-Day trial. Simplify your report design, integration and deployment - and
>>> focus on what you do best, core application coding. Discover what's new with
>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: John D. <jd...@em...> - 2009年11月16日 20:31:46
Attachments: jdidion.vcf
 
I am trying to generate a figure of some genomic data. Basically, I want to show how many times a certain event happens within each one megabase window of each chromosome. The X axis is the chromosomal position (unit is megabases) and the Y axis is chromosome number (1-19, X, Y, M in mouse). For each chromosome, I want a subplot on which I will draw a bar graph. So basically, there will be 22 subplots, each with their own axes, and also X and Y axes for the entire figure.
I know how to do subplots, I just don't know how to get the overall figure axes. Can anyone help?
I will try to sketch out below with some ascii art what I want in case this description isn't clear.
 | ||||||||||| | | |||| |||| | 
1 |--------------------------------------
 | |||| || ||||||| |||||
2 |--------------------------------------
 |
. |
 ||||| || | | ||| |||| ||
19 |--------------------------------------
 | |||||| | ||| | | ||
X |--------------------------------------
 || ||| |||||
Y |--------------------------------------
 | || ||||| |||||
M |--------------------------------------
 | 
 --------------------------------------
 0 50 100 150 200
 Megabases
Thanks!
--
John Didion
Computational Biology, PhD Student
Fernando Pardo-Manuel de Villena Lab
UNC Chapel Hill
From: Jeffrey F. <mat...@je...> - 2009年11月16日 19:52:31
Is there a way to define the label placements created by clabel? My problem
is that the location of the automatic labels are almost impossible to read
on my plot. I've tried adding "manual" to the call, but it doesn't seem to
work on my computer.
-Jeffrey
From: Brendan A. <bre...@gm...> - 2009年11月16日 19:14:34
Hmm, after a little more work it seems that the problem is actually
with the 'clabel' command. To expand on Eric's example,
x = arange(5)
y = arange(7)
X, Y = meshgrid(x,y)
z = X+Y
c=contour(X, Y, z, [5])
clabel(c, inline=1)
(causes exceptions in a fresh ipython session)
clabel causes problems if only a single contour level is specified and returned.
Maybe this is a bug?
Kind regards,
Brendan
On Wed, Nov 4, 2009 at 6:01 PM, Eric Firing <ef...@ha...> wrote:
> John Hunter wrote:
>>
>> On Wed, Nov 4, 2009 at 11:16 AM, Brendan Arnold <bre...@gm...>
>> wrote:
>>>
>>> Ah, I was a little confused by what you wrote John (I though I had to
>>> access contour through the axes object and the meaning of R, F, dR was
>>> a little unclear..) however using the 'levels' keyword now works. i.e.
>>>
>>> plt.contour(x, y, z, levels=[0])
>>>
>>> Incidentally, this keyword (levels) is not documented at
>>>
>>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.contour
>>> and in fact the documentation implies that contour(kx, ky, z, [0])
>>> should work when it does not.
>
> But it does work, as it should:
>
> x = arange(5)
> y = arange(7)
> X, Y = meshgrid(x,y)
> z = X+Y
> contour(X, Y, z, [5])
>
>
> Drop the above into "ipython -pylab".
>
> Eric
>
>>>
>>> Perhaps the docs could be updated to reflect this?
>>
>> Thanks for the heads up -- I updated the docstring in svn HEAD
>>
>> Sorry the original example was confusing -- I cut and pasted from some
>> code I was working on, and forgot to import the mindreading module
>>
>> JDH
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day trial. Simplify your report design, integration and deployment - and
>> focus on what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Donovan P. <don...@gm...> - 2009年11月16日 18:41:18
Hello,
I am hoping someone more familiar with matplotlib can tell me if it is
possible to customize an errorbar plot such that each marker has a
different colour. That is, I'd like to set the markerfacecolor
property of each marker in the errorbar plot. Is this possible? I've
been trying to figure out what the returned objects from errorbar are,
but haven't had any luck finding this documented anywhere.
Thanks for any and all help.
Cheers,
Donovan
From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2009年11月16日 15:57:46
John Hunter wrote:
> See
> 
> http://matplotlib.sourceforge.net/examples/api/watermark_image.html
> 
> for an example of embedding a watermark image in mpl.
> 
> 
> To compute figure size, multiply the DPI setting by the figure
> dimensions in inches:
This is a good place to start, so thanks :) I'll keep poking around, but
do you know if it's possible to get the location of the plot area
*within* the image? That is, the coordinates of the area within the axes?
Cheers,
Jason
11 messages has been excluded from this view by a project administrator.

Showing results of 346

<< < 1 .. 5 6 7 8 9 .. 14 > >> (Page 7 of 14)
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 によって変換されたページ (->オリジナル) /