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

Showing results of 226

<< < 1 2 3 4 5 6 .. 10 > >> (Page 4 of 10)
From: Clare S. <cla...@gm...> - 2012年06月19日 02:35:36
Hi Ben,
I tried including the date info into my data files as you suggested and it
works! Thank you very much for help.
Regards,
Clare.
On Mon, Jun 18, 2012 at 9:10 PM, Benjamin Root <ben...@ou...> wrote:
>
>
> On Mon, Jun 18, 2012 at 6:42 AM, Clare Soh <cla...@gm...>wrote:
>
>> Hi,
>>
>> I'm trying to plot some data against time using the following code:
>>
>> r = mlab.csv2rec(filename)
>> self.axis.plot(r.time, r.jb_sizems)
>> hfmt = dates.DateFormatter('%H:%M:%S.%f')
>> self.axis.xaxis.set_major_formatter(hfmt)
>> self.axis.set_title("JB Size")
>> self.axis.set_xlabel("Time")
>> self.axis.set_ylabel("JB Size(ms)", color='b')
>> self.axis.set_ylim(bottom=0)
>> for tl in self.axis.get_yticklabels():
>> tl.set_color('b')
>> self.axis.grid()
>> self.figure.autofmt_xdate()
>>
>> Everything works well, except for the cases when time ranges from before
>> 12am to after 12am. For example I have one csv file with time values
>> ranging from 23:04:09.367000 to 00:08:09.357000. By right I should see a 1
>> hour plot with x-axis ranging from 23:xx:xx.xxxxxx on the left to
>> 00:xx:xx.xxxxxx on the right, but I got a "24 hour" plot instead with
>> x-axis ranging from 00:xx:xx.xxxxxx on the left to 23:xx:xx.xxxxxx on the
>> right. My graph therefore appeared "chopped" into 2. Anybody knows how to
>> fix this?
>>
>> Regards,
>> Clare.
>>
>>
> Clare,
>
> Without a date, this can not be handled the way you want. You can either
> make it go from least to greatest or greatest to least. Using just hours,
> you will either have to increase from 00Z to 23Z, or decrease from 23Z to
> 00Z. If you can't get a date included into the data file, you will
> probably have to do some processing of your data to add some sort of "fake"
> date to it first. This can be very tricky to do correctly. Your best bet
> is to get your data files to report the date.
>
> I hope this helps!
> Ben Root
>
>
From: Daπid <dav...@gm...> - 2012年06月18日 23:18:35
Hello,
I am trying to type Erdős in the title of a figure. I am using the
LaTeX command Erd\H{o}s, as it works in normal latex documents both in
text and math mode, but it malfunctioning putting the two lines on the
d. To obtain the proper typeset, I have to write:
plt.title(r"$Erdo\H s$")
This behaviour is not the same as standard LaTeX.
Regards,
David.
From: Brendan B. <bre...@br...> - 2012年06月18日 19:25:12
On 2012年06月09日 15:18, pybokeh wrote:
 > Maybe workflow may not be the appropriate term. Essentially, when 
I want
 > to plot something using matplotlib, I find myself having to look up 
the api
 > docs or examples online because quite frankly, matplotlib's syntax 
is very
 > hard to remember. I use ipython and use tab browsing, help(), 
dir(), etc,
 > and that seem to help to some extent. I absolutely love 
matplotlib, but
 > when I want to put a chart up quickly, matplotlib is just a "hassle"
 > depending on what chart you want to create. I do expect this since
 > plotting with matplotlib, you are essentially creating a chart
 > "programmatically", instead of GUI interface environment. But still, I
 > feel like an improvement could still be made in making charts 
simpler with
 > matplotlib.
	Just wanted to mention that I've managed to get a good workflow going 
using DreamPie. I haven't seen much talk about DreamPie on here, but 
it's really useful for working with matplotlib. Although I haven't 
used ipython, I get the impression DreamPie is like a GUI version of 
that. It provides a two-window interface sort of like a chat or MUD 
client, with a separate editing window where you can enter code, and 
an output window where your code and results are displayed.
	Most importantly for present purposes, it's matplotlib-aware so you 
