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

Why does the outer line of the triangle grid (= the dark gray one) look so much more bright? It seems to get the same colour when I change draw=gray to draw=black, but that doesn't make much sense to me (yet). Could someone explain please?

Picture with draw=gray

enter image description here

Picture with draw=black

enter image description here

MWE

\documentclass[
11pt
]{scrartcl}

\usepackage{
tikz,
relsize,
amsmath
}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}


%% from here on forth TikZ-stuff

\usetikzlibrary{
calc,trees,shadows,positioning,arrows,chains,shapes.geometric,
decorations.pathreplacing,decorations.pathmorphing,shapes,
matrix,shapes.symbols,patterns,intersections,fit
}

\pgfdeclarelayer{background layer}
\pgfdeclarelayer{foreground layer}
\pgfsetlayers{background layer,main,foreground layer}

\tikzset{
>=latex
}

\begin{document}
\begin{center}
\begin{tikzpicture}[font=\sffamily\small]
%N
\draw[style=help lines,step=0.5cm] (0,0) grid (9,6);
%
\draw[->,thick] (-0.1,0) -- (9.5,0) node[anchor=west]{Input};
\draw[->,thick] (0,-0.1) -- (0,6.5) node[anchor=south]{Output}; 
%
\foreach \x in {0,1,...,9} \draw [thick](\x cm,-2pt) -- (\x cm,2pt);
\foreach \y in {0,1,...,6} \draw [thick](-2pt,\y) -- (2pt,\y);
%
\foreach \x in {0,1,...,9} \draw (\x cm, 0 cm) node[anchor=north]{\x};
\foreach \y in {0,1,...,6}  \draw (0 cm, \y cm) node[anchor=east]{\y};
\draw
(2,1) coordinate (A)
(3,3) coordinate (B)
(3,2) coordinate (C)
(4,3) coordinate (D)
(5,4) coordinate (E)
(5,2) coordinate (F)
(6,3) coordinate (G)
(8,5) coordinate (H)
;
%%Cone
\begin{pgfonlayer}{background layer}
\draw[draw=gray,fill=gray,pattern=grid,draw opacity=0.6,fill opacity=0.6] (F) -- ($(F) + (-3.5,0)$) -- ($(F) + (0,3.5)$) -- cycle;
\end{pgfonlayer}
%%Labels + Circles
\foreach \pt/\labpos in {A/below right,B/below right,C/below right,D/below right,E/below right,F/below right,G/below right,H/below right}{
        \filldraw (\pt) circle(2pt) node[\labpos=3pt,fill=white]{\pt};
}
\end{tikzpicture}
\end{center}

\end{document}
share|improve this question
1  
The outer line of the light gray grid or the dark gray grid? –  dustin Aug 19 '13 at 12:57
    
Good call. Sorry. Meant the dark gray grid => the triangle. I'll edit the op. –  henry Aug 19 '13 at 12:57
    
It all looks the same to me or at least I can't tell there is a difference. –  dustin Aug 19 '13 at 12:59
    
Hm, weird. Added a picture for draw=black to the op. Both snapshots were taken with 6400% zoom in Adobe Reader XI. –  henry Aug 19 '13 at 13:04

1 Answer 1

up vote 4 down vote accepted

Don't set draw opacity=0.6: That will make black lines appear gray, and gray lines appear in a lighter shade of gray, because the white paper shines through. The draw color isn't applied to the grid pattern, its color is still black, which is why it appears as a darker gray than the outline.

To get both the grid and the outline in the same shade of gray, simply set draw=gray, pattern color=gray (without draw opacity=0.6):

\documentclass[
11pt
]{standalone}

\usepackage{
tikz,
amsmath
}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}


%% from here on forth TikZ-stuff

\usetikzlibrary{
calc,trees,shadows,positioning,arrows,chains,shapes.geometric,
decorations.pathreplacing,decorations.pathmorphing,shapes,
matrix,shapes.symbols,patterns,intersections,fit
}

\pgfdeclarelayer{background layer}
\pgfdeclarelayer{foreground layer}
\pgfsetlayers{background layer,main,foreground layer}

\tikzset{
>=latex
}

\begin{document}
\begin{tikzpicture}[font=\sffamily\small]
%N
\draw[style=help lines,step=0.5cm] (0,0) grid (9,6);
%
\draw[->,thick] (-0.1,0) -- (9.5,0) node[anchor=west]{Input};
\draw[->,thick] (0,-0.1) -- (0,6.5) node[anchor=south]{Output}; 
%
\foreach \x in {0,1,...,9} \draw [thick](\x cm,-2pt) -- (\x cm,2pt);
\foreach \y in {0,1,...,6} \draw [thick](-2pt,\y) -- (2pt,\y);
%
\foreach \x in {0,1,...,9} \draw (\x cm, 0 cm) node[anchor=north]{\x};
\foreach \y in {0,1,...,6}  \draw (0 cm, \y cm) node[anchor=east]{\y};
\draw
(2,1) coordinate (A)
(3,3) coordinate (B)
(3,2) coordinate (C)
(4,3) coordinate (D)
(5,4) coordinate (E)
(5,2) coordinate (F)
(6,3) coordinate (G)
(8,5) coordinate (H)
;
%%Cone
\begin{pgfonlayer}{background layer}
\draw[draw=gray,fill=gray,pattern=grid,pattern color=gray] (F) -- ($(F) + (-3.5,0)$) -- ($(F) + (0,3.5)$) -- cycle;
\end{pgfonlayer}
%%Labels + Circles
\foreach \pt/\labpos in {A/below right,B/below right,C/below right,D/below right,E/below right,F/below right,G/below right,H/below right}{
        \filldraw (\pt) circle(2pt) node[\labpos=3pt,fill=white]{\pt};
}
\end{tikzpicture}

\end{document}
share|improve this answer
    
Thanks. Your MWE contains the correct code pattern color=gray, your code bit in the text still says fill color=gray btw. –  henry Aug 19 '13 at 13:12
    
@henry: Oh yeah, sorry! Corrected now. –  Jake Aug 19 '13 at 13:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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