SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: Jae-Joon L. <lee...@gm...> - 2008年06月30日 19:17:45
Hi,
I sometimes use a custom Axes class, and want to use it with
add_subplot() command.
As a matter of fact, it IS possible with current version of matplotlib
but it seems a bit inconvenient to me.
Here is what I do.
class MyAxes(maxes.Axes):
 name="myaxes"
From: Jae-Joon L. <lee...@gm...> - 2008年06月30日 19:32:03
Sorry, I accidentally sent an incomplete email.
here is a complete one.
I sometimes use a custom Axes class, and want to use it with
add_subplot() command.
As a matter of fact, it IS possible with current version of matplotlib
but it seems a bit inconvenient to me.
Here is what I may do.
 import matplotlib.axes as maxes
 class MyAxes(maxes.Axes):
 name="myaxes"
 # some definitions
 import matplotlib.projections
 matplotlib.projections.register_projection(MyAxes)
 F = figure()
 ax = F.add_subplot(1,2,2, projection="myaxes")
But it would much better if I can simply do something like
 class MyAxes(maxes.Axes):
 # some definitions
 F = figure()
 ax = F.add_subplot(1,2,2, axes_class=MyAxes)
It seems rather straight forward to implement "axes_class" keyword in
add_subplot() and I may make a patch for it.
So, how does others think?
Regards,
-JJ
From: John H. <jd...@gm...> - 2008年07月01日 02:12:55
On Mon, Jun 30, 2008 at 2:31 PM, Jae-Joon Lee <lee...@gm...> wrote:
> It seems rather straight forward to implement "axes_class" keyword in
> add_subplot() and I may make a patch for it.
> So, how does others think?
Seems totally reasonable an we'd be happy to accept a patch.
Thanks,
JDH
From: Michael D. <md...@st...> - 2008年07月01日 11:51:45
Sounds ok to me. One thing to clarify though -- what to do if both 
"projection" and "axes_class" are provided? Throw an exception?
I have a small problem with the name "axes_class" because it is very 
non-obvious that it corresponds to "projection". Perhaps we should 
either 1) overload projection to take a class as well as strings, or 2) 
use "projection_class" instead of "axes_class". I think I prefer 1) 
though I'm wary of overloading in Python in general.
Cheers,
Mike
John Hunter wrote:
> On Mon, Jun 30, 2008 at 2:31 PM, Jae-Joon Lee <lee...@gm...> wrote:
>
> 
>> It seems rather straight forward to implement "axes_class" keyword in
>> add_subplot() and I may make a patch for it.
>> So, how does others think?
>> 
>
> Seems totally reasonable an we'd be happy to accept a patch.
>
> Thanks,
> JDH
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Matplotlib-devel mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Jae-Joon L. <lee...@gm...> - 2008年07月01日 19:37:40
I picked "axes_class" because this is what is used in
"subplot_class_factory" function.
I rather prefer "axes_class" because, IMO, subclassing of Axes is not
only for a new projection.
For example, I have a simple subclass of Axes where I have
"baseline"-aligned x-ticklabels (instead of "top" align). Also, from
available options
 from matplotlib.projection import AitoffAxes
 1) f.add_subplot(1,2,1, projection=AitoffAxes)
 2) f.add_subplot(1,2,1, projection_class=AitoffAxes)
 3) f.add_subplot(1,2,1, axes_class=AitoffAxes)
I think option 3 makes a slightly more sense.
My patch (which is attached) if for option 3 and simply adds
"axes_class" keyword. It raises an Exception if "projection" is
supplied or polar=True. But feel free to modify or give me
suggestions. If others prefer option 1 or 2, I'll make a subsequent
change for it.
Regards,
-JJ
On Tue, Jul 1, 2008 at 7:51 AM, Michael Droettboom <md...@st...> wrote:
> Sounds ok to me. One thing to clarify though -- what to do if both
> "projection" and "axes_class" are provided? Throw an exception?
>
> I have a small problem with the name "axes_class" because it is very
> non-obvious that it corresponds to "projection". Perhaps we should either
> 1) overload projection to take a class as well as strings, or 2) use
> "projection_class" instead of "axes_class". I think I prefer 1) though I'm
> wary of overloading in Python in general.
>
> Cheers,
> Mike
>
> John Hunter wrote:
>>
>> On Mon, Jun 30, 2008 at 2:31 PM, Jae-Joon Lee <lee...@gm...>
>> wrote:
>>
>>
>>>
>>> It seems rather straight forward to implement "axes_class" keyword in
>>> add_subplot() and I may make a patch for it.
>>> So, how does others think?
>>>
>>
>> Seems totally reasonable an we'd be happy to accept a patch.
>>
>> Thanks,
>> JDH
>>
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
>> _______________________________________________
>> Matplotlib-devel mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>>
>
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /