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.

My included graphics are too blurry so I decided to find out, how to draw the following four graphics in TikZ. I never really worked with TikZ, so can someone explain how to draw such graphics?

Visualization of relations

share|improve this question
1  
You should add a Minimal Working Example and say what is exactly your problem or what you don't know to do. –  Manuel Dec 18 '12 at 1:37
    
You are welcome but what exactly is the question? –  percusse Dec 18 '12 at 1:37
    
@percusse: Added the question. –  Christian Ivicevic Dec 18 '12 at 1:43
add comment

1 Answer

up vote 9 down vote accepted

Here's one possibility:

\documentclass{article}
\usepackage{amssymb}
\usepackage{tikz}

\def\mysquare#1{%
  \node[draw,minimum width=3cm,minimum height=3cm] (#1) {};
  \draw[->] (#1.east) -- +(10pt,0) node[label=below :$\mathbb{R}$] {};
  \draw (#1.west) -- +(-10pt,0);
  \draw[->] (#1.north) -- +(0,10pt) node[label=right :$\mathbb{R}$] {};
  \draw (#1.south) -- +(0,-10pt);
}

\begin{document}
\begin{tikzpicture}[>=latex]
\mysquare{a}
\draw (a.north west)  -- node[auto,swap,midway] {$R_1$} +(1.5cm,-1.5cm) -- (a.north east);
\begin{scope}[xshift=5cm]
\mysquare{b}
\draw (b.north east)  -- node[auto,swap,midway] {$R_1^{-1}$} +(-1.5cm,-1.5cm) -- (b.south east);
\end{scope}
\begin{scope}[yshift=-5cm]
\mysquare{c}
\filldraw[draw=black,fill=blue!20] (c.north east)  -- (c.north west) -- (c.south west) -- cycle;
\node at ([xshift=15pt,yshift=-15pt]c.north west) {$R_2$};
\end{scope}
\begin{scope}[xshift=5cm,yshift=-5cm]
\mysquare{d}
\filldraw[draw=black,fill=blue!20] (d.north east)  -- (d.south west) -- (d.south east) -- cycle;
\node at ([xshift=-15pt,yshift=15pt]d.south east) {$R_2^{-1}$};
\end{scope}
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
add comment

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.