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





Showing results of 446

<< < 1 .. 3 4 5 6 7 .. 18 > >> (Page 5 of 18)
From: Darren D. <dsd...@gm...> - 2008年06月25日 12:21:40
On Monday 23 June 2008 08:53:56 pm Adam Mercer wrote:
> Hi
>
> Anyone know how to fix this problem?
>
> Cheers
>
> Adam
>
> On Thu, Jun 19, 2008 at 8:31 PM, Adam Mercer <ram...@gm...> wrote:
> > Hi
> >
> > I have a plot that has two different y-axis scales and I want
> > appropriate tick marks for the different y-axes. ie I want the tick
> > marks on the left axis to correspond to the scale on the left axis
> > etc... As far as I can tell the way to accomplish this, after
> > consulting the documentation, is to use the tick_left() and
> > tick_right() methods, I therefore have the following code:
> >
> > axes1.yaxis.tick_left()
> > axes1.yaxis.set_major_locator(pylab.MultipleLocator(0.1))
> > axes1.yaxis.set_minor_locator(pylab.MultipleLocator(0.05))
> > axes2.yaxis.tick_right()
> > axes2.yaxis.set_major_locator(pylab.MultipleLocator(5))
> > axes2.yaxis.set_minor_locator(pylab.MultipleLocator(1))
> >
> > but the minor ticks are on both the left and right y-axes. How can I
> > make the minor ticks for axes1 only appear on the the left and the
> > minor ticks for axes2 appear on the right?
I don't see a problem here. I did the following:
ipython -pylab
run two_scales.py
ax1.yaxis.set_minor_locator(MultipleLocator(1000))
draw()
# Shows minor ticks on both left and right yaxis
 ax1.yaxis.tick_left()
draw()
# shows minor ticks on left only
ax2.yaxis.set_minor_locator(MultipleLocator(.1))
draw()
# shows left yaxis minor ticks on left only, shows right yaxis ticks on both
ax2.yaxis.tick_right()
draw()
# shows left yaxis minor ticks on left only, right yaxis minor ticks on 
# right only
Darren
From: Darren D. <dsd...@gm...> - 2008年06月25日 12:11:03
Hi Alun,
On Wednesday 25 June 2008 07:09:52 am eShopping wrote:
> Hi
>
> the following code snippet is from a simple wxpython/matplotlib app
>
> # Data object class
>
> class PlotData(object):
>
> # Constructor (dummy arrays)
>
> def __init__(self):
> self.np = 100
>
> self.xa = numpy.arange(100.0)
> self.ya = 2.0 * self.xa
> self.ys = 4.0 * self.xa
>
>
> # Plot window class
>
> class PlotWin(object):
> def __init__(self, data):
> self.data = data # Store reference to data object
> self.figure = Figure() # Initialise figure
>
> # Create an Axes object to plot on
>
> self.ax1 = self.figure.gca()
> self.ax1.yaxis.tick_left()
> self.ax1.xaxis.tick_bottom()
>
> # Plot the data
>
> self.lines=[]
>
> self.lines.append(self.ax1.plot(self.data.xa, self.data.ya, 'g'))
> self.lines.append(self.ax1.plot(self.data.xa, self.data.ys, '-r'))
>
>
> # Update plot with new data
>
> def RefreshPlot(self, data):
> self.lines[0].set_data((self.data.xa,self.data.ya))
> self.lines[1].set_data((self.data.xa,self.data.ys))
>
> self.canvas.draw()
>
>
> # Main program
>
> if __name__ == "__main__":
> data = PlotData()
> pwin = PlotWin(data)
> pwin.RefreshPlot(data)
>
> The plot data changes during the application and I just want to
> replace the existing data with the new data (which may have a
> different number of points compared to the old data). I get the
> Python error "'list' object has no attribute 'set_data'" when the
> code executes RefreshPlot(). AFAIK lines[0] and lines[1] are
> 'Line2D' objects (at least that's what Python says they are when I
> ask to have them printed) , which do have a 'set_data' method. I'm
> sure there's something really easy that I need to do but just can't
> see it - all suggestions gratefully received!
I think the problem is:
self.lines.append(self.ax1.plot(self.data.xa, self.data.ya, 'g'))
plot() returns a list of lines. You are appending that list to self.lines, so 
when you index self.lines[0] later, you are getting the list returned by 
plot. You should either use extend() instead of append, or you need to index 
deeper: self.lines[0][0] and self.lines[0][1].
Darren
From: eShopping <etr...@ds...> - 2008年06月25日 11:10:10
Hi
the following code snippet is from a simple wxpython/matplotlib app
# Data object class
class PlotData(object):
 # Constructor (dummy arrays)
 def __init__(self):
 self.np = 100
 self.xa = numpy.arange(100.0)
 self.ya = 2.0 * self.xa
 self.ys = 4.0 * self.xa
