# Simple plot control

Absolute newbie question:

 Plot[2x-1,{x,-4,4},GridLines->{Range[-4,4],Range[-8,8]}]


works about as expected, except that

• (a) I would like the tick marks to be at integers only,
• (b) I would like to control the ordinates so that the y scale is the same as for x.

By default, x goes in steps of .5 with labels at -4,-2, 2 and 4; y goes in steps of 1 with labels at -10, -5, and 5.

• (c) I would like more of the tick marks to be labelled.

The result should look like something from an elementary algebra student handout. Hopefully, the grid and labels will stay the same even if the intercept and slope change.

Apologies for not inserting a picture in the question. It seems to involve more than snip, copy and paste.

Suggestions for improving my code will be appreciated.

• Look up Ticks in the help system and study the examples. They show how to make the Ticks be almost anything you want. You might want to keep in mind that trying to make your output look like a textbook or published math paper is probably going to take several times as much time and effort to get it almost right as it took to get the mathematics exactly right. – Bill Nov 10 '14 at 7:09
• Look up Ticks (or FrameTicks if you're using frames). Furthermore AspectRatio. These functions are all on a help document page of their own as well as on thePlot help page. – Sjoerd C. de Vries Nov 10 '14 at 7:10
• Hi, welcome to Mathematica.SE, Thanks for taking the tour. Once you gain enough reputation by making good questions you will be able to vote up and down both questions and answers. Your question has been answered, and there are things to do after that. its good practice to wait a few hours for other answers before up-voting and accepting the best one for you. – rhermans Nov 10 '14 at 11:34
• For simple image upload check this questions and answer – rhermans Nov 10 '14 at 11:47

This covers (a) and (b)

ticks[min_, max_] := Table[{i, Style[i, 14, Blue], {.04, 0}},
{i, Ceiling[min], Floor[max]}]

Plot[2 x - 1, {x, -4, 4},
GridLines -> {Range[-4, 4], Range[-8, 8]},
GridLinesStyle -> LightGray,
AspectRatio -> Automatic,
Ticks -> ticks,
PlotStyle -> Red]


(c) I would like more of the tick marks to be labeled

Because before you said

(a) I would like the tick marks to be at integers only,

I do not know how to put these 2 seemingly conflicting specifications on the same plot. If you have screen shot it will help.

Plot[2 x - 1, {x, -4, 4}, GridLines -> {Range[-4, 4], Range[-8, 8]},