1
$\begingroup$

I have:

Show[Plot[1/(2 Pi x^2), {x, 0.26, 1}, PlotRange -> {{0.26, 1}, {0, 4}}], Plot[1 - x, {x, 0.26, 1}, PlotRange -> {{0.26, 1}, {0, 4}}], 
LabelStyle -> {16, GrayLevel[0]}, AxesOrigin -> {0.26, 0}]

enter image description here

Why the origin $0.26$ (on the horizontal axis) doesn't appear in plot? ($0$ in the vertical axis is fine.)

EDIT

In the case where the origin is $(0.2, 0)$, the plot is fine:

Show[Plot[1/(2 Pi x^2), {x, 0.2, 1}, PlotRange -> {{0.2, 1}, {0, 4}}], Plot[1 - x, {x, 0.2, 1}, PlotRange -> {{0.2, 1}, {0, 4}}], 
LabelStyle -> {16, GrayLevel[0]}, AxesOrigin -> {0.2, 0}]

enter image description here

$\endgroup$
5
  • $\begingroup$ It does if you do e.g. Show[Plot[1/(2 Pi x^2), {x, 0.2, 1}, PlotRange -> {{0.2, 1}, {0, 4}}], Plot[1 - x, {x, 0.2, 1}, PlotRange -> {{0.2, 1}, {0, 4}}], LabelStyle -> {16, GrayLevel[0]}, AxesOrigin -> {0.26, 0}, Axes -> True] i.sstatic.net/8eUbG.png $\endgroup$
    – chris
    Commented Sep 20, 2021 at 15:26
  • $\begingroup$ If I understand you correctly, may be you should rephrase your question: the axis appears but not the label (?) $\endgroup$
    – chris
    Commented Sep 20, 2021 at 15:37
  • $\begingroup$ I assume the OP wants a tick at $0.26$. You can add it manually as shown in this answer. $\endgroup$
    – Domen
    Commented Sep 20, 2021 at 15:38
  • $\begingroup$ Ticks appear on axes. If a Frame is enabled, FrameTicks appear as specified. AxesOrigin simply determines the origin. You can study this solution further: i.sstatic.net/jIidi.png $\endgroup$
    – Syed
    Commented Sep 20, 2021 at 16:06
  • $\begingroup$ You will have to let go of the Tick at 0.3 or else it will overlap and look non-professional. Also specify, if you want to see 0 for the y-axis. $\endgroup$
    – Syed
    Commented Sep 20, 2021 at 16:12

2 Answers 2

1
$\begingroup$

Ticks >> Possible Issues

enter image description here

As a work-around, you can use Frame -> {{True, False}, {True, False}} to get bottom and left axes. Then, prepend your desired tick to the list of ticks generated by Charting`ScaledTicks["Linear"][#, #2, {8, 8}] & and use it for the horizontal ticks specification in option FrameTicks:

Show[Plot[1/(2 Pi x^2), {x, 0.26, 1}, PlotRange -> {{0.26, 1}, {0, 4}}], 
 Plot[1 - x, {x, 0.26, 1}], 
 ImageSize -> Large, 
 LabelStyle -> {16, GrayLevel[0]}, 
 AxesOrigin -> {0.26, 0},  
 Frame -> {{True, False}, {True, False}}, 
 PlotRangePadding -> Scaled[.02], 
 FrameTicks -> {{Automatic, None},
    {Prepend[{.26, .26, {.01, 0}}] @ 
       Charting`ScaledTicks["Linear"][#, #2, {8, 8}] &, None}}]

enter image description here

Alternatively, you can use

Join[{{.26, .26, {.01, 0}}}, Charting`ScaledTicks["Linear"][#, #2, {8, 8}]] &

to specify the horizontal ticks.

$\endgroup$
1
  • $\begingroup$ @Nima, remove the option PlotRangePadding -> Scaled[.02]. $\endgroup$
    – kglr
    Commented Sep 20, 2021 at 18:58
2
$\begingroup$

Try this:

Show[Plot[1/(2 Pi x^2), {x, 0.26, 1}, 
  PlotRange -> {{0.26, 1}, {0, 4}}, 
  Ticks -> {{0.26, 0.4, 0.6, 0.8, 1}, Automatic}], 
 Plot[1 - x, {x, 0.26, 1}, PlotRange -> {{0.26, 1}, {0, 4}}], 
 LabelStyle -> {16, GrayLevel[0]}, AxesOrigin -> {0.26, 0}]

enter image description here

Have fun!

$\endgroup$
2
  • 2
    $\begingroup$ I am not sure that you are using acceptable wording. $\endgroup$ Commented Sep 20, 2021 at 16:33
  • $\begingroup$ The option Ticks overrides the previous settings and instructs Mathematica to only use those ticks one specifies in this option. Therefore, if one needs any special form of ticks he should specify them in all details. The ways to do it you can find in the answer of @kgrl. Besides, have a look as Menu/Help/WolframDocumentation/Ticks $\endgroup$ Commented Sep 20, 2021 at 18:29

Your Answer

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

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