# Plot window class
class PlotWin(object):
 def __init__(self, data):
 self.data = data # Store reference to data object
 self.figure = Figure() # Initialise figure
 # Create an Axes object to plot on
 self.ax1 = self.figure.gca()
 self.ax1.yaxis.tick_left()
 self.ax1.xaxis.tick_bottom()
 # Plot the data
 self.lines=[]
 self.lines.append(self.ax1.plot(self.data.xa, self.data.ya, 'g'))
 self.lines.append(self.ax1.plot(self.data.xa, self.data.ys, '-r'))
 # Update plot with new data
 def RefreshPlot(self, data):
 self.lines[0].set_data((self.data.xa,self.data.ya))
 self.lines[1].set_data((self.data.xa,self.data.ys))
 self.canvas.draw()
# Main program
if __name__ == "__main__":
 data = PlotData()
 pwin = PlotWin(data)
 pwin.RefreshPlot(data)
The plot data changes during the application and I just want to 
replace the existing data with the new data (which may have a 
different number of points compared to the old data). I get the 
Python error "'list' object has no attribute 'set_data'" when the 
code executes RefreshPlot(). AFAIK lines[0] and lines[1] are 
'Line2D' objects (at least that's what Python says they are when I 
ask to have them printed) , which do have a 'set_data' method. I'm 
sure there's something really easy that I need to do but just can't 
see it - all suggestions gratefully received!
Thanks in advance
Alun Griffiths
From: izak m. <iza...@ya...> - 2008年06月25日 11:05:41
Hi,
I see there is a "hatch: unknown" kwarg mentioned in the hist() documentation. Can anyone shed some light on how to use this please? I assume it might be used to generate monochrome rectangles with differentiating hatched fills?
Regards
Izak
 
From: Gideon S. <gr...@co...> - 2008年06月24日 14:36:01
my .matplotlib folder is empty. also, my installation otherwise 
appears to work.
-gideon
On Jun 24, 2008, at 10:01 AM, John Hunter wrote:
> On Tue, Jun 24, 2008 at 8:27 AM, Gideon Simpson 
> <gr...@co...> wrote:
>> I built from source. I removed my existing installation of
>> matplotlib, but I am still getting the same error. I had not been
>> using setup.cfg, but edited the template so that the experimental
>> packages were turned off. I am still getting this error.
>
> Check to see if you have a matplotlibrc file in ~/.matplotlib. If so,
> replace it with the latest one from site-packages/matplotlib/mpl-data
> (or comment out the autolayout line in the one you already have in
> ~/.matplotlib).
>
> Let us know if this works.
>
> JDH
From: John H. <jd...@gm...> - 2008年06月24日 14:01:30
On Tue, Jun 24, 2008 at 8:27 AM, Gideon Simpson <gr...@co...> wrote:
> I built from source. I removed my existing installation of
> matplotlib, but I am still getting the same error. I had not been
> using setup.cfg, but edited the template so that the experimental
> packages were turned off. I am still getting this error.
Check to see if you have a matplotlibrc file in ~/.matplotlib. If so,
replace it with the latest one from site-packages/matplotlib/mpl-data
(or comment out the autolayout line in the one you already have in
~/.matplotlib).
Let us know if this works.
JDH
From: Gideon S. <gr...@co...> - 2008年06月24日 13:28:08
I built from source. I removed my existing installation of 
matplotlib, but I am still getting the same error. I had not been 
using setup.cfg, but edited the template so that the experimental 
packages were turned off. I am still getting this error.
-gideon
On Jun 24, 2008, at 7:31 AM, John Hunter wrote:
> On Mon, Jun 23, 2008 at 11:41 PM, Gideon Simpson 
> <gr...@co...> wrote:
>> I was trying to look up a module, and, after installing matplotlib
>> 0.98.1, I get:
>
>> File "/opt/lib/python2.5/site-packages/matplotlib/config/
>> tconfig.py", line 391, in __init__
>> raise TConfigInvalidKeyError(m)
>> matplotlib.config.tconfig.TConfigInvalidKeyError: In config defined 
>> in
>> file: '/opt/lib/python2.5/site-packages/matplotlib/mpl-data/
>> matplotlib.conf'
>> Error processing section: figure
>> These keys are invalid : ['autolayout']
>> Valid key names : ['edgecolor', 'facecolor', 'dpi', 'figsize']
>
> This looks like you have the experimental "traited config" turned on,
> and Michael may have not cleaned autolayout from the tconfig defaults
> when he removed it. Did you build from source or get your package
> from elsewhere. If building from source, edit setup.cfg next to
> setup.py and make sure that the traited config is off
>
> ## Experimental config package support, this should only be enabled 
> by
> ## matplotlib developers, for matplotlib development
> enthought.traits = False
> configobj = False
>
> If you got it from elsewhere, let the packager know this should be
> turned off. And Darren, can you make sure that tconfig is updated
> vis-a-vis the autolayout param removal.
>
> JDH
From: Adam M. <ram...@gm...> - 2008年06月24日 13:13:54
Attachments: test.py test1.dat test2.dat
On Tue, Jun 24, 2008 at 6:14 AM, Darren Dale <dsd...@gm...> wrote:
> Please, include a brief standalone script that demonstrates the problem when
> reporting problems.
Sorry should have done that, I've attached an example script (and the
according data files) which exhibits the problem on 0.98.1, 0.98.0 has
no problems.
 File "./test.py", line 46, in <module>
 test_plot = test_axes.plot_date(test_dates, test, 'bo-')
 File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
