4
$\begingroup$

So as of now I am using

Ticks -> {Range[0, d, 1]}

where d is the maximum value for my axes.

But the thing is that between 0 and 1 (or other integers) there are no minor ticks. Look here.

I have now only the integers and empty space in between. All I want is to have like five minor ticks. Just so that it looks better. I want to have the major (labeled) ticks only at the integers.

Also could maybe someone tell me how to not have two 0 labels on one plot (one for the x-axis, one for the y-axis)? Again look here.

I've spent an hour looking for the solution, but wasn't able to find a good one.

$\endgroup$
6
$\begingroup$
Plot[1 + x^2, {x, 0, 5}, 
 Frame -> {{True, False}, {True, False}}, 
 PlotRangePadding -> 0, 
 FrameTicks -> {{Charting`ScaledTicks["Linear"][0, 25, {5, 5}], 
    None}, {Charting`ScaledTicks["Linear"][0, 5, {5, 5}], None}}]

enter image description here

You can also create a custom tick function to use with FrameTicks:

tickFunc = Join[{#, #, {.03, 0}} & /@ Subdivide[##, 5], 
     {#, " ",  {.01, 0}} & /@ Subdivide[##, 25]] &; Plot[1 + x^2, {x, 0, 5}, 
 Frame -> {{True, False}, {True, False}}, PlotRangePadding -> 0, 
 FrameTicks -> {{tickFunc, None}, {tickFunc, None}}]

enter image description here

$\endgroup$
  • $\begingroup$ Worked like a charm! thank you $\endgroup$ – Benjamin Jabl Jan 30 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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