Thanks for your suggestion Oscar. I tried editing the ticks like this, but
this method removes both the tick marks and the labels.
I think I have found a decent solution. Unfortunately my solution required
a very particular order of operations. It is much less convenient than the
functions provided in the API like tick_params(), which don't care if you
have run plt.draw() ahead of time...
1) Run all of the setup for the plot and also the plotting commands
(ax.plot(), ax.hist()...whatever)
2) Run `plt.draw()` because this updates the tick objects contained in
your axes.
3) Grab your Tick objects: `ticks = ax.[x/y]axis.[major/minor]Ticks`
4) For each tick you want to hide do:
`tick.tick1On = False`
`tick.tick2On = False`
The `1` and `2` refer to the bottom, top (left, right) for the x (y) axis
respectively.
5) Run plt.show(), fig.show() or fig.savefig or whatever else you are using.
Ahhhhh, no messy ticks in the corner!
Julian
On Fri, Jan 29, 2016 at 10:49 AM, Oscar Benjamin <oscar.j.benja...@gmail.com
> wrote:
> On 28 January 2016 at 19:49, Julian Irwin <julian.ir...@gmail.com> wrote:
> >
> >
> > I am looking for a way to hide tick marks (not the labels!) that
> coincide with axis lines. I think this is a problem for me because of the
> relative line thicknesses of my axis lines and tick marks, but I want to
> leave those thicknesses unchanged (I like the look of the thickness
> settings I am using now).
>
> Try this:
>
> from matplotlib import pyplot as plt
> fig = plt.figure()
> ax = fig.add_subplot(1, 1, 1)
> ax.plot([0, 1], [0, 1])
> print(ax.get_xticks())
> ax.set_xticks(ax.get_xticks()[1:-1]) # Remove first and last ticks
> print(ax.get_xticks())
>
> --
> Oscar
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users