0
$\begingroup$

I have the following plot:

enter image description here

Generated using the following code:

zmin=10;
zmax=100;
d=5;
gridpoints=Subdivide[Log[zmin],Log[zmax],d]
breakpoints=Map[Exp,gridpoints]
fpoints=Map[Log,breakpoints]
Show[{Plot[Log[x],{x,0,110},Ticks->None],
Graphics[{Dashed,Map[Line,Thread[{Thread[{breakpoints,ConstantArray[0,d+1]}],
Thread[{breakpoints,fpoints}]}]]}],
Graphics[{Dashed,Map[Line,Thread[{Thread[{ConstantArray[0,d+1],gridpoints}],
Thread[{breakpoints,fpoints}]}]]}]}]

I would like to add labels "x_0" "x_1" ... "x_6" to where the vertical dashed lines meet the x-axis.

How can I implement such custom tick labels?

$\endgroup$
3
$\begingroup$

Your code could be streamlined but I have left it as is. Using existing code just make this change:

Plot[Log[x], {x, 0, 110}, 
 Ticks -> {MapIndexed[{#1, "x_" <> ToString[First[#2] - 1]} &, 
    Thread[{breakpoints, ConstantArray[0, d + 1]}][[All, 1]]], None}]

enter image description here

$\endgroup$

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.