MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: remove tick labels

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123862] Re: remove tick labels
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sun, 25 Dec 2011 06:33:08 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <19351067.2302.1324726059042.JavaMail.root@m06>

The Presentations Application has CustomTicks and NoTicksLabel commands.
The easiest method to specify plots without tick labels would be as follows:

<< Presentations` 

testplot = Plot[Sin[x], {x, 0, 2 \[Pi]},
  Frame -> True] 

Write CustomTicks without labels and use them in the plot.

xticks = CustomTicks[Identity, {0, 7, 1, 5}] // NoTickLabels;
yticks = CustomTicks[Identity, {-1, 1, 0.5, 5}] // NoTickLabels;
Plot[Sin[x], {x, 0, 2 \[Pi]},
 Frame -> True,
 FrameTicks -> {xticks, yticks}]

Here the Identity in the CustomTicks command specifies that the tick
positions will be the same as the underlying coordinates. (Otherwise we
could use a function that generates custom tick marks.) The list {0, 7, 1,
5} means to make ticks from 0 to 7 in steps of 1 with 5 subdivisions for
small ticks. So you have to specify the ticks but it is not tedious.

We can try to let Mathematica automatically generate the ticks and then use
NoTickLabels to suppress the labels.

testplot = Plot[Sin[x], {x, 0, 2 \[Pi]},
   Frame -> True];
specialticks = 
   FrameTicks /. AbsoluteOptions[testplot, FrameTicks] // 
    NoTickLabels;;
Show[testplot, FrameTicks -> specialticks]

This does not work properly as the length of the ticks are not the same as
in the original plot, nor are the y ticks the same!

step1=FrameTicks/. AbsoluteOptions[testplot,FrameTicks];
step1[[2]]//Column

The original plot has major y divisions spaced by 0.5, but using
AbsoluteOptions gives divisions spaced by 0.25. It is easier here to use
CustomTicks than to mess with Mathematica features.


David Park
djmpark at comcast.net  
http://home.comcast.net/~djmpark/index.html  


From: markus [mailto:markusg.phys at googlemail.com] 

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




  • Prev by Date: Re: Reference of the formulas
  • Next by Date: Re: remove tick labels
  • Previous by thread: remove tick labels
  • Next by thread: Re: remove tick labels