can use interactive plotting commands and have it "just work" (i.e., 
not hang the program as with IDLE). It also provides name-completion 
and docstring tooltips, making it easy to scan the docs for a 
particular function to refresh my memory about its arguments. 
DreamPie makes it pretty doable to make iterative tweaks to the same 
plotting code until I get it into a form that I want, at which point I 
can copy and paste it into a file for storage.
	I do think there are areas where matplotlib starts to get in its own 
way, in that its powerful features obscure the path toward simple 
goals. It seems like wrapper libs that provide a simpler interface 
(like I guess this Canvas thing you mentioned) could be useful for 
getting around that.
-- 
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is 
no path, and leave a trail."
 --author unknown
From: Andre' Walker-L. <wal...@gm...> - 2012年06月18日 14:36:02
> Most likely, there was a change to your matplotlibrc file. There is a setting in there for "interactive" and by default, it is set to False. If you uncomment it and set it to True, you should get back the behavior you expected. You can also explicitly set the interactive mode to True from your scripts with a "plt.ion()" call before loading your other modules.
> 
> I hope that helps!
Yes!!!
I don't recall changing that before (but that was 2+ years ago), so I didn't think to look for such a thing.
My google searches were also not precise enough.
So very helpful. I expected it was something simple like this, thanks.
Andre
From: Asbach, M. <mar...@ia...> - 2012年06月18日 14:31:01
Hi Joe, hi Daniel, 
Am 17.06.2012 um 19:31 schrieb Joe Kington:
> It sounds like you were using the right approach, you just got a bit lost on what some of the keyword parameters to annotate, etc do.
> 
> Here's an example that should do what you want:
> 
> import matplotlib.pyplot as plt
> from matplotlib.ticker import MultipleLocator
thanks a lot. Indeed, I guess that's what I needed. One other part of my problem was caused by stupidly copying example code without understanding what it does: I had set_smart_bounds(True) and wondered about the axis not beeing draw outside of data regions ;-)
> # Turn off the top, right, and bottom major and minor ticks (as in your sketch)
> ax.tick_params(which='both', top=False, right=False, bottom=False, 
> labelbottom=False)
> Hope that helps!
Indeed, it did!
Again, thanks a lot,
Mark
From: Benjamin R. <ben...@ou...> - 2012年06月18日 13:10:58
On Mon, Jun 18, 2012 at 6:42 AM, Clare Soh <cla...@gm...> wrote:
> Hi,
>
> I'm trying to plot some data against time using the following code:
>
> r = mlab.csv2rec(filename)
> self.axis.plot(r.time, r.jb_sizems)
> hfmt = dates.DateFormatter('%H:%M:%S.%f')
> self.axis.xaxis.set_major_formatter(hfmt)
> self.axis.set_title("JB Size")
> self.axis.set_xlabel("Time")
> self.axis.set_ylabel("JB Size(ms)", color='b')
> self.axis.set_ylim(bottom=0)
> for tl in self.axis.get_yticklabels():
> tl.set_color('b')
> self.axis.grid()
> self.figure.autofmt_xdate()
>
> Everything works well, except for the cases when time ranges from before
> 12am to after 12am. For example I have one csv file with time values
> ranging from 23:04:09.367000 to 00:08:09.357000. By right I should see a 1
> hour plot with x-axis ranging from 23:xx:xx.xxxxxx on the left to
> 00:xx:xx.xxxxxx on the right, but I got a "24 hour" plot instead with
> x-axis ranging from 00:xx:xx.xxxxxx on the left to 23:xx:xx.xxxxxx on the
> right. My graph therefore appeared "chopped" into 2. Anybody knows how to
> fix this?
>
> Regards,
> Clare.
>
>
Clare,
Without a date, this can not be handled the way you want. You can either
make it go from least to greatest or greatest to least. Using just hours,
you will either have to increase from 00Z to 23Z, or decrease from 23Z to
00Z. If you can't get a date included into the data file, you will
probably have to do some processing of your data to add some sort of "fake"
date to it first. This can be very tricky to do correctly. Your best bet
is to get your data files to report the date.
I hope this helps!
Ben Root
From: Benjamin R. <ben...@ou...> - 2012年06月18日 13:02:38
On Mon, Jun 18, 2012 at 3:36 AM, Maximilian Fabricius
<mfa...@gm...>wrote:
> On Tue, Jun 12, 2012 at 6:40 PM, John Hunter <jd...@gm...> wrote:
> > On Fri, Jun 8, 2012 at 3:36 AM, Maximilian Fabricius
> > <mfa...@gm...> wrote:
> >> it seems that whenever I plot something, a window opens.
> >>
> >> from matplotlib import pylab
> >> import numpy
> >> pylab.plot(numpy.random.normal(size=100))
> >>
> >> Now, I have code that is supposed to produce diagnostic plots as PDFs.
> Only
> >
> > Before importing pylab, do
> >
> > import matplotlib
> > matplotlib.use('pdf')
> >
> > The FAQ for using mpl in a web app server is pretty relevant to this use
> case
> >
> >
> http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-in-a-web-application-server
> >
> > JDH
>
>
> Hi John,
>
> yes, I can do a matplotlib.use('pdf') (As a matter of fact I use this
> as a workaround right now). But I have to do this at the very
> beginning of the code, i.e.
> before the import of pyplot. Now, my routine has a --PLOT switch which
> allows me to turn on the on-screen plotting.
> Depending on that switch I now have to decide whether or not to call
> matplotlib.use('pdf').
>
> This means that I have a lot of imports interspersed with other code
> which looks terrible.
>
> Really I am pretty sure that a simple script like:
>
> from matplotlib import pyplot as pp
> pp.plot([1,2,3])
>
> should not open a window. Only after a
>
> pp.show()
>
> the window should show up.
>
> Note: I have tried to remove my .matplotlib directory. I have also checked
>
> >>> pp.isinteractive()
> False
>
> Any help would be highly appreciated.
>
> Maximilian
>
>
Maxmillian,
Did you check your ~/.matplotlib/matplotlibrc file like I suggested? By
default, these plots should not be coming up until you call show().
However, if "interactive" is set to True, then they will come up at the
first plotting command.
Cheers!
Ben Root
From: Benjamin R. <ben...@ou...> - 2012年06月18日 12:58:09
On Mon, Jun 18, 2012 at 2:36 AM, Andre' Walker-Loud <wal...@gm...>wrote:
> Hi All,
>
> I have mac os x, 10.6.8, enthought distribution.
>
> I recently upgraded from the 6.2 to 7.3 EPD.
>
> Previously, I had a script which would manipulate some data, and as soon
> as the command
>
> plt.figure()
>
> was issued, the plot would show up. I could then continue along with the
> analysis (I wrote an interactive script) and plots would be updated, and
> new plots would show up (when I issued a command like re-sizing the plot
> limits.
>
> This no longer happens, and now the plots are not drawn until the very end
> of all the analysis. But of course this defeats the purpose of having an
> interactive analysis session.
>
> I do have plt.show() at the very end of the script.
> In case it may matter, my main script loads another one as a module. (But
> this is how it was before when it worked).
>
> I am not sure what has caused this to change. I have tried the follwing
>
> - restart computer in case there were just some gui problem
> - re-install the EPD 7.3 and EPD 6.2 (in that order)
> - use the older 6.2 installation to run the script
>
> all of these fail to produce the behavior I previously had. It would be
> great to sort this out.
>
>
> Thanks,
>
> Andre
>
Most likely, there was a change to your matplotlibrc file. There is a
setting in there for "interactive" and by default, it is set to False. If
you uncomment it and set it to True, you should get back the behavior you
expected. You can also explicitly set the interactive mode to True from
your scripts with a "plt.ion()" call before loading your other modules.
I hope that helps!
Ben Root
From: John H. <jd...@gm...> - 2012年06月18日 12:54:33
On Mon, Jun 18, 2012 at 7:50 AM, Benjamin Root <ben...@ou...> wrote:
> However, should it be a full-out error? Is it possible to have mpl run
> without a font cache?
I'm sure we could, but from an implementation perspective it would
probably be easier to spoof it with a virtual filesystem and files
using string io or equivalent. I think this would be a good feature
if anyone wants to pursue it.
JDH
From: Benjamin R. <ben...@ou...> - 2012年06月18日 12:51:09
On Mon, Jun 18, 2012 at 8:41 AM, John Hunter <jd...@gm...> wrote:
> On Mon, Jun 18, 2012 at 7:29 AM, Martin Mokrejs
> <mmo...@fo...> wrote:
>
> > Hmm. Could it be by default the current working directory instead? Or,
> try/else added to the code
> > which would try to write into cwd if $HOME (aka $MPLCONFIGDIR) returns
> an error?
>
> The stuff we store there is meant to be persistent between runs,
> primarily a cache of all the fonts we find on your system. So
> defaulting to the current working directory is not a good idea because
> then we would have configs littered across the filesystem and would
> not be able to take advantage of the information gleaned from previous
> runs from other directories.
>
> JDH
>
>
However, should it be a full-out error? Is it possible to have mpl run
without a font cache?
Just a thought.
Ben Root
From: John H. <jd...@gm...> - 2012年06月18日 12:42:00
On Mon, Jun 18, 2012 at 7:29 AM, Martin Mokrejs
<mmo...@fo...> wrote:
> Hmm. Could it be by default the current working directory instead? Or, try/else added to the code
> which would try to write into cwd if $HOME (aka $MPLCONFIGDIR) returns an error?
The stuff we store there is meant to be persistent between runs,
primarily a cache of all the fonts we find on your system. So
defaulting to the current working directory is not a good idea because
then we would have configs littered across the filesystem and would
not be able to take advantage of the information gleaned from previous
runs from other directories.
JDH
From: Martin M. <mmo...@fo...> - 2012年06月18日 12:29:40
John Hunter wrote:
> 
> 
> 
> 
> On Jun 18, 2012, at 6:19 AM, Martin Mokrejs <mmo...@fo...> wrote:
> 
>> Hi,
>> I am running some script in /mnt/blah and while my $HOME disk on a different device filled up
>> because of some other reason. But my script ran in /mnt/blah died as well while there is plenty
>> of space. Here is the stacktrace.
> 
> Try setting the MPLCONFIGDIR environment variable to the writable dir or your choice. 
> 
> mpl does need a place to store some files, which is $HOME/.matplotlib by default, but you can configure it. 
Hmm. Could it be by default the current working directory instead? Or, try/else added to the code
which would try to write into cwd if $HOME (aka $MPLCONFIGDIR) returns an error?
I will set the variable in my scripts but too late for those already in the queue. ;-) Thanks.
Martin
From: John H. <jd...@gm...> - 2012年06月18日 11:37:06
On Jun 18, 2012, at 6:19 AM, Martin Mokrejs <mmo...@fo...> wrote:
> Hi,
> I am running some script in /mnt/blah and while my $HOME disk on a different device filled up
> because of some other reason. But my script ran in /mnt/blah died as well while there is plenty
> of space. Here is the stacktrace.
Try setting the MPLCONFIGDIR environment variable to the writable dir or your choice. 
mpl does need a place to store some files, which is $HOME/.matplotlib by default, but you can configure it. 
> 
From: Martin M. <mmo...@fo...> - 2012年06月18日 11:19:40
Hi,
 I am running some script in /mnt/blah and while my $HOME disk on a different device filled up
because of some other reason. But my script ran in /mnt/blah died as well while there is plenty
of space. Here is the stacktrace.
 import matplotlib
 File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 765, in <module>
 rcParams = rc_params()
 File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 683, in rc_params
 fname = matplotlib_fname()
 File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 595, in matplotlib_fname
 fname = os.path.join(get_configdir(), 'matplotlibrc')
 File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 246, in wrapper
 ret = func(*args, **kwargs)
 File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 467, in _get_configdir
 if not _is_writable_dir(p):
 File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 176, in _is_writable_dir
 t.close()
IOError: [Errno 28] No space left on device
 Is this kind of check necessary at all? This is matplotlib-1.1.0 on Linux.
Thank you,
Martin
From: Clare S. <cla...@gm...> - 2012年06月18日 10:42:18
Hi,
I'm trying to plot some data against time using the following code:
 r = mlab.csv2rec(filename)
 self.axis.plot(r.time, r.jb_sizems)
 hfmt = dates.DateFormatter('%H:%M:%S.%f')
 self.axis.xaxis.set_major_formatter(hfmt)
 self.axis.set_title("JB Size")
 self.axis.set_xlabel("Time")
 self.axis.set_ylabel("JB Size(ms)", color='b')
 self.axis.set_ylim(bottom=0)
 for tl in self.axis.get_yticklabels():
 tl.set_color('b')
 self.axis.grid()
 self.figure.autofmt_xdate()
Everything works well, except for the cases when time ranges from before
12am to after 12am. For example I have one csv file with time values
ranging from 23:04:09.367000 to 00:08:09.357000. By right I should see a 1
hour plot with x-axis ranging from 23:xx:xx.xxxxxx on the left to
00:xx:xx.xxxxxx on the right, but I got a "24 hour" plot instead with
x-axis ranging from 00:xx:xx.xxxxxx on the left to 23:xx:xx.xxxxxx on the
right. My graph therefore appeared "chopped" into 2. Anybody knows how to
fix this?
Regards,
Clare.
From: julien t. <ju...@ta...> - 2012年06月18日 10:27:40
> Hi,
>
> I have a question: Is there a way with matplotlib to see influence of
> code changes on the plot without explicitly recompiling?
>
Hello
Using bpython is a nice trick to achieve this :
Bootstrap in bpython :
http://bpaste.net/show/31823/
once sastified either F8 to share, or Ctrl+S to save
once wanting to make a new session, make a minimal file with all you need and
bpyton -i bootstrap.py
bpython -i => interactive you are given the conctrol back once the
file is loaded.
use :
plt.show() once and only once to show the canvas.
plt.clf() : clear figure
plt.interactive(True) : dont let python tk (or whatever GUI fw you
use) take the focus
plt.draw() to refresh the canvas
Ctrl+R if you made a mistake, it will delete last line
advantages :
* completion ;
* help is included
* saving make stuff faster;
From: mogliii <mo...@gm...> - 2012年06月18日 09:14:23
Hi,
I have a question: Is there a way with matplotlib to see influence of
code changes on the plot without explicitly recompiling?
My workflow looks like this: I'm writing single files for plots in
Eclipse with pydev. I normally copy/paste sections from previous
figures. I don't want to do this in ipython, because even though I might
end up with a nice figure, there is no clean way to maintain the code
for later recompilation.
So what I do:
1) Compile => matplotlib plot opens
2) adjust code (for example spacing, plot-range...)
3) Compile
But every time a new plot opens. So is there a way of getting the plot
into the same window every time? And it would be even nicer if I could
just change a number in the code, and the plot updates by itself.
From: Maximilian F. <mfa...@gm...> - 2012年06月18日 07:36:58
On Tue, Jun 12, 2012 at 6:40 PM, John Hunter <jd...@gm...> wrote:
> On Fri, Jun 8, 2012 at 3:36 AM, Maximilian Fabricius
> <mfa...@gm...> wrote:
>> it seems that whenever I plot something, a window opens.
>>
>> from matplotlib import pylab
>> import numpy
>> pylab.plot(numpy.random.normal(size=100))
>>
>> Now, I have code that is supposed to produce diagnostic plots as PDFs. Only
>
> Before importing pylab, do
>
> import matplotlib
> matplotlib.use('pdf')
>
> The FAQ for using mpl in a web app server is pretty relevant to this use case
>
> http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-in-a-web-application-server
>
> JDH
Hi John,
yes, I can do a matplotlib.use('pdf') (As a matter of fact I use this
as a workaround right now). But I have to do this at the very
beginning of the code, i.e.
before the import of pyplot. Now, my routine has a --PLOT switch which
allows me to turn on the on-screen plotting.
Depending on that switch I now have to decide whether or not to call
matplotlib.use('pdf').
This means that I have a lot of imports interspersed with other code
which looks terrible.
Really I am pretty sure that a simple script like:
from matplotlib import pyplot as pp
pp.plot([1,2,3])
should not open a window. Only after a
pp.show()
the window should show up.
Note: I have tried to remove my .matplotlib directory. I have also checked
>>> pp.isinteractive()
False
Any help would be highly appreciated.
Maximilian
From: Andre' Walker-L. <wal...@gm...> - 2012年06月18日 06:36:54
Hi All,
I have mac os x, 10.6.8, enthought distribution.
I recently upgraded from the 6.2 to 7.3 EPD.
Previously, I had a script which would manipulate some data, and as soon as the command
plt.figure()
was issued, the plot would show up. I could then continue along with the analysis (I wrote an interactive script) and plots would be updated, and new plots would show up (when I issued a command like re-sizing the plot limits.
This no longer happens, and now the plots are not drawn until the very end of all the analysis. But of course this defeats the purpose of having an interactive analysis session.
I do have plt.show() at the very end of the script.
In case it may matter, my main script loads another one as a module. (But this is how it was before when it worked).
I am not sure what has caused this to change. I have tried the follwing
- restart computer in case there were just some gui problem
- re-install the EPD 7.3 and EPD 6.2 (in that order)
- use the older 6.2 installation to run the script
all of these fail to produce the behavior I previously had. It would be great to sort this out.
Thanks,
Andre
From: surfcast23 <sur...@gm...> - 2012年06月18日 01:12:12
Thanks Ben I will check it out
Benjamin Root-2 wrote:
> 
> Khary,
> 
> On Sun, Jun 10, 2012 at 3:30 PM, surfcast23 <sur...@gm...> wrote:
> 
>>
>> to matplotlib-use.
>> Hi,
>>
>> I have a data set that is composed of x,y,z coordinates of the center of
>> cells and counts of objects in each contained in cell. I am using the
>> following code to do a scatter plot of the counts per cell.
>>
>>
>> ax = fig.add_subplot(111, projection='3d')
>> ax.scatter(Xa, Ya, Za, zdir='z', s=C, c='b')
>> ax.set_xlabel('X Label')
>> ax.set_ylabel('Y Label')
>> ax.set_zlabel('Z Label')
>> plt.show()
>>
>> Where Xa, Ya, Za, are arrays containing the cell centers, and C is an
>> array
>> of counts per cell. Below is a plot I did where the blue circles
>> represent
>> the "size in points^2. It is a scalar or an array of the same length as
>> x
>> and y."(Quote from docs). What I would like to do is have the plot show
>> the actual number of counts as points in the plot. Is such a thing
>> possible?
>> Thanks
>>
>> Best,
>> Khary
>>
> 
> I think this example might be what you are looking for:
> 
> http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html#text
> 
> Cheers!
> Ben Root
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Plot-points-in-a-3D-Scatter-Plot-tp33990025p34027555.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Joe K. <jki...@wi...> - 2012年06月17日 17:31:31
It sounds like you were using the right approach, you just got a bit lost
on what some of the keyword parameters to annotate, etc do.
Here's an example that should do what you want:
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
fig, ax = plt.subplots()
# Set the axis limits as you wanted...
ax.set_ylim([-0.6, 1.1])
# Set major and minor tick intervals
# We could just set the tick locations manually, but this way you'll keep
the
# same intervals when you zoom/pan/etc.
ax.yaxis.set_major_locator(MultipleLocator(1))
ax.yaxis.set_minor_locator(MultipleLocator(0.1))
# Make the bottom spine "float" instead of being at the bottom of the plot
ax.spines['bottom'].set_position(('data', 0))
# Hide the top and right spines (Similar to your sketch)
for position in ['right', 'top']:
 ax.spines[position].set_visible(False)
# Turn off the top, right, and bottom major and minor ticks (as in your
sketch)
ax.tick_params(which='both', top=False, right=False, bottom=False,
 labelbottom=False)
