MHB Have Both \filldraw and Theta Marked on Graph

  • Thread starter Thread starter Dustinsfl
  • Start date Start date
AI Thread Summary
The discussion revolves around a coding issue in a TikZ diagram where the user wants to display both a theta marking and a filled area using the \filldraw command. Initially, the user notes that the fill does not appear when theta is marked on the graph. Another participant, Sudharaka, reviews the code and confirms that the \filldraw command seems functional but seeks clarification on which part of the circle needs coloring. The user later realizes that the desired output appears in the preview but not in the final PDF. They modify the code and inquire if the changes yield the intended result, indicating a collaborative effort to resolve the issue with visual output in the diagram.
Dustinsfl
Messages
2,217
Reaction score
5
Since I have theta marked on the graph, fill draw doesn't show anymore. How can I have both?
Code:
\filldraw[left color=gray,right color=green, draw=green!50!black] -- (3mm,0mm) arc (0:30:4mm) -- cycle;
\draw[->] (-1.5,0) -- (1.5,0) coordinate (x axis); 
\draw[->] (0,-1.5) -- (0,1.5) coordinate (y axis);
\draw (0,0) circle (1cm);
\foreach \x in {-1,1}
\draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor = north] {$\x$};
\foreach \y in {-1,1}
\draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor = east] {$\y$};
\draw -- node[right = .5 pt] {$\theta$}(0.9,0.35);
\draw[very thick, black] (0,0) -- (.70710678,.70710678);
 
Physics news on Phys.org
dwsmith said:
Since I have theta marked on the graph, fill draw doesn't show anymore. How can I have both?
Code:
\filldraw[left color=gray,right color=green, draw=green!50!black] -- (3mm,0mm) arc (0:30:4mm) -- cycle;
\draw[->] (-1.5,0) -- (1.5,0) coordinate (x axis); 
\draw[->] (0,-1.5) -- (0,1.5) coordinate (y axis);
\draw (0,0) circle (1cm);
\foreach \x in {-1,1}
\draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor = north] {$\x$};
\foreach \y in {-1,1}
\draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor = east] {$\y$};
\draw -- node[right = .5 pt] {$\theta$}(0.9,0.35);
\draw[very thick, black] (0,0) -- (.70710678,.70710678);

Hi dwsmith, :)

I checked your code, and to me the command \filldraw seem to work, although I am not sure as to what you expect out of it. What part of the circle do you want to color?

Kind Regards,
Sudharaka.
 
Sudharaka said:
Hi dwsmith, :)

I checked your code, and to me the command \filldraw seem to work, although I am not sure as to what you expect out of it. What part of the circle do you want to color?

Kind Regards,
Sudharaka.

https://www.physicsforums.com/attachments/352

See page 6 and you will see that fill draw didn't work.
 
dwsmith said:
https://www.physicsforums.com/attachments/352

See page 6 and you will see that fill draw didn't work.

I understand the problem now. For some reason I saw the desired output in the preview but not in the pdf file. I have changed the code(highlighted in red) and hope it works now. :) Is this the intended output?
Code:
\begin{tikzpicture}\filldraw[left color=gray,right color=green, draw=green!50!black] (0,0) -- (3mm,0mm) arc (0:30:4mm) -- cycle;\draw[->] (-1.5,0) -- (1.5,0) coordinate (x axis); 

\draw[->] (0,-1.5) -- (0,1.5) coordinate (y axis);
\draw (0,0) circle (1cm);
\foreach \x in {-1,1}
\draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor = north] {$\x$};
\foreach \y in {-1,1}
\draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor = east] {$\y$};
\draw -- node[right = .5 pt] {$\theta$}(0.9,0.35);
\draw[very thick, black] (0,0) -- (.70710678,.70710678);\end{tikzpicture}
 

Similar threads

Replies
4
Views
2K
Replies
0
Views
5K
Replies
1
Views
2K
Replies
8
Views
2K
Replies
2
Views
1K
Replies
2
Views
5K
Back
Top