2
$\begingroup$

I have been using LevelScheme for a short time. In the beginning I was just trying to increase the size of the ticks in my plots and LinTicks worked pretty well. But now I am making plots for a more serious type of work and I want to make them look as good as possible.


I have the following list of points:

points={{0.5, 5.28788}, {0.75, 5.06717}, {1., 4.65195}, {1.25, 
  3.61722}, {1.5, 2.64618}, {1.75, 2.16506}, {2., 1.94835}, {2.25, 
  1.80968}, {2.5, 1.71555}, {2.75, 1.65771}, {3., 1.61147}}

and then I just interpolate them

f = Interpolation[points]

Now, after I load the LevelScheme package, I set the length of the minor and major ticks by typing

SetOptions[LinTicks, MajorTickLength -> {0.02, 0}, 
  MinorTickLength -> {0.013, 0}];

and finally I create the plot

Plot[f[x], {x, 0, 4}, PlotRange -> {1, 5.5}, 
 PlotStyle -> {Thickness[0.0049], Darker[Brown]}, 
 Axes -> {False, False}, 
 FrameStyle -> Directive[Black, Thick], FrameTicks -> LinTicks, 
 FrameTicksStyle -> Directive[Thick, FontSize -> 20], Frame -> True, 
 ImageSize -> 600]

The output is the following

The problems that I'm having are the following:

1)The length of the ticks is perfect, but I would like to change the number of minor ticks in between two major ticks (say, one minor tick between two major ticks) and I don't know how to do that.

2)Also, I would like to make the tick labels on the x-axis only appear every 0.5 units while the tick labels on the y-axis appear every 1 units. I tried adding TickLabelStep -> 0.5 to the SetOptions function above but it doesn't change anything. It only works when I enter a positive integer number.

3)Finally, I would like to get rid of the tick labels that appear on the right and top of the frame, so that only the bottom and left sides of the box have tick labels. I've tried many things, such as adding FrameTicks -> {LinTicks[0, 4, 0.5,5], LinTicks[0, 7, 1, 2], LinTicks[0, 4, 0.5, 5, ShowTickLabels -> False], LinTicks[0, 7, 1, 5, ShowTickLabels -> False]} but it doesn't work.

This is a plot that fulfills most of my requests:

I'm sure LevelScheme is not the only way to do all this, so I'm open to any suggestions even if they don't use LevelScheme at all. I'd be grateful if somebody could help me improve my plot.

$\endgroup$

1 Answer 1

2
$\begingroup$

You can use the (undocumented) function Charting`ScaledTicks which allows specification of the number and lengths for major and minor ticks:

tickFunction = Charting`ScaledTicks[{Identity, Identity}, 
  "TicksLength" -> {.03, .02}][##, {5, 2}]&;

Quiet @ Plot[f[x], {x, 0, 4}, 
    PlotRange -> {1, 5.5}, 
    PlotStyle -> {Thickness[0.0049], Darker[Brown]}, 
    Axes -> {False, False}, 
    Frame -> True,
    FrameStyle -> Directive[Black, Thick], 
    FrameTicks -> Table[tickFunction, 2, 2], 
    FrameTicksStyle -> ({#, #} & @ {FontSize -> 20, FontOpacity -> 0}), 
    ImageSize -> 600] 

enter image description here

Replace {5, 2} with {5, 1} or 5 to get:

enter image description here

$\endgroup$

Your Answer

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

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