line 3081, in plot_date
 self.xaxis_date(tz)
 File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
line 2015, in xaxis_date
 locator.refresh()
 File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 540, in refresh
 dmin, dmax = self.viewlim_to_dt()
 File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 436, in viewlim_to_dt
 return num2date(vmin, self.tz), num2date(vmax, self.tz)
 File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 233, in num2date
 if not cbook.iterable(x): return _from_ordinalf(x, tz)
 File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 156, in _from_ordinalf
 dt = datetime.datetime.fromordinal(ix)
ValueError: ordinal must be >= 1
What's strange is that if I comment out the plotting of the second
test data set then the plot is produced without error, even though the
reported error (when plotting both data sets) seems to have nothing to
do with the second data set.
Cheers
Adam
From: John H. <jd...@gm...> - 2008年06月24日 12:36:19
On Tue, Jun 24, 2008 at 6:43 AM, Johan Mazel <joh...@gm...> wrote:
> I used to have such errors when I was trying to display empty vectors.
> But since you're saying that the script work on previous version of
> Matplotlib...
I recently made some changes to try and support a use-case where the
user has no data and sets ax.set_xdate and later plots some date data.
Eg, the following used to fail on the call to xaxis_date because the
default data/viewlim are 0..1
 import datetime
 import matplotlib.pyplot as plt
 dt = datetime.date
 x = dt(2002,1,1), dt(2003,1,1), dt(2004,1,1)
 fig = plt.figure()
 ax = fig.add_subplot(111)
 ax.xaxis_date()
 ax.plot(x, [1,2,3])
 fig.autofmt_xdate()
 plt.show()
so it is possible these edits are causing the change Adam is
describing (even though they were designed to fix it), but as Darren
notes we will need a standalone script since our examples are working
fine and it is hard to debug in the void.
JDH
From: John H. <jd...@gm...> - 2008年06月24日 12:29:44
On Tue, Jun 24, 2008 at 7:05 AM, Michael Droettboom <md...@st...> wrote:
> I removed the autolayout key from all the various config files in SVN,
> but of course, forgot that any users with already-installed copies of
> matplotlibrc will get this error. Should I put the key back in as a
> deprecated no-op?
Yes, that is probably a good idea. Issue a warning pointing them to
the latest rc (http://matplotlib.sf.net/matplotlibrc).
JDH
From: Michael D. <md...@st...> - 2008年06月24日 12:05:17
I removed the autolayout key from all the various config files in SVN, 
but of course, forgot that any users with already-installed copies of 
matplotlibrc will get this error. Should I put the key back in as a 
deprecated no-op?
Cheers,
Mike
John Hunter wrote:
> On Mon, Jun 23, 2008 at 11:41 PM, Gideon Simpson <gr...@co...> wrote:
> 
>> I was trying to look up a module, and, after installing matplotlib
>> 0.98.1, I get:
>> 
>
> 
>> File "/opt/lib/python2.5/site-packages/matplotlib/config/
>> tconfig.py", line 391, in __init__
>> raise TConfigInvalidKeyError(m)
>> matplotlib.config.tconfig.TConfigInvalidKeyError: In config defined in
>> file: '/opt/lib/python2.5/site-packages/matplotlib/mpl-data/
>> matplotlib.conf'
>> Error processing section: figure
>> These keys are invalid : ['autolayout']
>> Valid key names : ['edgecolor', 'facecolor', 'dpi', 'figsize']
>> 
>
> This looks like you have the experimental "traited config" turned on,
> and Michael may have not cleaned autolayout from the tconfig defaults
> when he removed it. Did you build from source or get your package
> from elsewhere. If building from source, edit setup.cfg next to
> setup.py and make sure that the traited config is off
>
> ## Experimental config package support, this should only be enabled by
> ## matplotlib developers, for matplotlib development
> enthought.traits = False
> configobj = False
>
> If you got it from elsewhere, let the packager know this should be
> turned off. And Darren, can you make sure that tconfig is updated
> vis-a-vis the autolayout param removal.
>
> JDH
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Johan M. <joh...@gm...> - 2008年06月24日 11:43:03
I used to have such errors when I was trying to display empty vectors.
But since you're saying that the script work on previous version of
Matplotlib...
Sorry if it hasn't helped.
Johan
2008年6月24日 Darren Dale <dsd...@gm...>:
> On Monday 23 June 2008 23:37:09 Adam Mercer wrote:
> > Hi
> >
> > Just upgraded to matplotlib-0.98.1, and a code that worked with 0.98.0
> > is now failing with the following error:
>
> Please, include a brief standalone script that demonstrates the problem
> when
> reporting problems.
>
> > Traceback (most recent call last):
> > File "./plot_workout.py", line 126, in <module>
> > time_plot = time_axes.plot_date(times_dates, times, 'bo-')
> > File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
> > line 3081, in plot_date
> > self.xaxis_date(tz)
> > File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
> > line 2015, in xaxis_date
> > locator.refresh()
> > File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
> > line 540, in refresh
> > dmin, dmax = self.viewlim_to_dt()
> > File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
> > line 436, in viewlim_to_dt
> > return num2date(vmin, self.tz), num2date(vmax, self.tz)
> > File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
> > line 233, in num2date
> > if not cbook.iterable(x): return _from_ordinalf(x, tz)
> > File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
> > line 156, in _from_ordinalf
> > dt = datetime.datetime.fromordinal(ix)
> > ValueError: ordinal must be >= 1
> >
> > Any ideas?
> >
> > Cheers
> >
> > Adam
> >
> > -------------------------------------------------------------------------
> > Check out the new SourceForge.net Marketplace.
> > It's the best place to buy or sell services for
> > just about anything Open Source.
> > http://sourceforge.net/services/buy/index.php
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: John H. <jd...@gm...> - 2008年06月24日 11:31:27
On Mon, Jun 23, 2008 at 11:41 PM, Gideon Simpson <gr...@co...> wrote:
> I was trying to look up a module, and, after installing matplotlib
> 0.98.1, I get:
> File "/opt/lib/python2.5/site-packages/matplotlib/config/
> tconfig.py", line 391, in __init__
> raise TConfigInvalidKeyError(m)
> matplotlib.config.tconfig.TConfigInvalidKeyError: In config defined in
> file: '/opt/lib/python2.5/site-packages/matplotlib/mpl-data/
> matplotlib.conf'
> Error processing section: figure
> These keys are invalid : ['autolayout']
> Valid key names : ['edgecolor', 'facecolor', 'dpi', 'figsize']
This looks like you have the experimental "traited config" turned on,
and Michael may have not cleaned autolayout from the tconfig defaults
when he removed it. Did you build from source or get your package
from elsewhere. If building from source, edit setup.cfg next to
setup.py and make sure that the traited config is off
 ## Experimental config package support, this should only be enabled by
 ## matplotlib developers, for matplotlib development
 enthought.traits = False
 configobj = False
If you got it from elsewhere, let the packager know this should be
turned off. And Darren, can you make sure that tconfig is updated
vis-a-vis the autolayout param removal.
JDH
From: Darren D. <dsd...@gm...> - 2008年06月24日 11:14:17
On Monday 23 June 2008 23:37:09 Adam Mercer wrote:
> Hi
>
> Just upgraded to matplotlib-0.98.1, and a code that worked with 0.98.0
> is now failing with the following error:
Please, include a brief standalone script that demonstrates the problem when 
reporting problems.
> Traceback (most recent call last):
> File "./plot_workout.py", line 126, in <module>
> time_plot = time_axes.plot_date(times_dates, times, 'bo-')
> File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
> line 3081, in plot_date
> self.xaxis_date(tz)
> File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
> line 2015, in xaxis_date
> locator.refresh()
> File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
> line 540, in refresh
> dmin, dmax = self.viewlim_to_dt()
> File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
> line 436, in viewlim_to_dt
> return num2date(vmin, self.tz), num2date(vmax, self.tz)
> File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
> line 233, in num2date
> if not cbook.iterable(x): return _from_ordinalf(x, tz)
> File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
> line 156, in _from_ordinalf
> dt = datetime.datetime.fromordinal(ix)
> ValueError: ordinal must be >= 1
>
> Any ideas?
>
> Cheers
>
> Adam
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Eric F. <ef...@ha...> - 2008年06月24日 06:00:21
Delbert Franz wrote:
> I have been working to display an image of a USGS 7.5 minute quad sheet. 
> These are provided at various locations about the Web. Since the 
> range of colors on these maps is limited, the *.tif files appear to 
> use an indexed color map wherein each pixel has a value 0 to 255 and 
> the color is found from a table with 256 entries having triplets of
> the RGB in the range of 0-255. I have not been able to sort out
> how to get the gdal package to give me the color map from within python, so I dumped it
> from the image file using gdalinfo and then cut and pasted to get
> the following script:
> 
> ---------------------------------------------------------------------------------
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.cm as cm
> from matplotlib.colors import ListedColormap
from matplotlib.colors import NoNorm
> 
> import osgeo.gdal as gdal
> from osgeo.gdalconst import *
> 
> gd = gdal.Open('o37122d1.tif')
> 
> #Setup to compute the colormap from the RGB triplets from the geotif file
> div = np.zeros( (256,3), np.float32)
> 
> div = 255.0
> ctab = np.array([
> [ 255,255,255],
> [ 0,0,0],
> [ 255,255,255],
> [ 91,159,230],
> [ 230,45,30],
> [ 162,96,71],
> [ 210,255,177],
> [ 197,101,197],
> [ 255,240,0],
> [ 202,225,245],
> 
> ...snip.... (deleted many lines:)
> [ 250,202,250],
> [ 230,230,230],
> [ 222,167,146],
> [ 255,255,255],
> [ 255,255,255] ], dtype=np.uint8)
> 
> #Compute colors in range 0.0 to 1.0. 
> fctab= ctab/div
> 
> usgscm = ListedColormap(fctab, name='usgs',N=None)
> 
> 
> doq = gd.ReadAsArray()
> # doq proves to be a uint8 array: 8802 rows and 7066 columns
> 
> # Cut out a subset from the main array--to large to display and
> # slow as 'molasses in January' to process:)
> suba = doq[0:1101 ,0:1801 ]
> 
> fig = plt.figure()
> ax = fig.add_subplot(111)
> ax.imshow(suba, cmap=usgscm, origin='upper')
Instead, try:
ax.imshow(suba, cmap=usgscm, norm=NoNorm(), origin='upper')
> 
> plt.show()
> ---------------------------------------------------------------------------------
> This script does give me an image--but in badly wrong colors:( The script does 
> properly display gray-scaled Digital Ortho-quadrangles using cm.gray as the color
> map in imshow. Consequently something is not quite correct with respect to the 
> definition or the use of the color map. It appears that each map, and there 
> are about 56,000 of them available on one site, could have its own color map.
> Thus my application must be able to compute a color map unique to each of the 
> topographic maps. 
> 
> Questions:
> 
> 1. What am I missing to get imshow to pick out the correct colors from the 
> color map?
The default norm will scale your inputs; specifying the norm as a NoNorm 
instance will pass the integers through directly, so they will be used 
as indices into the colormap.
> 
> 2. Should I be using the name, usgs, given in the ListedColormap instance someplace?
> Not clear to me what role that name plays. 
> 
None, really. I can imagine ways in which it could be useful, but 
unless you know you need it, consider it optional.
> 3. Is there a way to use ctab directly in the ListedColormap instance? Class Colormap
> has a bytes argument, False by default, but I am not yet sure if it has any bearing
> on my problem. 
No, sorry, but the bytes argument is only in the __call__ method, where 
it is used to improve efficiency within mpl. There is no facility for 
using ints in the lookup table, and no recognition of 0-255 ints within 
mpl colorspecs, hence no way to feed your ctab in directly. Even if 
there were, though, I don't think it would make much difference in 
plotting time.
Eric
> 
> I am using Matplotlib 0.98 with the latest numpy, and gdal. I am not using 
> Basemap, after some study, because it contains far more "horsepower" than my 
> simple topographic-map viewer application requires. Also, this is my first 
> foray into "image processing". I am finding the learning curve a bit steep,
> as usual, with multiple names for the same thing popping up in descriptions
> from various sources--business as usual in the computer business:) 
> 
> Thanks from a happy matplotlib user in California!
> 
> Delbert
> 
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Gideon S. <gr...@co...> - 2008年06月24日 04:41:55
I was trying to look up a module, and, after installing matplotlib 
0.98.1, I get:
help> modules
Please wait a moment while I gather a list of all available modules...
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/sw/lib/python2.5/site.py", line 346, in __call__
 return pydoc.help(*args, **kwds)
 File "/sw/lib/python2.5/pydoc.py", line 1636, in __call__
 self.interact()
 File "/sw/lib/python2.5/pydoc.py", line 1654, in interact
 self.help(request)
 File "/sw/lib/python2.5/pydoc.py", line 1670, in help
 elif request == 'modules': self.listmodules()
 File "/sw/lib/python2.5/pydoc.py", line 1791, in listmodules
 ModuleScanner().run(callback)
 File "/sw/lib/python2.5/pydoc.py", line 1842, in run
 for importer, modname, ispkg in pkgutil.walk_packages():
 File "/sw/lib/python2.5/pkgutil.py", line 125, in walk_packages
 for item in walk_packages(path, name+'.', onerror):
 File "/sw/lib/python2.5/pkgutil.py", line 110, in walk_packages
 __import__(name)
 File "/opt/lib/python2.5/site-packages/matplotlib/config/ 
__init__.py", line 10, in <module>
 from mplconfig import rcParams, mplConfig, save_config, rcdefaults
 File "/opt/lib/python2.5/site-packages/matplotlib/config/ 
mplconfig.py", line 486, in <module>
 filePriority=True)
 File "/opt/lib/python2.5/site-packages/matplotlib/config/ 
