Have Both \filldraw and Theta Marked on Graph

  • Context: MHB 
  • Thread starter Thread starter Dustinsfl
  • Start date Start date
Click For Summary
SUMMARY

The discussion revolves around the issue of displaying both the \filldraw command and the theta marker on a TikZ graph in LaTeX. The user, dwsmith, initially faced challenges with the \filldraw command not appearing in the final PDF output, despite it showing correctly in the preview. Sudharaka provided assistance by confirming that the \filldraw command works, but sought clarification on the specific area of the circle that dwsmith intended to color. Ultimately, dwsmith modified the code to achieve the desired output.

PREREQUISITES
  • Familiarity with LaTeX typesetting
  • Understanding of TikZ package for creating graphics
  • Knowledge of LaTeX commands such as \filldraw and \draw
  • Experience with generating PDF outputs from LaTeX documents
NEXT STEPS
  • Explore advanced TikZ techniques for complex graphics
  • Learn about customizing color fills in TikZ diagrams
  • Investigate troubleshooting common LaTeX PDF output issues
  • Study the use of arcs and shapes in TikZ for enhanced visual representation
USEFUL FOR

This discussion is beneficial for LaTeX users, particularly those working with TikZ for graphical representations, including mathematicians, educators, and researchers creating visual aids for presentations or publications.

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
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 0 ·
Replies
0
Views
6K
  • Poll Poll
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K