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.

As usual I am typeseting some old exams. I ran into this image shown below

enter image description here

I ran into some problems when trying to tikz it up. In the minimal example below I have been able to almost recreate this image, but my method is very rough. I created a half circle, filled it. Then used some trickery with cutting the figure. My main problem is how do I fill a quarter circle? (preferably using tikz euclide) Now any help improving my figure would be greatly appreciated =)

\documentclass{standalone} 
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\def\a{3} % Defines the radius for the half circle 
\tkzInit[xmin=-.5,xmax=4,ymin=-.5,ymax=4] \tkzClip 
\tkzDefPoint(0,0){O} \tkzDefPoint(\a,0){S1} \tkzDefPoint(0,\a){S2}
                     \tkzDefPoint(-\a,0){S3} \tkzDefPoint(0,-\a){S4}
\tkzDefPointBy[rotation= center O angle 45](S1) \tkzGetPoint{B}
\tkzDefPoint(\a*2^(-0.5),0){A} \tkzDefPoint(0,\a*2^(-0.5)){C}
\tkzDrawArc[fill=blue,opacity=0.3,ultra thin](O,S1)(S3) 
\tkzDrawArc[color=blue,very thick](O,S1)(S2) 
\tkzDrawSquare[fill=white,color=white](S3,O)
\tkzDrawSquare[fill=white](O,A) \tkzDrawSquare[thick](O,A)
\tkzDefPoint(-0.5,0){x1} \tkzDefPoint[label=above left: $x$](1+\a,0){x2} 
\tkzDefPoint(0,-0.5){y1} \tkzDefPoint[label=below left: $y$](0,1+\a){y2}
\tkzDrawSegments[very thick,-stealth](x1,x2 y1,y2) \tkzDrawSegment[dashed](A,C)
\tkzDrawSegments[ultra thick,white]({-0.5,-0.5},{-0.5,4})
\tkzDrawPoints[fill=black,size=2.5](O,A,B,C)
\tkzLabelPoints[below left](O) \tkzLabelPoints[above right](B)
\tkzLabelPoints[below](A) \tkzLabelPoints[left](C)
\tkzLabelPoint[below](S1){$3$} \tkzLabelPoint[left](S2){$3$}
\end{tikzpicture}
\end{document}

EDIT: New MWE

\documentclass{standalone} 
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}
\def\a{3} % Defines the radius and clipping. 
\tkzInit[xmin=-.5,xmax=4,ymin=-.5,ymax=4] \tkzClip
% Defines all the neccecary points.
\tkzDefPoint(0,0){O} \tkzDefPoint(\a,0){S1} \tkzDefPoint(0,\a){S2}
\tkzDefPointBy[rotation= center O angle 45](S1) \tkzGetPoint{B}
\tkzDefPoint(\a*2^(-0.5),0){A} \tkzDefPoint(0,\a*2^(-0.5)){C}
% Draws the quarter cirle. (triangle + arc)
\tkzDrawPolygon[fill=blue,opacity=0.3,color=blue](O,S1,S2)
\tkzDrawArc[fill=blue,opacity=0.3,ultra thin](O,S1)(S2) 
\tkzDrawArc[color=blue,very thick](O,S1)(S2) \tkzDrawSegment[color=blue!30!white](S1,S2)
% Draws the square and the dashed line.
\tkzDrawSquare[color=black,thick,fill=white](O,A) \tkzDrawSegment[dashed](A,C)
% Draws the coordinate axis. 
\tkzDefPoint(-0.5,0){x1} \tkzDefPoint[label=above left: $x$](1+\a,0){x2} 
\tkzDefPoint(0,-0.5){y1} \tkzDefPoint[label=below left: $y$](0,1+\a){y2}
\tkzDrawSegments[very thick,-stealth](x1,x2 y1,y2) 
% Draws the points and label them. 
\tkzDrawPoints[fill=black,size=2.5](O,A,B,C)
\tkzLabelPoints[below left](O) \tkzLabelPoints[above right](B)
\tkzLabelPoints[below](A) \tkzLabelPoints[left](C)
\tkzLabelPoint[below](S1){$3$} \tkzLabelPoint[left](S2){$3$}
\end{tikzpicture}
\end{document}
share|improve this question
add comment

2 Answers

up vote 10 down vote accepted

tkz-euclide manual, although is written in french, is full of examples. On page 112 you will find command \tkzFillSector. Whitin your first example you can use \tkzFillSector[fill=blue,opacity=0.3](O,S1)(S2) to fill the sector with center on O from S1 to S2.

share|improve this answer
    
I actually tried searching trough it, but I am rather weak in the french (as well as the tikz). Thanks though! That simplifies things a great deal! –  N3buchadnezzar Jun 21 '12 at 9:14
add comment

Some informations to complete Ignasi's answer.

You can find in tkz-euclide some macros about arcs, some macro about sectors. Here it's possible to draw the sector and to fill it at the same time with

   \tkzDrawSector[color=blue, thick,fill=blue,fill opacity=0.3](O,S1)(S2)

You need only to draw axis after. It's possible to use

    \tkzDrawXY[noticks,very thick] 

to get axis directly.

I added \tkzClip[space=0.75] to show the tips of the axes. It's possible to reduce xmax and ymax.

You can add `tkz in the tags

The complete code :

\documentclass{standalone} 
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture} 
  \tikzset{xlabel style/.style={below left=6 pt,
                              inner sep = 1pt,
                              outer sep = 0pt}}
\tikzset{xaxe style/.style ={>=stealth,->}}
\tikzset{ylabel style/.style={below left = 6 pt,
                              inner sep = 1pt,
                              outer sep = 0pt}}
\tikzset{yaxe style/.style ={>=stealth,->}}    

\def\a{3} % Defines the radius and clipping. 
\tkzInit[xmin=-.4,xmax=4,ymin=-.4,ymax=4] 
% Defines all the neccecary points.
\tkzDefPoint(0,0){O} \tkzDefPoint(\a,0){S1} \tkzDefPoint(0,\a){S2}
\tkzDefPointBy[rotation= center O angle 45](S1) \tkzGetPoint{B}
\tkzDefPoint(\a*2^(-0.5),0){A} \tkzDefPoint(0,\a*2^(-0.5)){C}
% Draws the quarter cirle. (triangle + arc)
\tkzDrawSector[color=blue, thick,fill=blue,fill opacity=0.3](O,S1)(S2) 
% Draws the square and the dashed line.
\tkzDrawSquare[color=black,thick,fill=white](O,A) \tkzDrawSegment[dashed](A,C) 
% Draws the coordinate axis. 
\tkzDrawX[noticks,very thick,below]
\tkzDrawY[noticks,very thick]  
% Draws the points and label them. 
\tkzDrawPoints[fill=black,size=2.5](O,A,B,C)
\tkzLabelPoints[below left](O)  \tkzLabelPoints[above right](B)
\tkzLabelPoints[below](A)       \tkzLabelPoints[left](C)
\tkzLabelPoint[below](S1){$3$}  \tkzLabelPoint[left](S2){$3$}
\end{tikzpicture}
\end{document}

The result :

enter image description here

share|improve this answer
    
The line S1,S2 was only there to hide the gap between the sector and the polygon(triangle). Very nice! I am learning a lot from your examples. Sorry for not being able to read your manual better, I do not know any french. Two questions: 1. is arrowstyle possible to change? I usually use stealth for consistency. 2. Using \caption beneath the image makes too much space i.imgur.com/CPDWD.png. Is there any fix? I know removing the \tkzClip[space=0.75] helps, but this removes the arrows. –  N3buchadnezzar Jun 21 '12 at 13:23
1  
A lot of styles are in the file : tkz-base.cfg for example \tikzset{xaxe style/.style ={>=latex,->}} idem for yaxe style. You can modify this style with \tikzset{xaxe style/.style ={>=stealth,->}} . If you remove space=0.75 from \tkzClip[space=0.75] you need to change \tkzInit and you can use a clip with tikz \clip (a,b) rectangle (c,d);. I updated my answer with your requests. –  Alain Matthes Jun 21 '12 at 13:43
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.