# Draw a 15 point long arrow that will always be at the top-left corner of
# the axes. The key is that we're specifying a location of (0,1) in
# "axes fraction" coordinates. We then place an empty text string 15
_points_
# above this (the `xytext` parameter controls the amount, `textcoords`
controls
# how it's interpreted). Then, we draw an arrow connecting the top left
corner
# of the axes to the (empty and not drawn) text string.
ax.annotate('', xy=(0,1), xycoords='axes fraction', xytext=(0,15),
 textcoords='offset points', ha='center',
 arrowprops=dict(arrowstyle='<|-', shrinkA=0, shrinkB=0,
 facecolor='black'))
plt.show()
Hope that helps!
-Joe
On Fri, Jun 15, 2012 at 7:34 AM, Asbach, Mark <
mar...@ia...> wrote:
> Hi there,
>
> I'm sorry to ask such a newbie question, but I'd like to format a custom
> box plot and although there are numerous examples on the web and tons of
> docstrings in matplotlib, I'm stuck somehow. My problems center around axes
> / spines. In detail, my problems are:
>
> 1) I want an y-axis on the left that spans from -0.6 to 1.1, ends in an
> arrow, has major ticks at 0 and 1 and minor ticks at [0.1...0.9]
> As far as I understand, there is no option to let spines end in an arrow
> head, so I have to draw the myself. I get the ticks to appear at the right
> positions and the y-range to be as desired - however, the spine line is not
> drawn over the full y-range, but only where there is data in the diagram.
> Also, I copied the arrow annotation code blindly from an older post on this
> list, but do not understand how I can adapt the arrow head to appear at a
> data position (instead of at the corner of the Axes area). One problem is,
> that I get ticks on the right although that spine was disabled.
>
> 2) I want some kind of x-axis at y==0, without ticks and without arrow
> Using some methods on the spines, I can disable the top spine and move the
> bottom spine to zero. However, as with the y-axis, I cannot control from
> where to where the line itself is drawn.
>
> As attachments, you'll find a hand sketch of what my graph should look
> like and matplotlib code that goes nearly all the way.
>
> I would be very happy about a hint on how to fix the problems left.
>
> Thanks an advance,
> Mark
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: ananduri <aru...@gm...> - 2012年06月17日 04:35:23
Thanks Ben and Francesco. The zorder option didn't work, I'll use mayavi or
try to make it work as is. And as for setting the z axis limits, I found
that that line has to be placed after all plotting commands in the script.
Benjamin Root-2 wrote:
> 
> Ananduri,
> 
> On Fri, Jun 15, 2012 at 8:47 AM, ananduri <aru...@gm...> wrote:
> 
>>
>> Hello,
>>
>> I have some minor questions regarding matplotlib. I'm using it to make a
>> 3d
>> plot, displaying a surface, it's contour map, a line climbing the surface
>> and its projection onto the contour map.
>>
>> http://old.nabble.com/file/p34015720/landscape_draft.pnglandscape_draft.png
>>
>> As you can see, when the lines cross the contourf, they are somewhat
>> obscured. Before I made the contourf transparent, the lines were blocked,
>> even though they were above the contour plot when I viewed the picture
>> from
>> a different angle. Can this be fixed? I want the lines to appear on top
>> of
>> the contour plot.
>>
>>
> Unfortunately, no. Matplotlib was originally designed as a 2D layering
> renderer. The mplot3d toolkit tries to work within that framework, but in
> the end, each artist object has to be represented by a single 3rd
> dimension
> coordinate (the layer), and so when two artists share bounding box
> regions,
> physically incorrect results will happen. Please see this FAQ:
> 
> http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/faq.html#my-3d-plot-doesn-t-look-right-at-certain-viewing-angles
> 
> 
> 
>> Also, I am trying to extend the z axis to be lower. This is most of the
>> code
>> I'm using:
>>
>> fig=plt.figure(1)
>> ax=fig.gca(projection='3d')
>>
>> x=np.arange(0,2.5,.02)
>> y=np.arange(0,2.3,.02)
>> x,y=np.meshgrid(x,y)
>>
>> ax.plot_surface(x,y,Z(x,y),alpha=0.3)
>>
>> cset=ax.contourf(x,y,Z(x,y),zdir='z',offset=-2,
>> cmap=plt.cm.jet,levels=np.linspace(0,9,100),alpha=0.5)
>>
>> ax.set_xlabel('x')
>> ax.set_ylabel('y')
>>
>> ax.set_zlim(-2,8) #This is where I try to change the z axis limits.
>>
>> plt.show()
>>
>> I'm excluding the code which plots the lines. ax.set_zlim doesn't do
>> anything; why is this?
>>
> 
> That would depend on which version of matplotlib you are using. The
> v1.1.x
> branch should have that working properly.
> 
> Cheers!
> Ben Root
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/3d-contourf-and-ax.set-tp34015720p34024704.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Aronne M. <aro...@gm...> - 2012年06月16日 15:38:56
On Tue, Jun 12, 2012 at 1:03 AM, Justin R <jus...@gm...> wrote:
> operating system Windows 7
> matplotlib version : 1.1.0
> obtained from sourceforge
>
> the class seems to generate the same Wt matrix for every input. The
> every element of the weight matrix is either +sqrt(1/2) or -sqrt(1/2).
>
> dat1 = 4*np.random.randn(200,1) + 2
> dat2 = dat1*.25 + 1*np.random.randn(200,1)
> pcaObj1 = PCA(np.hstack((dat1,dat2)))
> print pcaObj1.Wt
>
> dat3 = 2*np.random.randn(200,1) + 2
> dat4 = dat3*2 + 3*np.random.randn(200,1)
> pcaObj2 = PCA(np.hstack((dat1,dat2)))
> print pcaObj2.Wt
>
> The output Y seems to be correct, and the projection function works.
> only the Wt matrix seems to be messed up. Am I using this class
> incorrectly, or could this be a bug?
Hi,
I wouldn't call myself a PCA expert - so don't weight my answer too
heavily - but here is what I think is happening:
Looking at the code, the input data array is centered and scaled to
unit variance in each dimension. The attribute .a of the class is a
copy of the array that is actually sent to the SVD; note the
centering/scaling. I don't have a proof of this, but intuitively I
expect that the PCA axes associated with a 2-dimension centered/scaled
array will always be at 45" angles (e.g., [1,1], [-1,1], etc., which
are normalized to [sqrt(1/2), sqrt(1/2)], etc). I think one way to
describe this is that after centering/scaling there are no degrees of
freedom left if you only started with 2 dimensions. So I don't think
there is a bug, but it is maybe unclear what the PCA class is doing.
If you increase to > 2 dimensions, you can see there is random
fluctuation in Wt:
In [102]: pcaObj = PCA(np.random.randn(200,2))
In [103]: pcaObj.Wt
Out[103]:
array([[-0.70710678, -0.70710678],
 [-0.70710678, 0.70710678]])
