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
(47) |
2
(13) |
3
(12) |
4
(16) |
5
(3) |
|
6
(6) |
7
(20) |
8
(45) |
9
(24) |
10
(30) |
11
(14) |
12
(4) |
|
13
(1) |
14
(6) |
15
(6) |
16
(10) |
17
(15) |
18
(13) |
19
(4) |
|
20
|
21
(14) |
22
(13) |
23
(9) |
24
(19) |
25
(24) |
26
|
|
27
(4) |
28
(20) |
29
(17) |
30
(7) |
|
|
|
|
From: <PH...@Ge...> - 2010-06-04 00:28:31
|
> -----Original Message----- > From: Christoph Gohlke [mailto:cg...@uc...] > Sent: Sunday, May 30, 2010 3:41 PM > To: mat...@li... > Subject: [Matplotlib-users] leading whitespace in text > > Hello, > > consider the following simple code: > > import matplotlib > from matplotlib import pyplot > pyplot.text(0, 0, " <--", family='monospace') > pyplot.show() > > Using matplotlib-0.99.3.win32-py2.6, the text '<--' is drawn with an > x-offset from the y-axis, as expected from the presence of leading > whitespace. > > Using matplotlib-1.0.svn.win32-py2.6 rev 8347, the leading whitespace is > apparently removed from the text and '<--' is drawn right at the y-axis > with no x-offset. > > In both cases the font is monospace. > > Is this change intended or a regression in 1.0svn? Christoph, I haven't had a chance to try this out with my machine that has MPL 1.0svn on it, but is there any chance that you have mpl.rcParams['text.usetex'] = True when you get the error? -paul |
|
From: Jim V. <Jim...@no...> - 2010-06-03 21:33:57
|
OK, upon a more careful review of the code, I made a simple(-minded)
error. Specifying vmin and vmax do work (as everyone already knew).
Thanks to Jae-Joon and Eric for their quick replies. and valuable
suggestions.
-- jv
Jim Vickroy wrote:
> I want to generate a 2-d figure with a (fixed) color scale that does
> not vary with the range of the data being plotted.
>
> How do I do this? Attempts to specify vimin and vmax appear to be
> ignored.
>
> The following example:
>
> #<code>
> import numpy
> data = numpy.zeros(shape=(240,240),dtype=int)
> data[ 0: 80] = -1
> data[ 80:160] = 0
> data[160:] = 1
>
> import matplotlib.pyplot as plot
> figure = plot.figure()
> ax = figure.add_subplot(111)
> cax = ax.imshow(data, interpolation='bilinear')
> ax.set_title('test data with fixed colorbar')
> colorbar = figure.colorbar(cax, ticks=[-1, 0, 1])
> colorbar.ax.set_yticklabels(['-1', '0', '1'])
> plot.show()
> #</code>
>
> produces a figure with 3 color bands (blue,green,red) and matching
> color bar with labels (-1,0,1) as expected.
>
> if the data[160:]=1 specification is deleted, in the above code, the
> resulting figure has 2 color bands (blue,red) and the associated color
> bar is identical to the original, but the labels are (-1,0).
>
> What I want, in this second case, is a blue-green figure and a color
> bar with labels identical to the original example.
>
> -- jv
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: Eric F. <ef...@ha...> - 2010-06-03 21:17:35
|
On 06/03/2010 10:43 AM, Jim Vickroy wrote:
> Eric Firing wrote:
>> On 06/03/2010 10:00 AM, Jim Vickroy wrote:
>>
>>> I want to generate a 2-d figure with a (fixed) color scale that does
>>> not vary with the range of the data being plotted.
>>>
>>> How do I do this? Attempts to specify vimin and vmax appear to be ignored.
>>>
>>> The following example:
>>>
>>> #<code>
>>> import numpy
>>> data = numpy.zeros(shape=(240,240),dtype=int)
>>> data[ 0: 80] = -1
>>> data[ 80:160] = 0
>>> data[160:] = 1
>>>
>>> import matplotlib.pyplot as plot
>>> figure = plot.figure()
>>> ax = figure.add_subplot(111)
>>> cax = ax.imshow(data, interpolation='bilinear')
>>> ax.set_title('test data with fixed colorbar')
>>>
>>
>> Adding to what JJ said, note that setting the ticks on the colorbar has
>> no effect on the norm used in color mapping. The vmin and vmax kwargs
>> to imshow get passed to the norm, so they do set the mapping range.
>>
>>
>>> colorbar = figure.colorbar(cax, ticks=[-1, 0, 1])
>>> colorbar.ax.set_yticklabels(['-1', '0', '1'])
>>>
>>
>> Please avoid setting the ticklabels directly--it is almost always
>> unnecessary, and it is too easy to shoot yourself in the foot. If the
>> default tick label formatting is inadequate, you can use the format
>> kwarg in colorbar.
>>
>> From the docstring:
>>
>> *ticks* [ None | list of ticks | Locator object ]
>> If None, ticks are determined automatically from the
>> input.
>> *format* [ None | format string | Formatter object ]
>> If None, the
>> :class:`~matplotlib.ticker.ScalarFormatter` is used.
>> If a format string is given, e.g. '%.3f', that is
>> used. An alternative
>> :class:`~matplotlib.ticker.Formatter` object may be
>> given instead.
>>
>>
>> Eric
>>
>
> Thanks for this advice.
>
> In my case, the data being plotted is in the range 0-255, but the
> color-bar labels are to be in the range 1-4095. So I have the following
> code snippet:
>
> colorbar = figure.colorbar(image, cax, orientation='vertical', ticks=(0,
> 64, 128, 192, 254))
> colorbar.ax.set_yticklabels(('1','8','64','512','4095')) # colorbar
> labels (which are to be in units of DN/sec on a log10 scale)
>
> Is there a better way to do this?
The advantage of using a custom formatter is that it formats actual tick
values, so if you decide to use a different set of tick locations, you
don't have to remember to change the labels. A formatter for a
complicated case such as the above could use a dictionary, which would
at least generate a KeyError if you changed a tick without adding the
new location to the dictionary, or, better, it could calculate the label
numbers. Suppose you have a function to do the translation:
def to_DNpersec(x):
dn = ... whatever function of x
return dn
import matplotlib as mpl
class DNpersecFormatter(mpl.ticker.Formatter):
def __call__(self, val, pos=None):
dn = to_DNpersec(val)
return "%d" % round(dn)
...
colorbar = figure.colorbar(image, cax, orientation='vertical',
ticks=(0, 64, 128, 192, 254),
format=DNpersecFormatter())
Eric
>
> -- jv
>
>
>>
>>
>>> plot.show()
>>> #</code>
>>>
>>> produces a figure with 3 color bands (blue,green,red) and matching color
>>> bar with labels (-1,0,1) as expected.
>>>
>>> if the data[160:]=1 specification is deleted, in the above code, the
>>> resulting figure has 2 color bands (blue,red) and the associated color
>>> bar is identical to the original, but the labels are (-1,0).
>>>
>>> What I want, in this second case, is a blue-green figure and a color bar
>>> with labels identical to the original example.
>>>
>>> -- jv
|
|
From: Jim V. <Jim...@no...> - 2010-06-03 20:43:40
|
Eric Firing wrote:
> On 06/03/2010 10:00 AM, Jim Vickroy wrote:
>
>> I want to generate a 2-d figure with a (fixed) color scale that does
>> not vary with the range of the data being plotted.
>>
>> How do I do this? Attempts to specify vimin and vmax appear to be ignored.
>>
>> The following example:
>>
>> #<code>
>> import numpy
>> data = numpy.zeros(shape=(240,240),dtype=int)
>> data[ 0: 80] = -1
>> data[ 80:160] = 0
>> data[160:] = 1
>>
>> import matplotlib.pyplot as plot
>> figure = plot.figure()
>> ax = figure.add_subplot(111)
>> cax = ax.imshow(data, interpolation='bilinear')
>> ax.set_title('test data with fixed colorbar')
>>
>
> Adding to what JJ said, note that setting the ticks on the colorbar has
> no effect on the norm used in color mapping. The vmin and vmax kwargs
> to imshow get passed to the norm, so they do set the mapping range.
>
>
>> colorbar = figure.colorbar(cax, ticks=[-1, 0, 1])
>> colorbar.ax.set_yticklabels(['-1', '0', '1'])
>>
>
> Please avoid setting the ticklabels directly--it is almost always
> unnecessary, and it is too easy to shoot yourself in the foot. If the
> default tick label formatting is inadequate, you can use the format
> kwarg in colorbar.
>
> From the docstring:
>
> *ticks* [ None | list of ticks | Locator object ]
> If None, ticks are determined automatically from the
> input.
> *format* [ None | format string | Formatter object ]
> If None, the
> :class:`~matplotlib.ticker.ScalarFormatter` is used.
> If a format string is given, e.g. '%.3f', that is
> used. An alternative
> :class:`~matplotlib.ticker.Formatter` object may be
> given instead.
>
>
> Eric
>
Thanks for this advice.
In my case, the data being plotted is in the range 0-255, but the
color-bar labels are to be in the range 1-4095. So I have the following
code snippet:
colorbar = figure.colorbar(image, cax, orientation='vertical',
ticks=(0, 64, 128, 192, 254))
colorbar.ax.set_yticklabels(('1','8','64','512','4095')) # colorbar
labels (which are to be in units of DN/sec on a log10 scale)
Is there a better way to do this?
-- jv
>
>
>> plot.show()
>> #</code>
>>
>> produces a figure with 3 color bands (blue,green,red) and matching color
>> bar with labels (-1,0,1) as expected.
>>
>> if the data[160:]=1 specification is deleted, in the above code, the
>> resulting figure has 2 color bands (blue,red) and the associated color
>> bar is identical to the original, but the labels are (-1,0).
>>
>> What I want, in this second case, is a blue-green figure and a color bar
>> with labels identical to the original example.
>>
>> -- jv
>>
>>
>>
>> ------------------------------------------------------------------------------
>> ThinkGeek and WIRED's GeekDad team up for the Ultimate
>> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
>> lucky parental unit. See the prize list and enter to win:
>> http://p.sf.net/sfu/thinkgeek-promo
>>
>>
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: Eric F. <ef...@ha...> - 2010-06-03 20:25:27
|
On 06/03/2010 10:00 AM, Jim Vickroy wrote:
> I want to generate a 2-d figure with a (fixed) color scale that does
> not vary with the range of the data being plotted.
>
> How do I do this? Attempts to specify vimin and vmax appear to be ignored.
>
> The following example:
>
> #<code>
> import numpy
> data = numpy.zeros(shape=(240,240),dtype=int)
> data[ 0: 80] = -1
> data[ 80:160] = 0
> data[160:] = 1
>
> import matplotlib.pyplot as plot
> figure = plot.figure()
> ax = figure.add_subplot(111)
> cax = ax.imshow(data, interpolation='bilinear')
> ax.set_title('test data with fixed colorbar')
Adding to what JJ said, note that setting the ticks on the colorbar has
no effect on the norm used in color mapping. The vmin and vmax kwargs
to imshow get passed to the norm, so they do set the mapping range.
> colorbar = figure.colorbar(cax, ticks=[-1, 0, 1])
> colorbar.ax.set_yticklabels(['-1', '0', '1'])
Please avoid setting the ticklabels directly--it is almost always
unnecessary, and it is too easy to shoot yourself in the foot. If the
default tick label formatting is inadequate, you can use the format
kwarg in colorbar.
From the docstring:
*ticks* [ None | list of ticks | Locator object ]
If None, ticks are determined automatically from the
input.
*format* [ None | format string | Formatter object ]
If None, the
:class:`~matplotlib.ticker.ScalarFormatter` is used.
If a format string is given, e.g. '%.3f', that is
used. An alternative
:class:`~matplotlib.ticker.Formatter` object may be
given instead.
Eric
> plot.show()
> #</code>
>
> produces a figure with 3 color bands (blue,green,red) and matching color
> bar with labels (-1,0,1) as expected.
>
> if the data[160:]=1 specification is deleted, in the above code, the
> resulting figure has 2 color bands (blue,red) and the associated color
> bar is identical to the original, but the labels are (-1,0).
>
> What I want, in this second case, is a blue-green figure and a color bar
> with labels identical to the original example.
>
> -- jv
>
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Jim V. <Jim...@no...> - 2010-06-03 20:22:54
|
Jae-Joon Lee wrote: > On Thu, Jun 3, 2010 at 4:00 PM, Jim Vickroy <Jim...@no...> wrote: > >> How do I do this? Attempts to specify vimin and vmax appear to be ignored. >> >> > > Hmm, > vmin and vmax should work. > > cax = ax.imshow(data, interpolation='bilinear', vmin=-1, vmax=1) > > If these are still ignored, what the following line prints? > > print cax.get_clim() > > Regards, > > -JJ > You are absolutely correct! My apologies for not testing this prior to posting. I'm really specifying vmin and vmax as parameters for pcolormesh and the labels, for the associated color bar, vary (despite being explicitly specified in figure.colorbar(...,ticks=...)) with the range of the data being plotted. I over-simplified, so I will try to produce a better version of the actual code demonstrating the problem. Thank-you for your quick reply. -- jv |
|
From: Jae-Joon L. <lee...@gm...> - 2010-06-03 20:10:26
|
On Thu, Jun 3, 2010 at 4:00 PM, Jim Vickroy <Jim...@no...> wrote: > How do I do this? Attempts to specify vimin and vmax appear to be ignored. > Hmm, vmin and vmax should work. cax = ax.imshow(data, interpolation='bilinear', vmin=-1, vmax=1) If these are still ignored, what the following line prints? print cax.get_clim() Regards, -JJ |
|
From: Jim V. <Jim...@no...> - 2010-06-03 20:00:26
|
I want to generate a 2-d figure with a (fixed) color scale that does
not vary with the range of the data being plotted.
How do I do this? Attempts to specify vimin and vmax appear to be ignored.
The following example:
#<code>
import numpy
data = numpy.zeros(shape=(240,240),dtype=int)
data[ 0: 80] = -1
data[ 80:160] = 0
data[160:] = 1
import matplotlib.pyplot as plot
figure = plot.figure()
ax = figure.add_subplot(111)
cax = ax.imshow(data, interpolation='bilinear')
ax.set_title('test data with fixed colorbar')
colorbar = figure.colorbar(cax, ticks=[-1, 0, 1])
colorbar.ax.set_yticklabels(['-1', '0', '1'])
plot.show()
#</code>
produces a figure with 3 color bands (blue,green,red) and matching color
bar with labels (-1,0,1) as expected.
if the data[160:]=1 specification is deleted, in the above code, the
resulting figure has 2 color bands (blue,red) and the associated color
bar is identical to the original, but the labels are (-1,0).
What I want, in this second case, is a blue-green figure and a color bar
with labels identical to the original example.
-- jv
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-06-03 17:22:37
|
On Thu, Jun 3, 2010 at 12:52 PM, Benjamin Root <ben...@ou...> wrote: > Well, the link is still not back, so I will probe you a bit further. You > say that axes_grid is provided for backward compatibility, does that mean > that I should be using axes_grid1 for new code? I have noticed differences > in behavior if I import axes_grid versus axes_grid1. For example, my > colorbar labels wouldn't appear unless I used axes_grid1. > > Ben Root > Yes, axes_grid1 is recommended for new code. The "axes_grid" in the svn actually imports the "axes_grid1" and "axisaritst" modules. With axes_grid1, I tried to fix some compatibility issue that axes_grid had with the original matplolib. And I guess the colorbar label issue was one of them. With axes_grid, the colorbar labels are invisible by default, but they are visible in axes_grid1. Regards, -JJ |
|
From: Benjamin R. <ben...@ou...> - 2010-06-03 16:53:05
|
Well, the link is still not back, so I will probe you a bit further. You say that axes_grid is provided for backward compatibility, does that mean that I should be using axes_grid1 for new code? I have noticed differences in behavior if I import axes_grid versus axes_grid1. For example, my colorbar labels wouldn't appear unless I used axes_grid1. Ben Root On Tue, Jun 1, 2010 at 5:26 PM, Jae-Joon Lee <lee...@gm...> wrote: > this is supposed to be explained in > > http://matplotlib.sourceforge.net/trunk-docs/users/gridspec.html > > But the trunk documentation is failed to build at this moment. > > In short, in the svn version of matplotlib, axes_grid is divided into > two separate modules, axes_grid1 and axisartist (axes_grid is provided > for backward compatibility). > Please see the above link when it is back online. > > Regards, > > -JJ > > > On Tue, Jun 1, 2010 at 5:34 PM, Benjamin Root <ben...@ou...> wrote: > > Hello, > > > > Does anybody know what is the difference between mpl_toolkit.axes_grid > and > > mpl_toolkit.axes_grid1? > > > > Thanks, > > Ben Root > > > > > ------------------------------------------------------------------------------ > > > > > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > |
|
From: Jae-Joon L. <lee...@gm...> - 2010-06-03 15:42:11
|
On Wed, Jun 2, 2010 at 2:46 PM, Denis Laxalde <dla...@gm...> wrote: > That would indeed be a better approach. Can somebody points me to the > particular methods/attributes to look at ? > As far as I can see, there is no public methods/attributes. Can you file a bug so that Reinier (or others) can pick this up later? https://sourceforge.net/tracker/?group_id=80706&atid=560720 -JJ |
|
From: Jae-Joon L. <lee...@gm...> - 2010-06-03 15:33:14
|
The currently implemented bounding box algorithm is very simple and it
basically only accounts the title, axis label and ticklabels etc. I
thought about implementing a general algorithm that accounts all the
visible artist, but I found it very difficult (at least for me) given
the support of the spline path and clipping. So, at the moment this is
beyond me and I have no plan to improve it. But any contribution will
be welcomed.
As a workaround, savefig can take bbox_extra_artists keyword (this may
only be in the svn version though), which is a list artist that needs
to be accounted for the bounding box calculation. So in your case, the
below code will work.
t1 = ax.text(-0.2,0.5,'text',transform=ax.transAxes)
fig.savefig('test.png', bbox_inches='tight', bbox_extra_artists=[t1])
Given that this will not be fixed in near future and a workaround
being suggested, I'm moving this to a feature request.
-JJ
On Thu, Jun 3, 2010 at 10:05 AM, Thomas Robitaille
<tho...@gm...> wrote:
> Hello,
>
> I have run into a problem with the bbox_inches='tight' option which allows a tight bounding box to be computed for a plot. In the following example:
>
> import matplotlib
> matplotlib.use('Agg')
> import matplotlib.pyplot as mpl
>
> fig = mpl.figure()
> ax = fig.add_subplot(1,1,1)
> ax.text(-0.2,0.5,'text',transform=ax.transAxes)
> fig.savefig('test.png', bbox_inches='tight')
>
> matplotlib produces a plot where the text label does not appear. This may be due to the bounding box algorithm not taking into account text written using Axes.text that could fall outside the Axes. One solution is to use set_xlabel and set_ylabel, for which the bounding box is correctly calculated, but in some cases it is desirable to plot labels outside the box using 'text' (for example if multiple labels are needed).
>
> I have submitted a bug report here:
>
> https://sourceforge.net/tracker/?func=detail&aid=3011032&group_id=80706&atid=560720
>
> Cheers,
>
> Tom
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit. See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: Thomas R. <tho...@gm...> - 2010-06-03 14:05:58
|
Hello,
I have run into a problem with the bbox_inches='tight' option which allows a tight bounding box to be computed for a plot. In the following example:
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as mpl
fig = mpl.figure()
ax = fig.add_subplot(1,1,1)
ax.text(-0.2,0.5,'text',transform=ax.transAxes)
fig.savefig('test.png', bbox_inches='tight')
matplotlib produces a plot where the text label does not appear. This may be due to the bounding box algorithm not taking into account text written using Axes.text that could fall outside the Axes. One solution is to use set_xlabel and set_ylabel, for which the bounding box is correctly calculated, but in some cases it is desirable to plot labels outside the box using 'text' (for example if multiple labels are needed).
I have submitted a bug report here:
https://sourceforge.net/tracker/?func=detail&aid=3011032&group_id=80706&atid=560720
Cheers,
Tom
|
|
From: Denis L. <dla...@gm...> - 2010-06-02 18:46:30
|
On Wed, 02 Jun 2010 06:54:11 -1000, Eric Firing wrote:
> On 06/02/2010 05:53 AM, Jae-Joon Lee wrote:
>> On Wed, Jun 2, 2010 at 10:42 AM, Denis Laxalde wrote:
>>> This is set in axis3d module (class Axis), by _AXINFO.
>>> So far, I haven't found a way to modify colors/transparency but to edit
>>> the latter file. Is this hard-coded or is there a way to modify this a
>>> posteriori ?
>>
>> You can simply modify that dictionary.
>
>
> ...with the caution that you are modifying a private
> implementation-dependent variable, so your code is more likely to break
> with future versions of mplot3d, and with no deprecation or other
> warning, than if you could stick to methods and attributes without the
> leading underscore.
That would indeed be a better approach. Can somebody points me to the
particular methods/attributes to look at ?
Thanks in advance,
Denis
|
|
From: Eric F. <ef...@ha...> - 2010-06-02 16:54:21
|
On 06/02/2010 05:53 AM, Jae-Joon Lee wrote:
> On Wed, Jun 2, 2010 at 10:42 AM, Denis Laxalde<dla...@gm...> wrote:
>> This is set in axis3d module (class Axis), by _AXINFO.
>> So far, I haven't found a way to modify colors/transparency but to edit
>> the latter file. Is this hard-coded or is there a way to modify this a
>> posteriori ?
>>
>> Cheers,
>>
>> Denis
>>
>
> You can simply modify that dictionary.
...with the caution that you are modifying a private
implementation-dependent variable, so your code is more likely to break
with future versions of mplot3d, and with no deprecation or other
warning, than if you could stick to methods and attributes without the
leading underscore.
Eric
> To have different colors for different axes, define _AXINFO in the
> instance level as below.
>
>
> from mpl_toolkits.mplot3d import axes3d, axis3d
> import matplotlib.pyplot as plt
> import numpy as np
>
>
> fig = plt.figure()
> ax = axes3d.Axes3D(fig)
>
> myAXINFO = {
> 'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2),
> 'color': (0.55, 0.95, 0.95, 0.5, 0.2)},
> 'y': {'i': 1, 'tickdir': 0, 'juggled': (0, 1, 2),
> 'color': (0.50, 0.90, 0.90, 0.5, 0.8)},
> 'z': {'i': 2, 'tickdir': 0, 'juggled': (0, 2, 1),
> 'color': (0.525, 0.925, 0.925, 0.5, 0.5)},
> }
>
>
> ax.w_xaxis._AXINFO = myAXINFO
> ax.w_yaxis._AXINFO = myAXINFO
> ax.w_zaxis._AXINFO = myAXINFO
>
> # to change the global behavior
> # axis3d.Axis._AXINFO.update(myAXINFO)
>
> plt.show()
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-06-02 15:53:35
|
On Wed, Jun 2, 2010 at 10:42 AM, Denis Laxalde <dla...@gm...> wrote:
> This is set in axis3d module (class Axis), by _AXINFO.
> So far, I haven't found a way to modify colors/transparency but to edit
> the latter file. Is this hard-coded or is there a way to modify this a
> posteriori ?
>
> Cheers,
>
> Denis
>
You can simply modify that dictionary.
To have different colors for different axes, define _AXINFO in the
instance level as below.
from mpl_toolkits.mplot3d import axes3d, axis3d
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = axes3d.Axes3D(fig)
myAXINFO = {
'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2),
'color': (0.55, 0.95, 0.95, 0.5, 0.2)},
'y': {'i': 1, 'tickdir': 0, 'juggled': (0, 1, 2),
'color': (0.50, 0.90, 0.90, 0.5, 0.8)},
'z': {'i': 2, 'tickdir': 0, 'juggled': (0, 2, 1),
'color': (0.525, 0.925, 0.925, 0.5, 0.5)},
}
ax.w_xaxis._AXINFO = myAXINFO
ax.w_yaxis._AXINFO = myAXINFO
ax.w_zaxis._AXINFO = myAXINFO
# to change the global behavior
# axis3d.Axis._AXINFO.update(myAXINFO)
plt.show()
|
|
From: Howard S. <hs...@nv...> - 2010-06-02 15:30:53
|
Thanks alot, Alan, Angus, Ben, Eric and Malte, for the tips and the varieties. Matplotlib is awesome! Howard Sun, Ph.D. NVIDIA CORP. 2701 San Tomas Expressway Santa Clara, CA 95050 T (408) 566-5036 F (408) 486-8207 -----Original Message----- From: Eric Firing [mailto:ef...@ha...] Sent: Tuesday, June 01, 2010 7:07 PM To: mat...@li... Subject: Re: [Matplotlib-users] multiple lines On 06/01/2010 02:47 PM, Benjamin Root wrote: > Howard, > > Are you trying to plot 4 lines with the same y-axis or with two or more > y-axes? I only ask because the values of your 5th column are many > orders of magnitude smaller than the values of the other ys. > > If you want multiple y-axes on the same plot, then you might want to > look at Parasite Axes. If not, then you can very simply plot this like > so (assuming that 'data' is a 2-D numpy array). > > import matplotlib.pyplot as plt > > plt.plot(data[:, 0], data[:, 1]) > plt.plot(data[:, 0], data[:, 2]) > plt.plot(data[:, 0], data[:, 3]) > plt.plot(data[:, 0], data[:, 4]) > > plt.show() > > I am sure that my 4 plot statements can be simplified, but I can't > verify that right now. import numpy as np import matplotlib.pyplot as plt x = np.arange(2, 5, 0.3) y = np.random.randn(len(x), 4) # dummy data for illustration plt.plot(x, y) So with the data array as above, it would be plt.plot(data[:,0], data[:, 1:]) Eric > > I hope that helps. > > Ben Root ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- |
|
From: hettling <het...@fe...> - 2010-06-02 14:44:51
|
Dear all, I'm trying to set the font for math elements in my plots to 'Arial' when saving my plot to an eps. For all other text in plots, I set ## matplotlib.rcParams['font.sans-serif']=["Arial"] ## and it worked. My default rcparams for mathtext look like this: 'mathtext.bf': 'serif:bold', 'mathtext.cal': 'cursive', 'mathtext.default': 'it', 'mathtext.fallback_to_cm': True, 'mathtext.fontset': 'cm', 'mathtext.it': 'serif:italic', 'mathtext.rm': 'serif', 'mathtext.sf': 'sans\\-serif', 'mathtext.tt': 'monospace', I do not quite understand all these parameters and could not find it out in the ocumentation. Is there an easy way to ensure that all text (normal and mathtext) I put in my plots appear in Arial? If not, is at least the font of mathtext embedded into the eps? Hope I made my problem clear, thanks in advance, Hannes |
|
From: Denis L. <dla...@gm...> - 2010-06-02 14:42:54
|
This is set in axis3d module (class Axis), by _AXINFO.
So far, I haven't found a way to modify colors/transparency but to edit
the latter file. Is this hard-coded or is there a way to modify this a
posteriori ?
Cheers,
Denis
Le 02-06-2010, Benjamin Root <ben...@ou...> a
écrit :
> Huh, how about that? I never noticed that before. I wonder if that
> is a bug or if it is intentional?
>
> Ben Root
>
> On Tue, Jun 1, 2010 at 5:28 PM, Denis Laxalde
> <dla...@gm...> wrote:
>
>> Hi Ben,
>>
>> Thanks for your answer. Actually, options for savefig seem to only
>> operate on 2D axes whereas I'm trying to change the color of 3D axes
>> (x,y,z) which, by default, have a grid with a gray background. I
>> manage to remove the grid lines but not the background color. (My
>> initial question was not very clear perhaps...)
>>
>> Denis
>>
>>
>> Le mardi 01 juin 2010 =E0 16:57 -0500, Benjamin Root a =E9crit :
>> > Denis,
>> >
>> > There are probably other ways, but the one that I know off the top
>> > of m=
> y
>> > head is done at the savefig() function. If you want to remove the
>> > background entirely, you can specify the keyword argument
>> transparent=3DTrue.
>> > You can change the color using the facecolor keyword argument. You
>> > can specify any color in that argument like you would elsewhere in
>> matplotlib.
>> >
>> > Ben Root
>> >
>> > On Tue, Jun 1, 2010 at 4:42 PM, Denis Laxalde
>> > <dla...@gm...>
>> wrote:
>> >
>> > > Hi,
>> > >
>> > > Is there a way to change (and maybe remove) the background color
>> > > (gra=
> y
>> > > by default) of axis in mplot3d graphics ?
>> > >
>> > > Thanks,
>> > >
>> > > Denis
>> > >
>>
|
|
From: rugspin <pie...@we...> - 2010-06-02 12:33:56
|
Thanks Jae-Joon and Friedrich I will try out both solutions. Regards Hans Jae-Joon Lee wrote: > > On Tue, Jun 1, 2010 at 2:22 PM, rugspin <pie...@we...> wrote: >> That's doing it, thought there might be an internal way within >> matplotlib, >> but I could figure one. > > If you need more hard-core way of doing this, > > a = np.arange(16384).reshape(128, 128) > > from matplotlib.colors import Normalize > import matplotlib.cm as cm > norm = Normalize(vmin=0, vmax=16383) > cmap = cm.summer > > A = (cmap(norm(a))*255).astype(np.uint8) > > import Image > pilim = Image.fromarray(A, "RGBA") > > ------------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/imshow%2C-imsave-to-PIL-image-conversion-tp28736246p28753655.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Benjamin R. <ben...@ou...> - 2010-06-02 03:30:10
|
Will do, thanks. Ben Root On Tue, Jun 1, 2010 at 5:26 PM, Jae-Joon Lee <lee...@gm...> wrote: > this is supposed to be explained in > > http://matplotlib.sourceforge.net/trunk-docs/users/gridspec.html > > But the trunk documentation is failed to build at this moment. > > In short, in the svn version of matplotlib, axes_grid is divided into > two separate modules, axes_grid1 and axisartist (axes_grid is provided > for backward compatibility). > Please see the above link when it is back online. > > Regards, > > -JJ > > > On Tue, Jun 1, 2010 at 5:34 PM, Benjamin Root <ben...@ou...> wrote: > > Hello, > > > > Does anybody know what is the difference between mpl_toolkit.axes_grid > and > > mpl_toolkit.axes_grid1? > > > > Thanks, > > Ben Root > > > > > ------------------------------------------------------------------------------ > > > > > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > |
|
From: Benjamin R. <ben...@ou...> - 2010-06-02 02:34:29
|
Huh, how about that? I never noticed that before. I wonder if that is a bug or if it is intentional? Ben Root On Tue, Jun 1, 2010 at 5:28 PM, Denis Laxalde <dla...@gm...> wrote: > Hi Ben, > > Thanks for your answer. > Actually, options for savefig seem to only operate on 2D axes whereas > I'm trying to change the color of 3D axes (x,y,z) which, by default, > have a grid with a gray background. > I manage to remove the grid lines but not the background color. > (My initial question was not very clear perhaps...) > > Denis > > > Le mardi 01 juin 2010 à 16:57 -0500, Benjamin Root a écrit : > > Denis, > > > > There are probably other ways, but the one that I know off the top of my > > head is done at the savefig() function. If you want to remove the > > background entirely, you can specify the keyword argument > transparent=True. > > You can change the color using the facecolor keyword argument. You can > > specify any color in that argument like you would elsewhere in > matplotlib. > > > > Ben Root > > > > On Tue, Jun 1, 2010 at 4:42 PM, Denis Laxalde <dla...@gm...> > wrote: > > > > > Hi, > > > > > > Is there a way to change (and maybe remove) the background color (gray > > > by default) of axis in mplot3d graphics ? > > > > > > Thanks, > > > > > > Denis > > > > |
|
From: Benjamin R. <ben...@ou...> - 2010-06-02 02:24:44
|
Malte, You may want to look into Numpy's genfromtxt() or loadtxt() functions. They will make your life so much easier for loading data from a text file. Ben Root On Tue, Jun 1, 2010 at 6:47 PM, Malte Dik <mal...@we...> wrote: > Howard Sun <hs...@nv...> > > Sorry for the newbie question, how do you plot one x with multiple ys. In > > below data, x column is followed by 5 y columns: Many thanks! > > Howard > > > > 2 1.0000e+00 6.6232e-02 9.9392e-03 2.2992e-02 3.8111e-07 > > 3 6.3664e-01 1.0269e-01 7.9107e-03 1.8254e-02 1.1391e-07 > > 4 2.7590e-01 4.9783e-02 6.2644e-03 1.0943e-02 5.8480e-08 > > 5 1.6550e-01 2.3269e-02 4.7482e-03 8.4312e-03 5.8239e-08 > > 6 1.1590e-01 1.7234e-02 3.8567e-03 8.7010e-03 4.5506e-08 > > 7 7.4337e-02 1.1662e-02 3.3756e-03 8.0889e-03 4.0900e-08 > > 8 5.7775e-02 1.0917e-02 2.8980e-03 6.9654e-03 3.7520e-08 > > 9 4.7310e-02 1.1869e-02 2.5929e-03 5.8326e-03 3.4745e-08 > > 10 3.9591e-02 1.1301e-02 2.4691e-03 5.2749e-03 3.2126e-08 > > 11 3.6517e-02 1.0755e-02 2.3121e-03 4.8631e-03 3.7942e-08 > > 12 3.2872e-02 9.8306e-03 2.1692e-03 4.6281e-03 3.2358e-08 > > 13 3.1235e-02 9.1704e-03 2.0419e-03 4.3928e-03 3.1479e-08 > > 14 2.9528e-02 8.6926e-03 1.9364e-03 4.1360e-03 3.5639e-08 > > 15 2.7895e-02 8.3080e-03 1.8475e-03 3.9015e-03 3.0486e-08 > > 16 2.6440e-02 7.9610e-03 1.7776e-03 3.6790e-03 3.0307e-08 > > 17 2.5259e-02 7.6345e-03 1.6984e-03 3.4743e-03 3.1805e-08 > > 18 2.4064e-02 7.3267e-03 1.6341e-03 3.2848e-03 3.0188e-08 > > 19 2.3171e-02 7.0284e-03 1.5821e-03 3.1098e-03 2.7565e-08 > > 20 2.2317e-02 6.7322e-03 1.5247e-03 2.9475e-03 2.7009e-08 > > > First, you take the data apart, like in: > > import csv, numpy > > # let's call your array "filecopy" > > d = csv.Sniffer().sniff(filecopy[0]) > > for this_one_line in csv.reader(filecopy, d): > header = this_one_line > break > > data = numpy.zeros((len(header), len(filecopy))) > > for line in csv.reader(filecopy[1:], d): > for n in range(len(header)): > data[n][linecounter] = float(line[n]) > linecounter += 1 > > |
|
From: Eric F. <ef...@ha...> - 2010-06-02 02:07:28
|
On 06/01/2010 02:47 PM, Benjamin Root wrote: > Howard, > > Are you trying to plot 4 lines with the same y-axis or with two or more > y-axes? I only ask because the values of your 5th column are many > orders of magnitude smaller than the values of the other ys. > > If you want multiple y-axes on the same plot, then you might want to > look at Parasite Axes. If not, then you can very simply plot this like > so (assuming that 'data' is a 2-D numpy array). > > import matplotlib.pyplot as plt > > plt.plot(data[:, 0], data[:, 1]) > plt.plot(data[:, 0], data[:, 2]) > plt.plot(data[:, 0], data[:, 3]) > plt.plot(data[:, 0], data[:, 4]) > > plt.show() > > I am sure that my 4 plot statements can be simplified, but I can't > verify that right now. import numpy as np import matplotlib.pyplot as plt x = np.arange(2, 5, 0.3) y = np.random.randn(len(x), 4) # dummy data for illustration plt.plot(x, y) So with the data array as above, it would be plt.plot(data[:,0], data[:, 1:]) Eric > > I hope that helps. > > Ben Root |
|
From: Benjamin R. <ben...@ou...> - 2010-06-02 00:48:01
|
Howard, Are you trying to plot 4 lines with the same y-axis or with two or more y-axes? I only ask because the values of your 5th column are many orders of magnitude smaller than the values of the other ys. If you want multiple y-axes on the same plot, then you might want to look at Parasite Axes. If not, then you can very simply plot this like so (assuming that 'data' is a 2-D numpy array). import matplotlib.pyplot as plt plt.plot(data[:, 0], data[:, 1]) plt.plot(data[:, 0], data[:, 2]) plt.plot(data[:, 0], data[:, 3]) plt.plot(data[:, 0], data[:, 4]) plt.show() I am sure that my 4 plot statements can be simplified, but I can't verify that right now. I hope that helps. Ben Root On Tue, Jun 1, 2010 at 6:05 PM, Howard Sun <hs...@nv...> wrote: > Sorry for the newbie question, how do you plot one x with multiple ys. In > below data, x column is followed by 5 y columns: > Many thanks! > Howard > > 2 1.0000e+00 6.6232e-02 9.9392e-03 2.2992e-02 3.8111e-07 > 3 6.3664e-01 1.0269e-01 7.9107e-03 1.8254e-02 1.1391e-07 > 4 2.7590e-01 4.9783e-02 6.2644e-03 1.0943e-02 5.8480e-08 > 5 1.6550e-01 2.3269e-02 4.7482e-03 8.4312e-03 5.8239e-08 > 6 1.1590e-01 1.7234e-02 3.8567e-03 8.7010e-03 4.5506e-08 > 7 7.4337e-02 1.1662e-02 3.3756e-03 8.0889e-03 4.0900e-08 > 8 5.7775e-02 1.0917e-02 2.8980e-03 6.9654e-03 3.7520e-08 > 9 4.7310e-02 1.1869e-02 2.5929e-03 5.8326e-03 3.4745e-08 > 10 3.9591e-02 1.1301e-02 2.4691e-03 5.2749e-03 3.2126e-08 > 11 3.6517e-02 1.0755e-02 2.3121e-03 4.8631e-03 3.7942e-08 > 12 3.2872e-02 9.8306e-03 2.1692e-03 4.6281e-03 3.2358e-08 > 13 3.1235e-02 9.1704e-03 2.0419e-03 4.3928e-03 3.1479e-08 > 14 2.9528e-02 8.6926e-03 1.9364e-03 4.1360e-03 3.5639e-08 > 15 2.7895e-02 8.3080e-03 1.8475e-03 3.9015e-03 3.0486e-08 > 16 2.6440e-02 7.9610e-03 1.7776e-03 3.6790e-03 3.0307e-08 > 17 2.5259e-02 7.6345e-03 1.6984e-03 3.4743e-03 3.1805e-08 > 18 2.4064e-02 7.3267e-03 1.6341e-03 3.2848e-03 3.0188e-08 > 19 2.3171e-02 7.0284e-03 1.5821e-03 3.1098e-03 2.7565e-08 > 20 2.2317e-02 6.7322e-03 1.5247e-03 2.9475e-03 2.7009e-08 > > > ----------------------------------------------------------------------------------- > This email message is for the sole use of the intended recipient(s) and may > contain > confidential information. Any unauthorized review, use, disclosure or > distribution > is prohibited. If you are not the intended recipient, please contact the > sender by > reply email and destroy all copies of the original message. > > ----------------------------------------------------------------------------------- > > ------------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |