John -
My version of mpl (0.90.1) only has a function ax.xaxis.get_ticklocs(),
not ax.xaxis.get_majorticklocs().
New feature?
Mark

On Feb 2, 2008 10:27 PM, John Hunter wrote:

> Send Matplotlib-users mailing list submissions to
>        matplotlib-users@lists.sourceforge.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> or, via email, send a message with subject or body 'help' to
>        [EMAIL PROTECTED]
>
> You can reach the person managing the list at
>        [EMAIL PROTECTED]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Matplotlib-users digest..."
>
>
> Today's Topics:
>
>   1. Re: Can I change placement of X-Axis? (John Hunter)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 2 Feb 2008 15:27:52 -0600
> From: "John Hunter" <[EMAIL PROTECTED]>
> Subject: Re: [Matplotlib-users] Can I change placement of X-Axis?
> To: "Eric Firing" <[EMAIL PROTECTED]>
> Cc: volcs0 <[EMAIL PROTECTED]>, matplotlib-users@lists.sourceforge.net
> Message-ID:
>        <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> On Feb 2, 2008 3:06 PM, Eric Firing <[EMAIL PROTECTED]> wrote:
> > volcs0 wrote:
> > > I saw one post related to arbitrary axis positioning from 2005, but
> there was
> > > no solution.
> >
> > It is still on the wish list.
>
> Though with a little hacking, you can emulate it by manually drawing
> everything yourself -- this is the approach SAGE takes.  Eg,
>
> import numpy as np
> from pylab import figure, show
> import matplotlib.lines as lines
>
> def make_xaxis(ax, yloc, offset=0.05, **props):
>    xmin, xmax = ax.get_xlim()
>    locs = [loc for loc in ax.xaxis.get_majorticklocs()
>            if loc>=xmin and loc<=xmax]
>    tickline, = ax.plot(locs, [yloc]*len(locs),linestyle='',
>            marker=lines.TICKDOWN, **props)
>    axline, = ax.plot([xmin, xmax], [yloc, yloc], **props)
>    tickline.set_clip_on(False)
>    axline.set_clip_on(False)
>    for loc in locs:
>        ax.text(loc, yloc-offset, '%1.1f'%loc,
>                horizontalalignment='center',
>                verticalalignment='top')
>
> def make_yaxis(ax, xloc=0, offset=0.05, **props):
>    ymin, ymax = ax.get_ylim()
>    locs = [loc for loc in ax.yaxis.get_majorticklocs()
>            if loc>=ymin and loc<=ymax]
>    tickline, = ax.plot([xloc]*len(locs), locs, linestyle='',
>            marker=lines.TICKLEFT, **props)
>    axline, = ax.plot([xloc, xloc], [ymin, ymax], **props)
>    tickline.set_clip_on(False)
>    axline.set_clip_on(False)
>
>    for loc in locs:
>        ax.text(xloc-offset, loc, '%1.1f'%loc,
>                verticalalignment='center',
>                horizontalalignment='right')
>
>
> props = dict(color='black', linewidth=2, markeredgewidth=2)
> x = np.arange(200.)
> y = np.sin(2*np.pi*x/200.) + np.random.rand(200)-0.5
> fig = figure(facecolor='white')
> ax = fig.add_subplot(111, frame_on=False)
> ax.axison = False
> ax.plot(x, y, 'd', markersize=8, markerfacecolor='blue')
> ax.set_xlim(0, 200)
> ax.set_ylim(-1.5, 1.5)
> make_xaxis(ax, 0, offset=0.1, **props)
> make_yaxis(ax, 0, offset=5, **props)
> fig.savefig('manual_axis.png', dpi=100, facecolor='white',
> edgecolor='white')
> show()
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: test.py
> Type: application/octet-stream
> Size: 1691 bytes
> Desc: not available
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: manual_axis.png
> Type: image/png
> Size: 35563 bytes
> Desc: not available
>
> ------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>
> ------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> End of Matplotlib-users Digest, Vol 21, Issue 5
> ***********************************************
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to