4
$\begingroup$

I encountered a few minor issues everytime when I try to plot graphs nicely:

  1. What is the simplest method to adjust the major and minor tick lengths of the frame?
  2. Is there a way to program the tick numbers so that repeated number at the origin is avoided?

Here is a code sample:

Plot[100*x, {x, 0, 5}, PlotRange -> {{0, 5}, {0, 500}},  AspectRatio -> 5/6.5, ImageSize -> {1200, 800}, Axes -> False,  Frame -> True, FrameStyle -> Directive[Black, Thickness[0.005], 50],  PlotRangeClipping -> False]

enter image description here

askedyesterday
Johnson's user avatar
$\endgroup$

1 Answer1

6
$\begingroup$

The following doubles the length of ticks by2 x3 in the code and deletes one of0 byDeleteCases.

pl = Plot[100*x, {x, 0, 5}, PlotRange -> {{0, 5}, {0, 500}},   AspectRatio -> 5/6.5, Axes -> False, Frame -> True](pl /. (FrameTicks -> _) -> (FrameTicks ->        Replace[DeleteCases[#, Cases[#, {0.`, "0", __}, All][[1]],          All], {x1_, x2_, {x3_, x4_}} :> {x1, x2, {2 x3, x4}},         All])) &@AbsoluteOptions[pl, FrameTicks][[1, 2]]

enter image description here

answeredyesterday
azerbajdzan's user avatar
$\endgroup$
1
  • $\begingroup$This is great, @azerbajdzan, but is it possible for you to give a small bit more explanation? Perhaps you might consider to at least write the length-doubling as a parameter, so that OP can more easily see where or how the doubled length of the tick marks occurs?$\endgroup$Commented10 hours ago

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.