[Matplotlib-users] bbox_inches='tight' issue with text outside axes

2010-06-03 Thread Thomas Robitaille
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] bbox_inches='tight' issue with text outside axes

2010-06-03 Thread Jae-Joon Lee
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
 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
> [email protected]
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [mplot3d] change axis background color

2010-06-03 Thread Jae-Joon Lee
On Wed, Jun 2, 2010 at 2:46 PM, Denis Laxalde  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

--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Difference between axes_grid and axes_grid1

2010-06-03 Thread Benjamin Root
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  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  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
> > [email protected]
> > 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Difference between axes_grid and axes_grid1

2010-06-03 Thread Jae-Joon Lee
On Thu, Jun 3, 2010 at 12:52 PM, Benjamin Root  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

--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] how to display data with a "fixed" color scale ?

2010-06-03 Thread Jim Vickroy
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:

#
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()
#

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to display data with a "fixed" color scale ?

2010-06-03 Thread Jae-Joon Lee
On Thu, Jun 3, 2010 at 4:00 PM, Jim Vickroy  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

--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to display data with a "fixed" color scale ?

2010-06-03 Thread Jim Vickroy

Jae-Joon Lee wrote:

On Thu, Jun 3, 2010 at 4:00 PM, Jim Vickroy  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

--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to display data with a "fixed" color scale ?

2010-06-03 Thread Eric Firing
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:
>
> #
> 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()
> #
>
> 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
> [email protected]
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to display data with a "fixed" color scale ?

2010-06-03 Thread Jim Vickroy

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:

#
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()
#

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
[email protected]
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
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to display data with a "fixed" color scale ?

2010-06-03 Thread Eric Firing
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:
>>>
>>> #
>>> 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()
>>> #
>>>
>>> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to display data with a "fixed" color scale ?

2010-06-03 Thread Jim Vickroy
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:

#
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()
#

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
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] leading whitespace in text

2010-06-03 Thread PHobson
> -Original Message-
> From: Christoph Gohlke [mailto:[email protected]]
> Sent: Sunday, May 30, 2010 3:41 PM
> To: [email protected]
> 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

--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] leading whitespace in text

2010-06-03 Thread Christoph Gohlke


On 6/3/2010 5:20 PM, [email protected] wrote:
>> -Original Message-
>> From: Christoph Gohlke [mailto:[email protected]]
>> Sent: Sunday, May 30, 2010 3:41 PM
>> To: [email protected]
>> 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?
>


Hi Paul,

no, usetex is not set, I made sure of that. I have traced this to a 
recent commit and opened a ticket on SF.






-- 
Christoph

--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] leading whitespace in text

2010-06-03 Thread Eric Firing
On 06/03/2010 02:29 PM, Christoph Gohlke wrote:
>
>
> On 6/3/2010 5:20 PM, [email protected] wrote:
>>> -Original Message-
>>> From: Christoph Gohlke [mailto:[email protected]]
>>> Sent: Sunday, May 30, 2010 3:41 PM
>>> To: [email protected]
>>> 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?
>>
>
>
> Hi Paul,
>
> no, usetex is not set, I made sure of that. I have traced this to a
> recent commit and opened a ticket on SF.
>
> 
> 
>
> 
>

Thanks for doing that.  I have assigned it to Mike D.  I hope he has a 
little time to look at it.  I suspect he will instantly see what the 
problem is and how to fix it.

Eric


--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Difference between axes_grid and axes_grid1

2010-06-03 Thread Benjamin Root
On Thu, Jun 3, 2010 at 12:22 PM, Jae-Joon Lee  wrote:

> On Thu, Jun 3, 2010 at 12:52 PM, Benjamin Root  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
>

Thanks, that helps clear up some things for me.  I am curious if axes_grid1
is intended to be a final name.  When looking at the docs, it almost seems
like axes_grid1 is some supporting module while axes_grid is the main
module, just from a naming convention point-of-view.  But, that's just my
first impression of seeing those modules in that folder.

Ben Root
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users