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


Showing 6 results of 6

From: Ben A. <bax...@co...> - 2008年07月18日 21:54:40
I am trying to plot some 2D scatter plot data where:
 * the points have a colormap
 * some points have larger, colored circles on them
 * some points have a dark ring around them
I have managed to get this functionality to work by using both the scatter() and plot() commands. My problem is that the dark rings printed by the plot() command do not line up with the circles of the scatter() command. (Example file below).
My question is this:
 * Is there a way to set an offset for one of these plotting methods so that they line up properly? Setting it in the X/Y data will not work because it will not be scale independent.
 * Or is there a way to use only one plotting method? I can't seem to get plot() to draw different colors, and I can't get scatter() to draw a wide ring.
Thanks,
-Ben
####################
from pylab import *
N = 30
x = 0.9*rand(N)
y = 0.9*rand(N)
z = 0.9*rand(N)
w = 0.9*rand(N)
scatter(x, y, c=z)
scatter(x[:10],
 y[:10],
 s=120,
 c=w[:10],
 marker='o',
 alpha=0.4)
plot(x[5:15],
 y[5:15],
 'o',
 markersize=15,
 markeredgecolor='k',
 markeredgewidth=2,
 markerfacecolor='none')
show()
############################
On Fri, Jul 18, 2008 at 6:12 AM, Ian Harry <ian...@as...> wrote:
> Hi Darren,
> /home/spxiwh/matplotlibinstall/lib64/python2.4/site-packages/matplotlib/__init__.py:801:
> UserWarning: This call to matplotlib.use() has no effect
> because the the backend has already been chosen;
> matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
> or matplotlib.backends is imported for the first time.
>
> at the top of all of our plotting routine outputs now.
>
> This sounds like we have bugs in our code, which we need to deal with before
> we can upgrade our numpy and matplotlib versions. Because of time
> restraints, it is likely that upgrading of these modules on our systems will
> not happen for a few months. Using MPLCONFIGDIR should stop most of our
> failures anyway, I guess we can solve the rest by automatically retrying
> failed jobs.
>
For your own sake, this use bug should be fixed because it means mpl
is not doing what you think. The backend needs to be set before pylab
is imported. The two main ways to set the backend are in the rc file
and with the use directive. If you do the latter, make sure you put
 import matplotlib
 matplotlib.use('YourBackend')
near the top of your main driver code, before you import pylab or any
other modules which import it. You should also do this only in one
place in your code. If you try and do it after you import pylab, and
your backend is already set to something else from your rc files, your
code will break .
JDH
Hi Darren,
I have updated from svn and tried to run the code. It is not working, but,
the failures have nothing to do with texmanager.py. I'm getting some of our
codes failing from within one of our __init__.py files (my guess is a naming
conflict). And some more codes failing with:
 File
"/home/spxiwh/matplotlibinstall/lib64/python2.4/site-packages/matplotlib/axes.py",
line 263, in _xy_from_xy
 assert nrx == nry, 'Dimensions of x and y are incompatible'
