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.

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

  • $\begingroup$ Worked like a charm! thank you $\endgroup$ – Benjamin Jabl Jan 30 '19 at 20:37
  • $\begingroup$ @kglr Trying to extend your first technique for use on a 3D plot gives the error: "A tick position in the value of the Ticks option should be a number." How can your first technique be correctly extended for use with a 3D plot? $\endgroup$ – Michael B. Heaney Oct 1 '19 at 18:45
  • 1
    $\begingroup$ @MichaelB.Heaney, this works: Plot3D[1 + x^2+y^2, {x, 0, 5},{y, 0,5}, Ticks -> {Charting`ScaledTicks["Linear"][0,5, {5, 5}], Charting`ScaledTicks["Linear"][0, 5, {5, 5}],Charting`ScaledTicks["Linear"][0, 50, {2, 5}]}] $\endgroup$ – kglr Oct 2 '19 at 0:03

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.