How do you want your ticklabels formatted?

If axisartist does not provide a formatter that fits your need, you
can create a custom formatter.
Formatter for axisartist can be any callable object with following signature.

def Formatter(direction, factor, values):
    # ...
    return list_of_string_that corresponds_to_values

You may ignore direction and factor parameters for now.
For example,

class MyFormatter(object):
    def __call__(self, direction, factor, values):
        _fmt = "$%.1f$"
        return [_fmt % v for v in values]

then you could do

grid_helper = floating_axes.GridHelperCurveLinear( tr, extremes=( 1, 2,
1000, 2000 ), tick_formatter1 = None, tick_formatter2 = MyFormatter() )

Regards,

-JJ


On Wed, Nov 10, 2010 at 10:17 PM, Stefan Mauerberger
<stefan.mauerber...@mnet-online.de> wrote:
> Hello everyone,
>
> I have a question regarding the formatting of ticks in a curved
> coordinate system. To create my plots I am useing the
> mpl_toolkits.axisartist.floating_axes.GridHelperCurveLinear() function.
> This works quite well but I have difficulties with formatting the axis.
> I am working in a polar coordinate system. To format the longitudinal
> axis I found the function
> mpl_toolkits.axisartist.angle_helper.FormatterDMS() and it works good.
> But I want to chance the formatting of the radius too. For this I need
> to pass something to the kwargs tick_formatter2 of the function
> GridHelperCurveLinear but I do not know what.
>
> Could you give me some advice?
>
> Regards
>
> Stefan
>
> Here is the code I use:
>
> import matplotlib.pyplot as plt
> import mpl_toolkits.axisartist.floating_axes as floating_axes
> from   matplotlib.projections import PolarAxes
>
> fig = plt.figure()
>
> tr = PolarAxes.PolarTransform()
>
> grid_helper = floating_axes.GridHelperCurveLinear( tr, extremes=( 1, 2,
> 1000, 2000 ), tick_formatter1 = None, tick_formatter2 = None )
>
> ax1 = floating_axes.FloatingSubplot( fig, 111, grid_helper=grid_helper )
>
> fig.add_subplot( ax1 )
>
> ax1.grid( True )
>
> plt.show()
>
>
> ------------------------------------------------------------------------------
> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> David G. Thomson, author of the best-selling book "Blueprint to a
> Billion" shares his insights and actions to help propel your
> business during the next growth cycle. Listen Now!
> http://p.sf.net/sfu/SAP-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to