0
$\begingroup$

With the following example code

Graphics[
  {
    Line[{{0, 0}, {6, 6}}]
  }, ImageSize -> {500, 500}, Frame -> True
]

I get:

enter image description here

How can I produce grid lines vertically and horizontally each 0.5 steps. The small tick marks should be 0.5 apart and the large 1.

How can that be done in the Graphics environment?

$\endgroup$

closed as off-topic by Kuba, chuy, m_goldberg, MarcoB, PlatoManiac Jun 6 '16 at 20:04

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." – Kuba, chuy, m_goldberg, MarcoB, PlatoManiac
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Graphics takes the option GridLines. $\endgroup$ – N.J.Evans Jun 6 '16 at 12:08
  • 1
    $\begingroup$ Do you want to create GridLines or Ticks? Either way, documentation answers your question, right? $\endgroup$ – Kuba Jun 6 '16 at 12:10
  • 1
    $\begingroup$ Look into the Graphics options GridLines and Ticks $\endgroup$ – m_goldberg Jun 6 '16 at 12:12
  • $\begingroup$ @Kuba: both, small ticks should be each 0.5 steps, large ticks each 1 step, and the grid lines should be at both axes each 0.5 steps. $\endgroup$ – mrz Jun 6 '16 at 12:17
  • 1
    $\begingroup$ But what from documentation is not clear? $\endgroup$ – Kuba Jun 6 '16 at 12:18
2
$\begingroup$
myRange = Range[0, 6, 0.5]

{0., 0.5, 1., 1.5, 2., 2.5, 3., 3.5, 4., 4.5, 5., 5.5, 6.}

Graphics[{Line[{{0, 0}, {6, 6}}]}, Frame -> True, GridLines -> {myRange, myRange}]

enter image description here

And directly from the documentation:

grids[min_, max_] := 
Join[Range[Ceiling[min], Floor[max]], 
Table[{j + .5, Dashed}, {j, Round[min], Round[max - 1], 1}]]

Graphics[{Line[{{0, 0}, {6, 6}}]}, Frame -> True, GridLines -> {grids, grids}]

enter image description here

$\endgroup$

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