0
$\begingroup$

I am trying to set the scaling interval of my Y-Axes different than Mathematica automatically does. So in steps of 1000 instead of 2000 (see picture)

At the moment I determined following PlotRange:

PlotRange -> {{1, 10}, {0, 8000}}

enter image description here

Is there a simple option?

To get an overview over the command:

ListPlot [
  MapThread[
   If[Or[#1[[1]] === 3., #1[[1]] === 8.], 
     Callout[Tooltip[#1, #2], #2], Tooltip[#1, #2]] &, Annotated2], 
  FrameLabel -> {"Happiness Score", 
    "Education Expenditure (per capita)"}, Frame -> True, 
  GridLines -> Automatic, LabelStyle -> {GrayLevel[0]}, 
  PlotRange -> {{1, 10}, {0, 8000}}] // Framed
$\endgroup$
3
  • 1
    $\begingroup$ You may be looking for the Ticks option to plotting functions. Try adding something like Ticks -> {Automatic, Range[0, 8000, 1000]} to your plot; if you are using a frame in your plot, you may have to use FrameTicks instead of Ticks. If you show the code that generated the plot, we could help more specifically. $\endgroup$
    – MarcoB
    Jan 15, 2020 at 15:44
  • $\begingroup$ Hey, Ticks didnt work unfortunately. I added the command above. I just want to adjust the steps of the Y-Axes into steps of 1000 instead of 2000 $\endgroup$
    – Faye Drew
    Jan 15, 2020 at 16:09
  • $\begingroup$ I think I swapped the order of arguments in Ticks; since you are using a frame in the plot (i.e. Frame -> True) , try adding FrameTicks -> {Range[0, 8000, 1000], Automatic}. $\endgroup$
    – MarcoB
    Jan 15, 2020 at 16:14

1 Answer 1

3
$\begingroup$

You can specify both Ticks/FrameTicks and GridLines

xtick = Range[0, 8, 1];
ytick = Range[0, 8000, 1000];
xgrid = Range[0, 8, 2];
ygrid = Range[0, 8000, 2000];
ListPlot[Transpose[{RandomReal[{0, 8}, 20], RandomReal[{0, 8000}, 20]}], 
  Frame -> True, GridLines -> {xgrid, ygrid},
  FrameTicks -> {{ytick, None}, {xtick, None}}, PlotRange -> {{0, 8}, {0, 8000}}]

enter image description here

$\endgroup$

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.