Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

Graphics[{
  Line[{{# - 1, -0.5}, {# - 1, 5.5}} & /@ Range[6]],
  Line[{{-0.5, # - 1}, {5.5, # - 1}} & /@ Range[6]]
  }]

There are two kinds of lines in this simple picture, some lines look sharp and others look blurry. How can I avoid this effect?

If I zoom in the graphics by dragging the controlled-corner, the blurry effect still exists with different lines.

enter image description here

share|improve this question

marked as duplicate by Yves Klett, Pinguin Dirk, Sjoerd C. de Vries, István Zachar, Pickett Oct 15 '13 at 7:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

3 Answers 3

This seems to be connected to Antialiasing (which set to Falseproduces crisp lines):

g = Graphics[{Line[{{# - 1, -0.5}, {# - 1, 5.5}} & /@ Range[6]], 
    Line[{{-0.5, # - 1}, {5.5, # - 1}} & /@ Range[6]]}];

Grid[{{g, Style[g, Antialiasing -> False]}}]

Mathematica graphics

share|improve this answer
    
I thought it was a dupe, and here you are: mathematica.stackexchange.com/q/14543/131 –  Yves Klett Oct 15 '13 at 6:27
    
Nice detective work! –  David Carraher Oct 15 '13 at 10:37
add comment

I was able to replicate the cosmetic glitch but cannot explain why it occurs.
Anyway, here are some options to minimize the effect.

You could use Gridlines:

Graphics[{}, GridLines -> {Range[6], Range[6]}, PlotRange -> {{1, 6}, {1, 6}},  
PlotRangePadding -> 0.5]

gridlines


Or Thin:

Graphics[{Thin, 
Line[{{# - 1, -0.5}, {# - 1, 5.5}} & /@ Range[6]], 
Line[{{-0.5, # - 1}, {5.5, # - 1}} & /@ Range[6]]}]

pic2


Or Thickness:

Graphics[{Thickness[.001], 
Line[{{# - 1, -0.5}, {# - 1, 5.5}} & /@ Range[6]], 
Line[{{-0.5, # - 1}, {5.5, # - 1}} & /@ Range[6]]}]

pic3

share|improve this answer
    
I get the same result by using your first method, but Thin and Thickness contribute nothing. Have you changed the opacity in last two methods? –  withparadox2 Oct 15 '13 at 2:58
    
No opacity changes in the final two pictures. I should mention that I am using a Mac computer with OS X 10.8.5, Mathematica 9.0.1. –  David Carraher Oct 15 '13 at 10:36
add comment
Graphics[{
  EdgeForm@{Black}, Opacity@0,
  Table[Rectangle[{0, 0}, {i, 5}], {i, 5}],
  Table[Rectangle[{0, 0}, {5, i}], {i, 5}]
  }]

enter image description here

share|improve this answer
add comment

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