0

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?

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
mrz
  • 11,686
  • 2
  • 25
  • 81

1 Answers1

2
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