1
$\begingroup$

I have the following equation

p = 1.6; α = 0.001; r = 0.6; η = 0.04; ω = 1;
R ω p Sin[ω τ] + R ω p α - 9/4 r p R^3 ω - η p R == 0

If I use the following command

ContourPlot[R ω p Sin[ω τ] + R ω p α - 9/4 r p R^3 ω - η p R == 0, 
   {τ, 0, 20}, {R, 0, 2}, ContourStyle -> {Directive[Blue, Thick]}] 

I am getting a plot where the x axis values are displayed at an interval of 5, i.e 0,5,10...., Is it possible to control the x axis interval ,like 0,2,4. Please suggest.

$\endgroup$

closed as off-topic by Bob Hanlon, José Antonio Díaz Navas, MarcoB, J. M. will be back soon Mar 29 '18 at 1:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Bob Hanlon, José Antonio Díaz Navas, MarcoB, J. M. will be back soon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ Probably, you are looking for the options Ticks or FrameTicks... $\endgroup$ – Henrik Schumacher Mar 25 '18 at 13:54
1
$\begingroup$

You could use the internal functions Charting`ScaledTicks and Charting`ScaledFrameTicks to control how many tick marks are displayed. For example:

ContourPlot[
    R ω p Sin[ω τ]+R ω p α-9/4 r p R^3 ω-η p R == 0,
    {τ, 0, 20},
    {R, 0, 2},
    ContourStyle->{Directive[Blue,Thick]},
    FrameTicks->{
        {Automatic,Automatic},
        {
        Charting`ScaledTicks[{Identity,Identity}][0,20,{10,2}],
        Charting`ScaledFrameTicks[{Identity,Identity}][0,20,{10,2}]
        }
    }
]

enter image description here

The third argument, {10, 2} specifies that approximately 10 major divisions and 2 minor divisions per major division should be used.

$\endgroup$
  • $\begingroup$ Thank you very much. $\endgroup$ – Udichi Mar 26 '18 at 10:23
1
$\begingroup$

Actually, ContourPlot is a framed plot that by default doesn't show axes ticks. What you need to do is define a set of custom frame ticks. Like so.

tickF[f_Function, min_, max_] := f /@ Range[Floor @ min, Floor @ max]
btmTicks[min_, max_] := tickF[{#, If[Mod[Round @ #, 2] == 0, #, ""]} &, min, max]
topTicks[min_, max_] := tickF[{#, "" } &, min, max]

p = 1.6; α = 0.001; r = 0.6; η = 0.04; ω = 1;
ContourPlot[
  R ω p Sin[ω τ] + R ω p α - 9/4 r p R^3 ω - η p R, {τ, 0, 20}, {R, 0, 2},
  Contours -> {0},
  ContourShading -> False,
  ContourStyle -> {Directive[Blue, Thick]},
  FrameTicks -> {Automatic, {btmTicks, topTicks}}]

plot

Note: I have changed the 1st argument given to ContourPlot from the form expression == 0 to the form expression and added additional contour options because my version of Mathematica (V11.1.1) has a bug that produces a horrible looking and incorrect tooltip value for the contours. These changes are a work-around that produces the correct tooltip. Your version of Mathematica may not have this paticular bug and, if so, you can ignore those changes.

$\endgroup$

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