tconfig.py", line 567, in __init__
 self.tconf = configClass(self.fconfCombined,monitor=monitor)
 File "/opt/lib/python2.5/site-packages/matplotlib/config/ 
tconfig.py", line 431, in __init__
 section = v(sec_config,self,monitor=monitor)
 File "/opt/lib/python2.5/site-packages/matplotlib/config/ 
tconfig.py", line 391, in __init__
 raise TConfigInvalidKeyError(m)
matplotlib.config.tconfig.TConfigInvalidKeyError: In config defined in 
file: '/opt/lib/python2.5/site-packages/matplotlib/mpl-data/ 
matplotlib.conf'
Error processing section: figure
These keys are invalid : ['autolayout']
Valid key names : ['edgecolor', 'facecolor', 'dpi', 'figsize']
From: Adam M. <ram...@gm...> - 2008年06月24日 03:37:11
Hi
Just upgraded to matplotlib-0.98.1, and a code that worked with 0.98.0
is now failing with the following error:
Traceback (most recent call last):
 File "./plot_workout.py", line 126, in <module>
 time_plot = time_axes.plot_date(times_dates, times, 'bo-')
 File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
line 3081, in plot_date
 self.xaxis_date(tz)
 File "/opt/local/lib/python2.5/site-packages/matplotlib/axes.py",
