4
$\begingroup$

I have a figure displayed by the following code:

Plot[x^2, {x, 0, 1},
  Frame -> True,
  FrameTicks -> {{Automatic, None}, {Automatic, None}}]

However, I want the tick in the position y=0.6 to be labeled as L. To do this, I have:

Plot[x^2, {x, 0, 1},
  Frame -> True,
  FrameTicks -> {{{{0.6, "L"}}, None}, {Automatic, None}}]

The thing is I want all of the other ticks on the left frame to be displayed without label, but I can't; it seems to be either all of the ticks with label or only one tick with my special label.

I found this answer to be kind of helpful, but it is not exactly what I want and I'm able to get a grasp on it.

Any help is welcome.

$\endgroup$

1 Answer 1

7
$\begingroup$

Charting`ScaledFrameTicks[{Identity, Identity}][min, max, {majorticks, minorticks}] produces desired number of major and minor unlabeled ticks in the range from min to max. Just append or prepend your list of desired ticks to the ticks produced by this function.

Plot[x^2, {x, 0, 1}, Frame -> True, 
 FrameTicks -> 
  {{Append[{0.6, "L"}] @ Charting`ScaledFrameTicks[{Identity, Identity}][##] &,
    None}, 
   {Automatic, None}}]

enter image description here

Replace Append[{0.6, "L"}] with Append[{0.6, "L", {.03, .02}, {Thick, Red}}] to get:

enter image description here

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.