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
(2) |
2
(1) |
|
3
(17) |
4
(9) |
5
(2) |
6
(5) |
7
(8) |
8
(11) |
9
(6) |
|
10
(6) |
11
(21) |
12
(21) |
13
(17) |
14
(25) |
15
(15) |
16
(2) |
|
17
|
18
(9) |
19
(22) |
20
(25) |
21
(31) |
22
(19) |
23
(2) |
|
24
(5) |
25
(19) |
26
(10) |
27
(13) |
28
(14) |
29
(20) |
30
(5) |
|
31
(9) |
|
|
|
|
|
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 22:35:47
|
On Wed, Jan 20, 2010 at 3:07 PM, Kurt Forrester
<kur...@ho...> wrote:
> the output from the script is:
>
> annotation_clip = None
> checking is point is inside the axes : [ 30.875 233. ]
> contains_point = 0
> _check_xy returning False
> exit without drawing due to annotation_clip
>
>
Weird.
How about this one?
fig = figure()
ax=subplot(111)
txt = ax.annotate("Test", (-0.1, 0.5), annotation_clip=False)
print txt.get_annotation_clip()
If it still print out None, see if the next code make any difference.
fig = figure()
ax=subplot(111)
txt = ax.annotate("Test", (-0.1, 0.5))
txt.set_annotation_clip(False)
print txt.get_annotation_clip()
-JJ
|
|
From: Ángela R. C. <riv...@in...> - 2010-01-20 21:22:19
|
Estaré ausente de la oficina desde el Vie 18/12/2009 y no volveré hasta el Mar 24/08/2010 . Ésta es una respuesta automática para avisar del cambio de correo electrónico. A partir de ahora todos los correos deben ser remitidos a ang...@in... en lugar de a esta dirección de correo. Lamento las molestias. ____________________________________________________ This is an automated reply. My email address has changed and messages sent to this address will no longer arrive. Please take notice of my new email address: ang...@in.... Sorry for any inconvenience this may cause. Angela Rivera Campos Space Enviroment and Effects Laboratory National Institute for Aerospace Technology - INTA Ctra. Ajalvir Km. 4 28850 Torrejón de Ardoz - Madrid - Spain Tel: +34 91 520 65 51 Fax: +34 91 520 20 43 e-mail: ang...@in... ********************************************************************************************** IMPORTANT: The contents of this email and any attachments are confidential. They are intended for the named recipient(s) only. If you have received this email in error, please notify the system manager or the sender immediately and do not disclose the contents to anyone or make copies thereof. *** eSafe scanned this email for viruses, vandals, and malicious content. *** ********************************************************************************************** |
|
From: Kurt F. <kur...@ho...> - 2010-01-20 20:07:23
|
> From: lee...@gm... > Date: Wed, 20 Jan 2010 13:50:45 -0500 > Subject: Re: [Matplotlib-users] Annotate Behaviour - Arrows Missing > To: kur...@ho... > CC: mat...@li... > > On Wed, Jan 20, 2010 at 1:13 PM, Kurt Forrester > <kur...@ho...> wrote: > > I am not too sure what the design behaviour is but it is certainly not doing > > what I expected. I do appreciate your effort in resolving this. Please do > > let me know if there are any further tests I can perform to demonstrate the > > issue or test for fixes. > > > > "annotate" is meant to annotate a data point. It does not have much > meaning to draw the annotating text when the annotated data point is > not visible (i.e. when the data point is outside the axes). And this > is the default behavior of the current matplotlib. > > As I cannot reproduce the problem, it is hard to track down what is wrong. > I'm attaching a little debugging script. Please try to run this code > and report the output. For example, I get > > annotation_clip = False > _check_xy returning True > Drawing Text > > Your output may be different. > > Regards, > > -JJ thanks for the details on the design. the output from the script is: annotation_clip = None checking is point is inside the axes : [ 30.875 233. ] contains_point = 0 _check_xy returning False exit without drawing due to annotation_clip _________________________________________________________________ Search for properties that match your lifestyle! Start searching NOW! http://clk.atdmt.com/NMN/go/157631292/direct/01/ |
|
From: nbv4 <cp3...@oh...> - 2010-01-20 19:57:32
|
http://pastebin.com/f7fba9f61 I wrote this little snippet to automatically format the X axis of a line plot I created with a dynamic range. It's not completely 100% perfect, but I thought Id just post this here is anyone wants to use it, or maybe even knows of another method to create the same effect more easily. here are some examples: http://yfrog.com/htnonemptyusersp http://yfrog.com/htnoratespikesp http://yfrog.com/0p96192768p -- View this message in context: http://old.nabble.com/automatic-date-formatting-of-axes-tp27247612p27247612.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 19:14:13
|
On Wed, Jan 20, 2010 at 2:04 PM, Eric Firing <ef...@ha...> wrote:
> The reason for this fudge in contour is that contourf fills
> lower < z <= upper
> for each consecutive pair of contour levels.
> When the minimum value of z coincides with the lowest level, then regions
> with that minimum are left blank; so the lowest level is adjusted downward
> slightly, making the lowest contour interval include the minimum value.
>
I understand levels can be adjusted for a better contouring, but I'm
not sure whether this change needs to be visible to users.
The autoleveler, initially creates following levels
[0, 1.5, 3, 4.5, 6, 7.5, 9.]
But due to the reason you described above, they become
array([ -9.00000000e-06, 1.50000000e+00, 3.00000000e+00,
4.50000000e+00, 6.00000000e+00, 7.50000000e+00,
9.00000900e+00])
And the colorbar uses the adjusted levels for labeling. But I think it
may make more sense to use the initial levels (at least for the
colorbar ticks).
Regards,
-JJ
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 19:07:35
|
On Wed, Jan 20, 2010 at 1:36 PM, Eric Firing <ef...@ha...> wrote: > Second and related advice: don't fiddle directly with tick labels except as > a *last* resort. Instead, take care in selecting tick values, and if > necessary, customize the Formatter. > Agreed. It was a quick hack. > The fact that a default Formatter is writing -0.0 strikes me as a bug that > should be fixed in the Formatter; but it would be good to have more opinions > about this. > This is a behavior of python and I think it makes sense. In [92]: print "%2.1f" % (-9e-6,) -0.0 Regards, -JJ |
|
From: Eric F. <ef...@ha...> - 2010-01-20 19:04:28
|
Jae-Joon Lee wrote: > On Wed, Jan 20, 2010 at 12:12 PM, Mario Mech <me...@me...> wrote: >> the smallest value (0.0) is labeled with "-0.0". I just want to get rid of the minus sign. >> > > This is because the actual value is "-9.00000000e-06" (this inherits > from the levels of contour). The reason for this fudge in contour is that contourf fills lower < z <= upper for each consecutive pair of contour levels. When the minimum value of z coincides with the lowest level, then regions with that minimum are left blank; so the lowest level is adjusted downward slightly, making the lowest contour interval include the minimum value. The fudge could be made optional via a kwarg, e.g., include_minimum=True (default) or False (to defeat the fudge). This would not help Mario, though, assuming he is happy with the present contouring, and simply wants sane labeling of the 0-tick. For that, a Formatter adjustment is the simplest solution. Eric |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 18:51:12
|
On Wed, Jan 20, 2010 at 1:13 PM, Kurt Forrester <kur...@ho...> wrote: > I am not too sure what the design behaviour is but it is certainly not doing > what I expected. I do appreciate your effort in resolving this. Please do > let me know if there are any further tests I can perform to demonstrate the > issue or test for fixes. > "annotate" is meant to annotate a data point. It does not have much meaning to draw the annotating text when the annotated data point is not visible (i.e. when the data point is outside the axes). And this is the default behavior of the current matplotlib. As I cannot reproduce the problem, it is hard to track down what is wrong. I'm attaching a little debugging script. Please try to run this code and report the output. For example, I get annotation_clip = False _check_xy returning True Drawing Text Your output may be different. Regards, -JJ |
|
From: Eric F. <ef...@ha...> - 2010-01-20 18:36:57
|
Jae-Joon Lee wrote:
> On Wed, Jan 20, 2010 at 12:12 PM, Mario Mech <me...@me...> wrote:
>> the smallest value (0.0) is labeled with "-0.0". I just want to get rid of the minus sign.
>>
>
> This is because the actual value is "-9.00000000e-06" (this inherits
> from the levels of contour).
> While I think we're fixing a wrong problem (the contour routine need
> to be fixed in my view), here is a workaround you may use.
Careful, that slight adjustment of the lower limit, when automatically
generated, is there for a reason (though I don't recall offhand where it
is arising and why). There may be a better way to do it--and we can try
to figure it out and implement it--but my advice in general is: don't
use automatically generated contour or contourf levels except for
exploratory, interactive work, when slight imperfections are acceptable.
Instead, figure out what levels you really want, and supply them
explicitly as one of the arguments.
Second and related advice: don't fiddle directly with tick labels except
as a *last* resort. Instead, take care in selecting tick values, and if
necessary, customize the Formatter.
The fact that a default Formatter is writing -0.0 strikes me as a bug
that should be fixed in the Formatter; but it would be good to have more
opinions about this.
Eric
>
> -JJ
>
> import numpy as np
> from matplotlib import pyplot,mpl
>
> x = np.arange(10)
> y = np.arange(25)
> z = np.floor(10*np.random.random((25,10)))
>
> cntr = pyplot.contourf(x,y,z)
>
> cb = pyplot.colorbar(format=r"%2.1f")
>
>
> ticklabel_seq = cb.ax.yaxis.major.formatter.seq
> try:
> indx = ticklabel_seq.index("-0.0")
> ticklabel_seq[indx]="0.0"
> except ValueError:
> pass
>
>
> pyplot.show()
>
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts the
> world's best and brightest in the field, creating opportunities for Conference
> attendees to learn about information security's most important issues through
> interactions with peers, luminaries and emerging and established companies.
> http://p.sf.net/sfu/rsaconf-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 18:20:49
|
On Wed, Jan 20, 2010 at 12:12 PM, Mario Mech <me...@me...> wrote:
> the smallest value (0.0) is labeled with "-0.0". I just want to get rid of the minus sign.
>
This is because the actual value is "-9.00000000e-06" (this inherits
from the levels of contour).
While I think we're fixing a wrong problem (the contour routine need
to be fixed in my view), here is a workaround you may use.
-JJ
import numpy as np
from matplotlib import pyplot,mpl
x = np.arange(10)
y = np.arange(25)
z = np.floor(10*np.random.random((25,10)))
cntr = pyplot.contourf(x,y,z)
cb = pyplot.colorbar(format=r"%2.1f")
ticklabel_seq = cb.ax.yaxis.major.formatter.seq
try:
indx = ticklabel_seq.index("-0.0")
ticklabel_seq[indx]="0.0"
except ValueError:
pass
pyplot.show()
|
|
From: <PH...@Ge...> - 2010-01-20 17:52:12
|
Hey folks,
I'm plotting a simple rainfall record and when I tell the DayLocator to make sure to use 'US/Pacific' as it's time zone, it barfs on me. (US/Pacific is also set in my matplotlibrc file). When I don't specify the time zone, it doesn't barf, but the xticks are placed 8 hours off (presumably at the start of day GMT, right?). Am I not specifying the datetime.tzinfo object correctly?
The code and the traceback are below. The trace back mentions some EOF in a multi-line statement, but blames it on my fig.savefig(...) command.
Thanks for everything. This library is truly amazing. My mind is consistently blown as to what the developers have created.
Here's some code:
import numpy as np
import datetime as dt
import matplotlib.pyplot as pl
import matplotlib.dates as md
TZ = dt.tzinfo('US/Pacific')
dmin = dt.datetime(2009,12,22,0,0)
dmax = dt.datetime(2010,1,31,0,0)
delta = dt.timedelta(5/(24*60.))
dr = md.drange(dmin, dmax, delta)
y1 = np.zeros(len(dr)) + 1
fig = pl.figure(figsize=(7,4))
ax = fig.add_axes([0.10,0.13,0.85,0.82])
#~ --- this is where the error happens -------
#~ leave it as is for the point to be off
#~ OR
#~ uncomment the next line to produce the error
days = md.DayLocator(interval=4)
# days = md.DayLocator(interval=4, tz=TZ)
# verify xtick locations
a = dt.datetime(2009,12,26,0,0,0)
b = 4.5
L1 = ax.plot(dr, y1, 'b-', lw=1, label='Hourly')
p1 = ax.plot(a,b,'g.', label='Point not @ start of day')
ax.legend(loc='upper right')
ax.xaxis.set_major_locator(days)
ax.xaxis.set_major_formatter(md.DateFormatter('%m/%d'))
fig.savefig('storm.png')
# -------------------------------------------------------
The traceback:
In [138]: run storm_tracker
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (550, 0))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (550, 0))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (550, 0))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (91, 0))
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
c:\stuff\utils\py\storm_tracker.py in <module>()
59 ax.set_ylim([0,5])
60 ax.set_xlim([dmin, dmax])
---> 61 fig.savefig('storm.png')
62
63
C:\Python26\lib\site-packages\matplotlib\figure.pyc in savefig(self, *args, **kwargs)
1030 patch.set_alpha(0.0)
1031
-> 1032 self.canvas.print_figure(*args, **kwargs)
1033
1034 if transparent:
C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4agg.pyc in print_figure(self, *args, **kwargs)
142
143 def print_figure(self, *args, **kwargs):
--> 144 FigureCanvasAgg.print_figure(self, *args, **kwargs)
145 self.draw()
146
C:\Python26\lib\site-packages\matplotlib\backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edg
ecolor, orientation, format, **kwargs)
1474 orientation=orientation,
1475 bbox_inches_restore=_bbox_inches_restore,
-> 1476 **kwargs)
1477 finally:
1478 if bbox_inches and restore_bbox:
C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.pyc in print_png(self, filename_or_obj, *args, *
*kwargs)
356
357 def print_png(self, filename_or_obj, *args, **kwargs):
--> 358 FigureCanvasAgg.draw(self)
359 renderer = self.get_renderer()
360 original_dpi = renderer.dpi
C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.pyc in draw(self)
312
313 self.renderer = self.get_renderer()
--> 314 self.figure.draw(self.renderer)
315
316 def get_renderer(self):
C:\Python26\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist, renderer, *kl)
44 def draw_wrapper(artist, renderer, *kl):
45 before(artist, renderer)
---> 46 draw(artist, renderer, *kl)
47 after(artist, renderer)
48
C:\Python26\lib\site-packages\matplotlib\figure.pyc in draw(self, renderer)
771
772 # render the axes
--> 773 for a in self.axes: a.draw(renderer)
774
775 # render the figure text
C:\Python26\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist, renderer, *kl)
44 def draw_wrapper(artist, renderer, *kl):
45 before(artist, renderer)
---> 46 draw(artist, renderer, *kl)
47 after(artist, renderer)
48
C:\Python26\lib\site-packages\matplotlib\axes.pyc in draw(self, renderer, inframe)
1733
1734 for zorder, i, a in dsu:
-> 1735 a.draw(renderer)
1736
1737 renderer.close_group('axes')
C:\Python26\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist, renderer, *kl)
44 def draw_wrapper(artist, renderer, *kl):
45 before(artist, renderer)
---> 46 draw(artist, renderer, *kl)
47 after(artist, renderer)
48
C:\Python26\lib\site-packages\matplotlib\axis.pyc in draw(self, renderer, *args, **kwargs)
734 renderer.open_group(__name__)
735 interval = self.get_view_interval()
--> 736 for tick, loc, label in self.iter_ticks():
737 if tick is None: continue
738 if not mtransforms.interval_contains(interval, loc): continue
C:\Python26\lib\site-packages\matplotlib\axis.pyc in iter_ticks(self)
675 Iterate through all of the major and minor ticks.
676 """
--> 677 majorLocs = self.major.locator()
678 majorTicks = self.get_major_ticks(len(majorLocs))
679 self.major.formatter.set_locs(majorLocs)
C:\Python26\lib\site-packages\matplotlib\dates.pyc in __call__(self)
476 def __call__(self):
477 # if no data have been set, this will tank with a ValueError
--> 478 try: dmin, dmax = self.viewlim_to_dt()
479 except ValueError: return []
480
C:\Python26\lib\site-packages\matplotlib\dates.pyc in viewlim_to_dt(self)
452 def viewlim_to_dt(self):
453 vmin, vmax = self.axis.get_view_interval()
--> 454 return num2date(vmin, self.tz), num2date(vmax, self.tz)
455
456 def _get_unit(self):
C:\Python26\lib\site-packages\matplotlib\dates.pyc in num2date(x, tz)
247 """
248 if tz is None: tz = _get_rc_timezone()
--> 249 if not cbook.iterable(x): return _from_ordinalf(x, tz)
250 else: return [_from_ordinalf(val, tz) for val in x]
251
C:\Python26\lib\site-packages\matplotlib\dates.pyc in _from_ordinalf(x, tz)
177 dt = datetime.datetime(
178 dt.year, dt.month, dt.day, int(hour), int(minute), int(second),
--> 179 microsecond, tzinfo=UTC).astimezone(tz)
180
181 if microsecond>999990: # compensate for rounding errors
NotImplementedError: a tzinfo subclass must implement utcoffset()
WARNING: Failure executing file: <storm_tracker.py>
Paul M. Hobson
Senior Staff Engineer
--
Geosyntec Consultants
55 SW Yamhill St, Ste 200
Portland, OR 97204
Phone: 503.222.9518
www.geosyntec.com
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 17:19:05
|
On Tue, Jan 19, 2010 at 3:08 PM, Kurt Forrester
<kur...@ho...> wrote:
> Additional information that I forgot to supply was that on python
> 2.5/windows/matplotlib 0.98.xxx (my work machine, not accessible at the
> moment for the subversion number) this worked fine and there may have been a
> regression from this to the current 0.99.0 (in the ubuntu repository).
>
The "annotation_clip" feature is introduced in 0.99.0, and annotations
are not clipped before that version.
Again, your script works fine if I add annotation_clip parameter. So,
I'm not sure what's going on. Can anyone else reproduce this problem?
Just in case, with the following code, do you see label "Test"? It
should be seen near where the xlabel is seen.
fig = figure()
ax=subplot(111)
ax.annotate("Test", (-0.1, 0.5), annotation_clip=False)
Regards,
-JJ
|
|
From: Mario M. <me...@me...> - 2010-01-20 17:12:22
|
> Can you elaborate why you need to do this? As you can see in my example: #------ import numpy as np from matplotlib import pyplot,mpl x = np.arange(10) y = np.arange(25) z = np.floor(10*np.random.random((25,10))) pyplot.contourf(x,y,z) cb = pyplot.colorbar() pyplot.show() #------ the smallest value (0.0) is labeled with "-0.0". I just want to get rid of the minus sign. Cheers Mario > This is a general behavior of Axes in matplotlib (i.e., not colorbar > specific). There are things that are evaluated later when the figure > gets drawn. > You may use iter_ticks method if it fits your need. > > for j, p, l in cb.ax.yaxis.iter_ticks(): > print l > > To change the ticklabels of colorbar, they need to be set when the > colorbar is created, as Scott suggested. This is a limitation of the > current colobar implementation. Changing ticklabels (or locations) > after colorbar is created is quite tricky. > > Regards, > > -JJ -- Dr. Mario Mech Institute for Geophysics and Meteorology University of Cologne Zuelpicher Str. 49a 50674 Cologne Germany t: +49 (0)221 - 470 - 1776 f: +49 (0)221 - 470 - 5198 e: me...@me... w: http://www.meteo.uni-koeln.de/~mmech/ |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 17:06:29
|
On Wed, Jan 20, 2010 at 9:17 AM, Mario Mech <me...@me...> wrote:
> cl = cb.ax.get_yticklabels()
>
> results in a list of Text objects like Text(0,0,''). So my problem is more to get the TickLabels for vertical colorbars.
>
Can you elaborate why you need to do this?
This is a general behavior of Axes in matplotlib (i.e., not colorbar
specific). There are things that are evaluated later when the figure
gets drawn.
You may use iter_ticks method if it fits your need.
for j, p, l in cb.ax.yaxis.iter_ticks():
print l
To change the ticklabels of colorbar, they need to be set when the
colorbar is created, as Scott suggested. This is a limitation of the
current colobar implementation. Changing ticklabels (or locations)
after colorbar is created is quite tricky.
Regards,
-JJ
|
|
From: Sebastian B. <web...@th...> - 2010-01-20 16:15:59
|
Mario Mech wrote:
> ...
> #------
> import numpy as np
> from matplotlib import pyplot,mpl
>
> x = np.arange(10)
> y = np.arange(25)
> z = np.floor(10*np.random.random((25,10)))
>
> pyplot.contourf(x,y,z)
>
> cb = pyplot.colorbar()
>
> for j in cb.ax.get_yticklabels():
> print(j)
> #----
>
> results in:
>
> Text(0,0,'')
> ...
I think you have to pyplot.show() or pyplot.savefig("deleteme.ps") in
order to have the ticklabels populated.
best,
sebastian.
|
|
From: Mario M. <me...@me...> - 2010-01-20 15:18:19
|
> This works for me. > >> But >> >> cl = cb.ax.get_yticklabels() >> >> results in a list of Text objects like Text(0,0,''). > > I have no idea what's happening then. I see: > > for l in cl: > print(l) > > Text(0,0,'bla') > Text(0.166667,0.166667,'1.5') > Text(0.333333,0.333333,'3.0') > Text(0.5,0.5,'4.5') > Text(0.666667,0.666667,'6.0') > Text(0.833333,0.833333,'7.5') > Text(1,1,'9.0') > > Cheers, > Scott Has it anything to do with my matplotlib version (0.99.0) and python (2.6.4) on ubuntu karmic? following code: #------ import numpy as np from matplotlib import pyplot,mpl x = np.arange(10) y = np.arange(25) z = np.floor(10*np.random.random((25,10))) pyplot.contourf(x,y,z) cb = pyplot.colorbar() for j in cb.ax.get_yticklabels(): print(j) #---- results in: Text(0,0,'') Text(0,0,'') Text(0,0,'') Text(0,0,'') Text(0,0,'') Text(0,0,'') Text(0,0,'') That's not what i expected and makes it hard to change single ticklabels. Cheers, Mario -- Dr. Mario Mech Institute for Geophysics and Meteorology University of Cologne Zuelpicher Str. 49a 50674 Cologne Germany t: +49 (0)221 - 470 - 1776 f: +49 (0)221 - 470 - 5198 e: me...@me... w: http://www.meteo.uni-koeln.de/~mmech/ |
|
From: Scott S. <sco...@gm...> - 2010-01-20 14:43:17
|
>2010/1/20 Mario Mech <me...@me...>:
> Ok, something like
>
> cl = cb.ax.get_yticklabels()
> cl[0].set_text('bla')
> cb.ax.set_yticklabels([elem.get_text() for elem in cl])
This works for me.
> But
>
> cl = cb.ax.get_yticklabels()
>
> results in a list of Text objects like Text(0,0,'').
I have no idea what's happening then. I see:
for l in cl:
print(l)
Text(0,0,'bla')
Text(0.166667,0.166667,'1.5')
Text(0.333333,0.333333,'3.0')
Text(0.5,0.5,'4.5')
Text(0.666667,0.666667,'6.0')
Text(0.833333,0.833333,'7.5')
Text(1,1,'9.0')
Cheers,
Scott
|
|
From: Mario M. <me...@me...> - 2010-01-20 14:17:27
|
On 20.01.2010 14:55, Scott Sinclair wrote:
>> 2010/1/20 Mario Mech<me...@me...>:
>> cb = pyplot.colorbar(format=r"%2.1f")
>> for j in cb.ax.get_yticklabels():
>> j.set_text('bla')
>> pyplot.show()
>>
>> Doesn't do anything.
>
> It looks like cb.ax.get_yticklabels() returns a list of copies of the
> Text objects. Since you are only changing the copies it has no effect
> on your figure.
> You'll need to use cb.ax.set_yticklabels() and pass a list of strings
> to use as tick labels. See
> http://matplotlib.sourceforge.net/examples/pylab_examples/colorbar_tick_labelling_demo.html
> for an example.
>
> Cheers,
> Scott
Ok, something like
cl = cb.ax.get_yticklabels()
cl[0].set_text('bla')
cb.ax.set_yticklabels([elem.get_text() for elem in cl])
would work for the horizontal colorbars and y replaced by x. But
cl = cb.ax.get_yticklabels()
results in a list of Text objects like Text(0,0,''). So my problem is more to get the TickLabels for vertical colorbars.
Cheers
Mario
--
Dr. Mario Mech
Institute for Geophysics and Meteorology
University of Cologne
Zuelpicher Str. 49a
50674 Cologne
Germany
t: +49 (0)221 - 470 - 1776
f: +49 (0)221 - 470 - 5198
e: me...@me...
w: http://www.meteo.uni-koeln.de/~mmech/
|
|
From: Scott S. <sco...@gm...> - 2010-01-20 13:55:35
|
>2010/1/20 Mario Mech <me...@me...>:
> cb = pyplot.colorbar(format=r"%2.1f")
> for j in cb.ax.get_yticklabels():
> j.set_text('bla')
> pyplot.show()
>
> Doesn't do anything.
It looks like cb.ax.get_yticklabels() returns a list of copies of the
Text objects. Since you are only changing the copies it has no effect
on your figure.
You'll need to use cb.ax.set_yticklabels() and pass a list of strings
to use as tick labels. See
http://matplotlib.sourceforge.net/examples/pylab_examples/colorbar_tick_labelling_demo.html
for an example.
Cheers,
Scott
|
|
From: Mario M. <me...@me...> - 2010-01-20 13:27:36
|
Hi,
it's probably a rather simple problem. Unfortunately I'm unable to solve it.
The following code example describes my problem:
import numpy as np
from matplotlib import pyplot,mpl
x = np.arange(10)
y = np.arange(25)
z = np.floor(10*np.random.random((25,10)))
pyplot.contourf(x,y,z)
cb = pyplot.colorbar(format=r"%2.1f")
for j in cb.ax.get_yticklabels():
j.set_text('bla')
pyplot.show()
Now I'd like to change the smallest label of the colorbar to 0.0 (without the minus sign). But any attemps to change the ticklabels of the colorbar fail:
cb = pyplot.colorbar(format=r"%2.1f")
for j in cb.ax.get_yticklabels():
j.set_text('bla')
pyplot.show()
Doesn't do anything. Evenmore I don't understand why
for j in cb.ax.get_yticklabels():
print str(j)
results in
Text(0,0,'')
Text(0,0,'')
Text(0,0,'')
Text(0,0,'')
Text(0,0,'')
Text(0,0,'')
Text(0,0,'')
Thanks in advance
Mario Mech
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-20 05:27:45
|
Using the patheffect in the svn, shadows can be easily supported in all the patch-like classes, including the patch of the texts. (For example, see the last example in patheffect_demo.py). So, it should be straight forward and I don't see any harm in doing that. However, I personally prefer to have shadow patches as a separate artists, so that the zorder of the shadows can be respected. For example, in the attached example, I want the shadow of "Text 1" does not block the text "Test 2". But doing this is not straight forward and the code of Text class need to be further modified. I'll take a look later. Regards, -JJ On Tue, Jan 19, 2010 at 9:47 PM, John Hunter <jd...@gm...> wrote: > On Tue, Jan 19, 2010 at 4:34 PM, Jae-Joon Lee <lee...@gm...> wrote: >> This is generally a very difficult thing to do, as the position and >> the extent of the text is determined when the figure is drawn. >> >> The best way, I guess, is to create a customized Text class, but I do >> not recommend this unless you're familiar with matplotlib internals. > > JJ -- what do you think about adding a "shadow" kwarg to the bbox > props -- an extra kwarg much like "pad"? Shouldn't be too hard to > implement in the text class. Or are there some dangerous curves I'm > overlooking? > > JDH > |
|
From: Jeff W. <js...@fa...> - 2010-01-20 04:02:55
|
Michael Mason wrote: > Hello, > > I have a set of NetCDF files that are in Lambert Conformal projection, > and I want to convert them to rectilinear, lat/lon projection. I'm > able to do this and plot the data and print the data out to a png > file. However, I want to get access to the underlying data as it > appears after the projection. I want to take this data and write it > out to another file using an in-house file format. > > I've been trying to probe the objects that are involved in creating > the images using 'dir' to see if there is a way that I can get access > to the underlying data, but I've come up short so far. > > Here is a skeleton of the code that I'm working with: > > # create Basemap using this info > map = Basemap(projection='merc', > lat_0 = map_center_lat, lon_0 = -map_center_lon, > llcrnrlat = min_lat, urcrnrlat = max_lat, > llcrnrlon = min_lon, urcrnrlon = max_lon, > rsphere = 6371200.0, resolution = 'f', > area_thresh = 10000) > > # this part is what takes the most amount of time > # x, y = map(lons.data, lats.data) # compute map projection coordinates. > x, y = map(lons[0], lats[0]) > > # the first slot in the shape array denotes the number of hours > num_hours = data.shape[0] > > # frame counter for the output filenames > frame_num = 0 > > # step through all of the hours > for hr in range (num_hours): > > # get all of the data (2D data) for the current hr > data_hr = data[hr, :, :] > > # create a figure > fig = plt.figure(figsize=(10,8)) > plt.subplot(111) > ax = plt.gca() > dlon = 1.0 > > for xlabel_i in ax.get_xticklabels(): > xlabel_i.set_fontsize(4) > > for ylabel_i in ax.get_yticklabels(): > ylabel_i.set_fontsize(4) > > draw_map (map, ax, dlon) > > v = <compute_contour_levels> > > p = map.contourf (x, y, data_hr, v) > > Any suggestions? Thanks! > > Michael: contourf is not doing performing any transformations or interpolations on the input data - it's just plotting data on the grid defined by the x and y coordinates of the Lambert conformal grid that you give it. You can use the interpolation function "interp" to interpolate from one rectilinear grid to another, but contourf is not doing that under the hood. -Jeff |
|
From: John H. <jd...@gm...> - 2010-01-20 02:47:43
|
On Tue, Jan 19, 2010 at 4:34 PM, Jae-Joon Lee <lee...@gm...> wrote: > This is generally a very difficult thing to do, as the position and > the extent of the text is determined when the figure is drawn. > > The best way, I guess, is to create a customized Text class, but I do > not recommend this unless you're familiar with matplotlib internals. JJ -- what do you think about adding a "shadow" kwarg to the bbox props -- an extra kwarg much like "pad"? Shouldn't be too hard to implement in the text class. Or are there some dangerous curves I'm overlooking? JDH |