In [104]: pcaObj = PCA(np.random.randn(200,3))
In [105]: pcaObj.Wt
Out[105]:
array([[ 0.65456366, -0.24141116, -0.7164266 ],
 [ 0.39843462, 0.91551401, 0.05553329],
 [ 0.64249223, -0.32179924, 0.69544877]])
In [106]: pcaObj = PCA(np.random.randn(200,3))
In [107]: pcaObj.Wt
Out[107]:
array([[-0.29885902, -0.67436982, 0.67521007],
 [-0.95428685, 0.21449891, -0.20815098],
 [-0.00446109, -0.70655189, -0.70764718]])
Hope that helps,
Aronne
From: Benjamin R. <ben...@ou...> - 2012年06月16日 14:19:27
On Friday, June 15, 2012, Mark Lawrence wrote:
> Hi all,
>
> I regularly use matplotlib for plotting data relating to my personal
> finances. At the moment I'm converting Decimals to floats. Do I still
> have to do this? If yes, are there any plans to support Decimals? I've
> tried searching the latest PDF document, my apologies if I've missed
> anything, in which case could I have a pointer please.
>
> --
> Cheers.
>
> Mark Lawrence.
>
>
>
Our support for python decimals falls in the same category as any other
non-float datatypes (ints, datetime, etc.): it might work, but probably not
everywhere and most likely will end up being converted into floats anyway
somewhere in the process.
If you see places where Decimal doesn't work, file a bug request so that we
can try to better generalize our code-base.
Cheers!
Ben Root
From: R. O&#39;G. <ron...@ya...> - 2012年06月15日 20:19:31
8 messages has been excluded from this view by a project administrator.

Showing results of 226

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