# Is it possible to change the tick labels using string text by CustomTicks package?

I want to get a high-resolution figure using Mathmatica. However, the FrameTicks are too short, and thus I installed the CustomTicks package. With its help, I can plot good ticks. However now a new problem has arisen. I do not know how to edit the tick labels using my expected text. An example code to show my problem:

Plot[Sin[x], {x, 0, 6 Pi}, Axes -> False, Frame -> True,
FrameTicks -> {{LinTicks[{-1, 0, 1}, {-0.5, 0.5},
ShowMinorTickLabels -> True, DecimalDigits -> 0],
None}, {LinTicks[0, 15, 3, 2], None}},

FrameTicksStyle -> {{Directive[Black, 16, Plain],
None}, {Directive[Black, 16, Plain], None}}]


I got this figure: However, what I expected is to plot the y axis as [-1, -0.5, 0, 0.5, 1]. If I change the DecimalDigits -> 1 to be DecimalDigits -> 0, I got: My ideas:

(1) If I can define the DecimalDigits for MajorTicks and MinorTicks respectively, I should be able to solve this problem.

(2) If I can instead the tick values using string text, I can also solve this. For this solution, I know how to do this using FrameTicks, but I need to use the CustomTicks package because I want to plot ticks in proper length, thickness and color.

I learned the CustomTicks manual and have tried many times. I still can not solve this problem up to now.

Do you have some ideas to solve this problem? Thank you!

You can use a TickLabelFunction.

Plot[Sin[x], {x, 0, 6 Pi}, Axes -> False, Frame -> True,
FrameTicks -> {{LinTicks[{-1, 0, 1}, {-0.5, 0.5},
ShowMinorTickLabels -> True, TickLabelFunction -> Simplify[# &],
DecimalDigits -> 1], None}, {LinTicks[0, 15, 3, 2], None}},
FrameTicksStyle -> {{Directive[Black, 16, Plain],
None}, {Directive[Black, 16, Plain], None}}] • Hi， Jean. This is exactly what I want. Thank you! Oct 28, 2020 at 1:46

It can be done without any additional packages. Just define the style of each tick as I did for left axis:

Plot[Sin[x], {x, 0, 2 Pi},
Frame -> True,
LabelStyle -> Directive[Black, 16, Bold],
FrameTicks -> {
{Table[{-1 + 0.5 i,
(-1 + 0.5 i) 2,
{i*0.025, 0},
Directive[Thickness[0.0075*i],ColorData["VisibleSpectrum"][450 + 45 i]]
}, {i, 0, 4}], None},
{Automatic, None}
},
ImageSize -> 1000] 