AssertionError: Dimensions of x and y are incompatible
I also get:
/home/spxiwh/matplotlibinstall/lib64/python2.4/site-packages/matplotlib/__init__.py:801:
UserWarning: This call to matplotlib.use() has no effect
because the the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
at the top of all of our plotting routine outputs now.
This sounds like we have bugs in our code, which we need to deal with before
we can upgrade our numpy and matplotlib versions. Because of time
restraints, it is likely that upgrading of these modules on our systems will
not happen for a few months. Using MPLCONFIGDIR should stop most of our
failures anyway, I guess we can solve the rest by automatically retrying
failed jobs.
Thanks for the help
Ian
2008年7月17日 Darren Dale <dsd...@gm...>:
> On Wednesday 16 July 2008 07:20:59 am Ian Harry wrote:
> > [spxiwh@sugar 07:14 AM matplotlib]$ diff texmanager.py
> > /usr/lib64/python2.4/site-packages/matplotlib/texmanager.py
> > 248c248
> > < fh = file(outfile,'a')
> > ---
> >
> > > fh = file(outfile)
> >
> > 252,254c252
> > < else:
> > < try: verbose.report(fh.read(), 'debug')
> > < except: pass
> > ---
> >
> > > else: verbose.report(fh.read(), 'debug')
> >
> > 259,261c257,258
> > < else:
> > < try: os.remove(fname)
> > < except: pass
> > ---
> >
> > > else: os.remove(fname)
> >
> > 280c277
> > < fh = file(outfile,'a')
> > ---
> >
> > > fh = file(outfile)
> >
> > 285,287c282
> > < else:
> > < try: verbose.report(fh.read(), 'debug')
> > < except: pass
> > ---
> >
> > > else: verbose.report(fh.read(), 'debug')
> >
> > 289,290c284
> > < try: os.remove(outfile)
> > < except: pass
> > ---
> >
> > > os.remove(outfile)
> >
> > 314c308
> > < # else: verbose.report(fh.read(), 'debug')
> > ---
> >
> > > else: verbose.report(fh.read(), 'debug')
> >
> > --snip--
>
> I took a different approach:
>
> Index: lib/matplotlib/texmanager.py
> ===================================================================
> --- lib/matplotlib/texmanager.py (revision 5771)
> +++ lib/matplotlib/texmanager.py (working copy)
> @@ -273,16 +273,22 @@
> %(os.path.split(texfile)[-1], outfile))
> mpl.verbose.report(command, 'debug')
> exit_status = os.system(command)
> - fh = file(outfile)
> + try:
> + fh = file(outfile)
> + report = fh.read()
> + fh.close()
> + except IOError:
> + report = 'No latex error report available.'
> if exit_status:
> raise RuntimeError(('LaTeX was not able to process the
> following \
> -string:\n%s\nHere is the full report generated by LaTeX: \n\n'% repr(tex))
> +
> fh.read())
> - else: mpl.verbose.report(fh.read(), 'debug')
> - fh.close()
> +string:\n%s\nHere is the full report generated by LaTeX: \n\n'% repr(tex))
> +
> report)
> + else: mpl.verbose.report(report, 'debug')
> for fname in glob.glob(basefile+'*'):
> if fname.endswith('dvi'): pass
> elif fname.endswith('tex'): pass
> - else: os.remove(fname)
> + else:
> + try: os.remove(fname)
> + except OSError: pass
>
> return dvifile
>
> @@ -305,14 +311,19 @@
> os.path.split(dvifile)[-1], outfile))
> mpl.verbose.report(command, 'debug')
> exit_status = os.system(command)
> - fh = file(outfile)
> + try:
> + fh = file(outfile)
> + report = fh.read()
> + fh.close()
> + except IOError:
> + report = 'No dvipng error report available.'
> if exit_status:
> raise RuntimeError('dvipng was not able to \
> process the flowing file:\n%s\nHere is the full report generated by
> dvipng: \
> -\n\n'% dvifile + fh.read())
> - else: mpl.verbose.report(fh.read(), 'debug')
> - fh.close()
> - os.remove(outfile)
> +\n\n'% dvifile + report)
> + else: mpl.verbose.report(report, 'debug')
> + try: os.remove(outfile)
> + except OSError: pass
>
> return pngfile
>
>
> Would you update from svn and see if it works for you?
>
> Thanks,
> Darren
>
-- 
---------------------------------------------------------------------------
Ian Harry
School of Physics & Astronomy
Queens Buildings, The Parade
Cardiff, CF24 3AA
Email: Ian...@as...
Phone: (+44) 29 208 75120
Mobile: (+44) 7890 479090
---------------------------------------------------------------------------
From: John H. <jd...@gm...> - 2008年07月18日 03:36:37
On Thu, Jul 17, 2008 at 10:28 PM, Ryan May <rm...@gm...> wrote:
> I helped Eric out with this offline, and obviously set_array is for the
> colors, but the only solution we could come up with was to directly
> reset the PolyCollection._offsets member. This seems a little hacky.
> Is there any reason that there is not an set_offsets() (or something
> like it)? Any reason why I shouldn't code up a patch?
No, I can't thing of any reason why this attribute should not be
publicly settable, so patch away.
Thanks,
JDH
From: Ryan M. <rm...@gm...> - 2008年07月18日 03:28:21
Eric Bruning wrote:
> I have scatterplots on several axes that are dynamically updated, and
> thus I need to keep track of each of the PolyCollection artists that
> represent the scattered data. I would like to keep the same
> PolyCollection object but update the positions, colors, etc. of the
> symbols, possibly changing their total number, something along the
> lines of Line.set_data.
> 
> Did I miss a method that would do what I want?
> 
> I have already looked at removing the collection from the axes and
> replotting, but for some reason my axis limits get reset when I do so.
Guys,
I helped Eric out with this offline, and obviously set_array is for the 
colors, but the only solution we could come up with was to directly 
reset the PolyCollection._offsets member. This seems a little hacky. 
Is there any reason that there is not an set_offsets() (or something 
like it)? Any reason why I shouldn't code up a patch?
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Ryan M. <rm...@gm...> - 2008年07月18日 03:09:07
Michael Droettboom wrote:
> Oz Nahum wrote:
>> I am mostly frustrated with documentation writers who write very nice 
>> tutorials describing how to plot completely unusfull graphs of spheres 
>> inside loops and a dolphin swimming in the middle.
> I'm sorry. I just couldn't resist writing a tutorial example for this. 
> Please take it in the spirit of fun it was intended.
That's freaking hilarious. Someone clearly has too much time on their 
hands. (Yeah right.) Goes to show the power of matplotlib though. Nice one.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

Showing 6 results of 6

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