line 2015, in xaxis_date
 locator.refresh()
 File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 540, in refresh
 dmin, dmax = self.viewlim_to_dt()
 File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 436, in viewlim_to_dt
 return num2date(vmin, self.tz), num2date(vmax, self.tz)
 File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 233, in num2date
 if not cbook.iterable(x): return _from_ordinalf(x, tz)
 File "/opt/local/lib/python2.5/site-packages/matplotlib/dates.py",
line 156, in _from_ordinalf
 dt = datetime.datetime.fromordinal(ix)
ValueError: ordinal must be >= 1
Any ideas?
Cheers
Adam
From: Darren D. <dsd...@gm...> - 2008年06月24日 01:11:53
 Wasn't this answered by the two_scales.py example?
On Monday 23 June 2008 20:53:56 Adam Mercer wrote:
> Hi
>
> Anyone know how to fix this problem?
>
> Cheers
>
> Adam
>
> On Thu, Jun 19, 2008 at 8:31 PM, Adam Mercer <ram...@gm...> wrote:
> > Hi
> >
> > I have a plot that has two different y-axis scales and I want
> > appropriate tick marks for the different y-axes. ie I want the tick
> > marks on the left axis to correspond to the scale on the left axis
> > etc... As far as I can tell the way to accomplish this, after
> > consulting the documentation, is to use the tick_left() and
> > tick_right() methods, I therefore have the following code:
> >
> > axes1.yaxis.tick_left()
> > axes1.yaxis.set_major_locator(pylab.MultipleLocator(0.1))
> > axes1.yaxis.set_minor_locator(pylab.MultipleLocator(0.05))
> > axes2.yaxis.tick_right()
> > axes2.yaxis.set_major_locator(pylab.MultipleLocator(5))
> > axes2.yaxis.set_minor_locator(pylab.MultipleLocator(1))
> >
> > but the minor ticks are on both the left and right y-axes. How can I
> > make the minor ticks for axes1 only appear on the the left and the
> > minor ticks for axes2 appear on the right?
> >
> > Cheers
> >
> > Adam
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Adam M. <ram...@gm...> - 2008年06月24日 00:53:58
Hi
Anyone know how to fix this problem?
Cheers
Adam
On Thu, Jun 19, 2008 at 8:31 PM, Adam Mercer <ram...@gm...> wrote:
> Hi
>
> I have a plot that has two different y-axis scales and I want
> appropriate tick marks for the different y-axes. ie I want the tick
> marks on the left axis to correspond to the scale on the left axis
> etc... As far as I can tell the way to accomplish this, after
> consulting the documentation, is to use the tick_left() and
> tick_right() methods, I therefore have the following code:
>
> axes1.yaxis.tick_left()
> axes1.yaxis.set_major_locator(pylab.MultipleLocator(0.1))
> axes1.yaxis.set_minor_locator(pylab.MultipleLocator(0.05))
> axes2.yaxis.tick_right()
> axes2.yaxis.set_major_locator(pylab.MultipleLocator(5))
> axes2.yaxis.set_minor_locator(pylab.MultipleLocator(1))
>
> but the minor ticks are on both the left and right y-axes. How can I
> make the minor ticks for axes1 only appear on the the left and the
> minor ticks for axes2 appear on the right?
>
> Cheers
>
> Adam
>
From: Delbert F. <dd...@iq...> - 2008年06月23日 23:08:27
I have been working to display an image of a USGS 7.5 minute quad sheet. 
These are provided at various locations about the Web. Since the 
range of colors on these maps is limited, the *.tif files appear to 
use an indexed color map wherein each pixel has a value 0 to 255 and 
the color is found from a table with 256 entries having triplets of
the RGB in the range of 0-255. I have not been able to sort out
how to get the gdal package to give me the color map from within python, so I dumped it
from the image file using gdalinfo and then cut and pasted to get
the following script:
 
---------------------------------------------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.colors import ListedColormap
import osgeo.gdal as gdal
from osgeo.gdalconst import *
gd = gdal.Open('o37122d1.tif')
#Setup to compute the colormap from the RGB triplets from the geotif file
div = np.zeros( (256,3), np.float32)
div = 255.0
ctab = np.array([
 [ 255,255,255],
 [ 0,0,0],
 [ 255,255,255],
 [ 91,159,230],
 [ 230,45,30],
 [ 162,96,71],
 [ 210,255,177],
 [ 197,101,197],
 [ 255,240,0],
 [ 202,225,245],
 
 ...snip.... (deleted many lines:)
 [ 250,202,250],
 [ 230,230,230],
 [ 222,167,146],
 [ 255,255,255],
 [ 255,255,255] ], dtype=np.uint8)
