Re: remove tick labels
- To: mathgroup at smc.vnet.net
- Subject: [mg123865] Re: remove tick labels
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Sun, 25 Dec 2011 06:34:10 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jd4fgc$db6$1@smc.vnet.net>
- Reply-to: nma at 12000.org
On 12/24/2011 6:10 AM, markus wrote:
> Hi,
>
> is there a simple way in Mathematica to remove the tick labels from a
> plot while keeping the tick marks?
> I know that in principle one could specify all the tick mark
> positions, formatting and labels in a list as an argument to the plot
> function, but this is quite cumbersome. What I want is to let
> Mathematica create all the ticks automatically and the remove just the
> labels afterwards. I thought it should be possible by manipulating the
> output of the plot command in some way, but I haven't found out yet.
>
> Regards,
> Markus
>
Well, this is the best I could do, it removes the labels, but
for some reason the y-axis ticks spacings seems look different.
May be playing more with it will fix it.
I think there should be an option to do this. I do not think
a user has to do this sort of low level stuff just to remove
tick labels.
-------------------------------------------
t = AbsoluteOptions[p, Ticks];
tx = Map[If[Head[#[[2]]] === Real, ReplacePart[#, "", {2}], #] &,
t[[1, 2, 1]]];
ty = Map[If[Head[#[[2]]] === Real, ReplacePart[#, "", {2}], #] &,
t[[1, 2, 2]]];
Plot[Sin[x], {x, -Pi, Pi}, Ticks -> {tx, ty}]
-------------------------------------------
For reference, I used this article for help
"This notebook illustrates how to move tick labels from the default positions.
The specific example presented here puts the labels above the horizontal axis."
http://library.wolfram.com/infocenter/TechNotes/4134/
--Nasser