\documentclass[landscape]{article}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\begin{document}
\begin{tikzpicture}[scale=.5,
show background rectangle,
background rectangle/.style={fill=black},
color=white,help lines/.style={color=lightgray,line width=0.2pt}]
\draw (0,14) node[anchor=north west] {{\bf text}};
\draw (0,13.5) node[anchor=north west] {text};
\draw (0,13) node[anchor=north west] {text};
\draw (0,12.5) node[anchor=north west] {text};
\draw (0,12) node[anchor=north west] {text};
\draw (0,1) node[anchor=north west] {{\bf Deliberately left blank}};
% bounding box
\draw[style=help lines] (11,0.5) rectangle (12.5,14);
\draw[style=help lines] (11.75,0.5) rectangle (13.25,14);
\draw[style=help lines] (14,0.5) rectangle (15.5,14);
\draw[style=help lines] (14.75,0.5) rectangle (16.25,14);
\draw[style=help lines] (17,0.5) rectangle (18.5,14);
\draw[style=help lines] (17.75,0.5) rectangle (19.25,14);
\draw[style=help lines] (20,0.5) rectangle (21.5,14);
\draw[style=help lines] (20.75,0.5) rectangle (22.25,14);
\draw[style=help lines] (23,0.5) rectangle (24.5,14);
\draw[style=help lines] (23.75,0.5) rectangle (25.25,14);
\draw[style=help lines] (0,14) -- (26,14);
\draw[style=help lines] (0,11) -- (26,11);
\draw[style=help lines] (0,7.5) -- (26,7.5);
\draw[style=help lines] (0,3.5) -- (26,3.5);
\draw[style=help lines] (0,1) -- (26,1);
\draw (11,0.5) rectangle (26,14);
\draw (14,0.5) rectangle (23,14);
\draw (17,0.5) rectangle (20,14);
\draw (12.5,14) node[anchor=south] {Year 1};
\draw (15.5,14) node[anchor=south] {Year 2};
\draw (18.5,14) node[anchor=south] {Year 3};
\draw (21.5,14) node[anchor=south] {Year 4};
\draw (24.5,14) node[anchor=south] {Year 5};
% blocks
\filldraw[fill=Silver] (11,13) rectangle (13.25,13.5);
\filldraw[fill=Silver] (11.75,12.5) rectangle (16.25,13);
\filldraw[fill=Silver] (14,12) rectangle (17.75,12.5);
\filldraw[fill=Silver] (15.5,11.5) rectangle (20,12);
%\filldraw[fill=Silver] (17,11) rectangle (17.75,11.5);
\filldraw[fill=Silver] (13.25,10) rectangle (16.25,10.5);
\filldraw[fill=Silver] (14.75,9.5) rectangle (18.5,10);
\filldraw[fill=Silver] (17,9) rectangle (20.75,9.5);
\filldraw[fill=Silver] (18.5,8.5) rectangle (22.25,9);
%\filldraw[fill=Silver] (20.75,8) rectangle (20,8.5);
\filldraw[fill=Silver] (14,6.5) rectangle (20,7);
\filldraw[fill=Silver] (19.25,6) rectangle (24.5,6.5);
\filldraw[fill=Silver] (15.5,5.5) rectangle (17.75,6);
\filldraw[fill=Silver] (17.75,5) rectangle (20, 5.5);
\filldraw[fill=Silver] (20,4.5) rectangle (22.25,5);
\filldraw[fill=Silver] (22.25,4) rectangle (24.5,4.5);
\filldraw[fill=Silver] (11,2.5) rectangle (13.25,3);
\filldraw[fill=Silver] (13.25,2) rectangle (15.5,2.5);
\filldraw[fill=Silver] (15.5,1.5) rectangle (24.5, 2);
\filldraw[fill=Silver] (17.75,1) rectangle (24.5,1.5);
\filldraw[fill=Silver] (24.5,0.5) rectangle (26,1);
\end{tikzpicture}
\end{document}
By default, tikz
uses centimeter
s (cm) as unit. You are using dimensions of the order of 200
(meaning 200cm) resulting in your image going beyond page and part of the image is not seen. Try setting [x=1mm,y=1mm]
, specifying all dimensions in mm and changing (unrelated) all tikzstyle
s (deprecated) to tikzset
brings the image within the page.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usetikzlibrary{backgrounds,fit,shapes}
\usetikzlibrary{positioning}
\tikzset{X/.style = {rectangle, fill=orange!30!white},
Y/.style = {rectangle, fill=green!30!white},
Other/.style = {rectangle, fill=blue!30!white}
}
\begin{document}
\begin{tikzpicture}[x=1mm,y=1mm]
\draw [thin,dashed][help lines,step=5mm] (0,0) grid (125,20);
\draw [help lines,step=10mm] (0,0) grid (125,20);
\node [Y, anchor=south west, minimum width=100mm,minimum height=10mm] (Response) at (0,0) {};
\node [below=of Response] {\small Variation in response};
\node [X, anchor=south west, minimum width=75mm,minimum height=5mm] (Explanatory) at (0,0) {};
\node [above=of Explanatory] {\small Explanatory};
\node [Other, anchor=south west, minimum width=50mm,minimum height=5mm] (Other) at (75mm,1mm) {};
\node [above=of Other] {\small Other};
\end{tikzpicture}
\end{document}
The dashed lines are 5mm
apart from 0 to 125mm and the solid ones are 10mm apart. Hope this is helpful.
Best Answer
There are predefined anchor names for the node
image
, therefore you can use:(image.south west)
instead of(image.bottom left)
(image.north east)
instead of(image.top right)
Also coordinates can be specified as intersections of perpendicular lines:
(8, 0 |- image.north)
instead of(8, image.top)
(8, 0 |- image.south)
instead of(8, image.bottom)
(10, 0 |- image.south)
instead of(10, image.bottom)