#Compute colors in range 0.0 to 1.0. 
fctab= ctab/div
usgscm = ListedColormap(fctab, name='usgs',N=None)
doq = gd.ReadAsArray()
# doq proves to be a uint8 array: 8802 rows and 7066 columns
# Cut out a subset from the main array--to large to display and
# slow as 'molasses in January' to process:)
suba = doq[0:1101 ,0:1801 ]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.imshow(suba, cmap=usgscm, origin='upper')
plt.show()
---------------------------------------------------------------------------------
This script does give me an image--but in badly wrong colors:( The script does 
properly display gray-scaled Digital Ortho-quadrangles using cm.gray as the color
map in imshow. Consequently something is not quite correct with respect to the 
definition or the use of the color map. It appears that each map, and there 
are about 56,000 of them available on one site, could have its own color map.
Thus my application must be able to compute a color map unique to each of the 
topographic maps. 
Questions:
1. What am I missing to get imshow to pick out the correct colors from the 
 color map?
2. Should I be using the name, usgs, given in the ListedColormap instance someplace?
 Not clear to me what role that name plays. 
3. Is there a way to use ctab directly in the ListedColormap instance? Class Colormap
has a bytes argument, False by default, but I am not yet sure if it has any bearing
on my problem. 
 
I am using Matplotlib 0.98 with the latest numpy, and gdal. I am not using 
Basemap, after some study, because it contains far more "horsepower" than my 
simple topographic-map viewer application requires. Also, this is my first 
foray into "image processing". I am finding the learning curve a bit steep,
as usual, with multiple names for the same thing popping up in descriptions
from various sources--business as usual in the computer business:) 
Thanks from a happy matplotlib user in California!
 Delbert
From: Darren D. <dsd...@gm...> - 2008年06月23日 19:18:48
On Monday 23 June 2008 13:25:19 John Hunter wrote:
> On Mon, Jun 23, 2008 at 11:58 AM, Erik Tollerud <eri...@gm...> 
wrote:
> > Hmm... ok, so it is possible to pass some of the text in a plot
> > through TeX, but not all of the text? That's what the text.markup rc
> > parameter seems to be about, but I get an error saying that its an
> > unrecognized key if I use it...
>
> No, it's all or none. But with usetex=False you can use mathtext to
> format your labels, and then only the stuff in $$ will get formatted
> as math using the matplotlib fonts and math layout engine.
>
> > I could have sworn I saw a post way back where someone managed to get
> > the tick numbers to be bold when usetex was on, but I've forgotten how
> > it was done and can't find the post now. Anyway, it's possible that
> > I'd turned usetex off as a test and not been paying close attention to
> > turning it back on...
>
> You should be able to do this with a custom formatter::
>
> import matplotlib.ticker as ticker
>
> fmtbld = ticker.FormatStrFormatter(r'$\textbf{%1.2f}$')
> ax.xaxis.set_major_formatter(fmtbld)
>
> You should also be able to use textbf in the title, xlabel and ylabel.
>
> Of course, for this simple solution, you have to hard-code your
> precision. To take advantage of all the logic in
> ticker.ScalarFormatter, you could inherit from it and override some
> key pieces. But it might be better if we provide some hooks for you.
>
> Darren, in ScalarFormatter.set_format, we have code like::
>
> if self._usetex:
> self.format = '$%s$' % self.format
> elif self._useMathText:
> self.format = '$\mathdefault{%s}$' % self.format
>
> We could consider exposing a font setting here. Something along the lines
> of
>
> self.fontcommand = None
> if self._usetex:
> if self.fontcommand = None:
> self.format = '$%s$' % self.format
> else:
> self.format = '$%s{%s}$' % (self.fontcommand, self.format)
>
> Then the user could do::
>
> formatter = ticker.ScalarFormatter()
> formatter.fontcommand = r'\mathbf'
>
> and something similar for mathtext.
I'm not excited about adding user-accessible, usetex-specific properties and 
methods to classes outside of rcParams. It was a fair amount of work 
integrating as much customizability as we have now via rcParams, but we don't 
have the resources to support all the font properties in rcParams in usetex. I 
think it would be best to just use a custom formatter for this.
From: Matt C <mca...@gm...> - 2008年06月23日 17:47:22
Thanks for the reply. The trick with clf() is that it redraws the entire
image, and hold(False), while much better, changes the axes values. Ideally
I could keep my axes setup and redraw only the bars, ala the animation
example of the plot() sine wave. Looking at that code, I'm trying something
like:
line, = bar(i + 0.25 , name_value_dict[key], color='red'), and calling
line.set_y(), but with similar issues.
Any other pointers would be greatly appreciated.
-Matt
On Sun, Jun 22, 2008 at 2:54 PM, Ryan May <rm...@gm...> wrote:
> Matt C wrote:
>
>> I'm very new to MPL, and I'm having a blast with it - great work. I've
>> looked around the docs, lists and other random places for a hint on this,
>> but I'm still stumped.
>>
>> The goal is simple: I'd like to create a very basic animated bar or barh
>> chart. I've been playing via ion() from the IPython shell but I run into the
>> following issue: The bar is painted correctly, but any value lower than the
>> max doesn't show up, as the max value bar doesn't clear. For example, from
>> IPython:
>>
>> bar(10+0.25, 10) shows perfectly, then an update (using interactive mode
>> set to on)
>> bar(10+0.25, 4)
>>
>
> Try adding a clf(), which clears the current figure, in between the calls
> to bar. Another option is to use hold(False) signals that you want a new
> plotting command to start from a clean slate.
>
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
>
From: John H. <jd...@gm...> - 2008年06月23日 17:25:22
On Mon, Jun 23, 2008 at 11:58 AM, Erik Tollerud <eri...@gm...> wrote:
> Hmm... ok, so it is possible to pass some of the text in a plot
> through TeX, but not all of the text? That's what the text.markup rc
> parameter seems to be about, but I get an error saying that its an
> unrecognized key if I use it...
No, it's all or none. But with usetex=False you can use mathtext to
format your labels, and then only the stuff in $$ will get formatted
as math using the matplotlib fonts and math layout engine.
> I could have sworn I saw a post way back where someone managed to get
> the tick numbers to be bold when usetex was on, but I've forgotten how
> it was done and can't find the post now. Anyway, it's possible that
> I'd turned usetex off as a test and not been paying close attention to
> turning it back on...
>
You should be able to do this with a custom formatter::
 import matplotlib.ticker as ticker
 fmtbld = ticker.FormatStrFormatter(r'$\textbf{%1.2f}$')
 ax.xaxis.set_major_formatter(fmtbld)
You should also be able to use textbf in the title, xlabel and ylabel.
Of course, for this simple solution, you have to hard-code your
precision. To take advantage of all the logic in
ticker.ScalarFormatter, you could inherit from it and override some
key pieces. But it might be better if we provide some hooks for you.
Darren, in ScalarFormatter.set_format, we have code like::
 if self._usetex:
 self.format = '$%s$' % self.format
 elif self._useMathText:
 self.format = '$\mathdefault{%s}$' % self.format
We could consider exposing a font setting here. Something along the lines of
 self.fontcommand = None
 if self._usetex:
 if self.fontcommand = None:
 self.format = '$%s$' % self.format
 else:
 self.format = '$%s{%s}$' % (self.fontcommand, self.format)
Then the user could do::
 formatter = ticker.ScalarFormatter()
 formatter.fontcommand = r'\mathbf'
and something similar for mathtext.
JDH
From: Erik T. <eri...@gm...> - 2008年06月23日 16:58:19
Hmm... ok, so it is possible to pass some of the text in a plot
through TeX, but not all of the text? That's what the text.markup rc
parameter seems to be about, but I get an error saying that its an
unrecognized key if I use it...
I could have sworn I saw a post way back where someone managed to get
the tick numbers to be bold when usetex was on, but I've forgotten how
it was done and can't find the post now. Anyway, it's possible that
I'd turned usetex off as a test and not been paying close attention to
turning it back on...
Thanks for the quick response.
On Mon, Jun 23, 2008 at 5:21 AM, Darren Dale <dsd...@gm...> wrote:
> On Sunday 22 June 2008 21:49:03 Erik Tollerud wrote:
>> I'm trying to adjust the font weight on some of my plots - I'd like to
>> have the numbers along the axis ticks be bold instead of regular font
>> like the default setting. The problem is, nothing I do seems to
>> change the font weight. I've changed everything I can font in
>> matplotlibrc to bold, and when I go in and explicitly look at the
>> XTick or YTick objects and their text properties, it even claims the
>> text is bold... yet the text is normal weight font when displayed on
>> the plot.
>>
>> A would also like to have the plot labels be bolder, as well, and I
>> can't seem to change that either.
>>
>> Note that I have usetex as True, and I realize that this means the
>> labels, at least, are rendered through TeX... but I'm not clear on how
>> I can change the font properties to render bold versions of all the
>> TeX fonts I'm using (assuming this is possible).
>
> There is currently no support for bold ticklabels with usetex.
>
>> And I've been under
>> the impression that the default number formattes, at least, don't
>> render through TeX.
>
> I don't understand, what default number formats? When you enable usetex, tex
> is used to render all text.
>
>> So does anyone know how I can make all/any of my
>> text elemens bold?
>
> The tex option was not designed to provide all the flexibility of matplotlib's
> text handling. It was pretty hairy trying to support as many font properties
> as we currently support.
>
> Darren
>
>
From: Charlie M. <cw...@gm...> - 2008年06月23日 15:52:13
On Thu, Jun 19, 2008 at 10:35 PM, John Hunter <jd...@gm...> wrote:
> On Thu, Jun 19, 2008 at 9:19 PM, Charles Moad <cw...@gm...> wrote:
>
> > Seems like that one little fix did the trick. I ran several examples and
> > haven't had any problems. Committed now.
>
> Thanks Charlie! Can you provide some basic instructions for those of
> us on osx how we can enable and test this backend?
>
I guess the two option are to set "CocoaAgg" as the default backend in your
rc config or run a script with the "-dCocoaAgg" flag.
- Charlie
4 messages has been excluded from this view by a project administrator.

Showing results of 446

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