Have Both \filldraw and Theta Marked on Graph

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

Discussion Overview

The discussion revolves around the use of the \filldraw command in TikZ to create a graphical representation that includes both a filled area and a labeled angle (theta) on a coordinate graph. Participants explore the issue of visibility and output discrepancies between preview and final PDF rendering.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant, dwsmith, expresses a problem where the \filldraw command does not display correctly when theta is marked on the graph.
  • Another participant, Sudharaka, checks the code and suggests that the \filldraw command seems to work, but asks for clarification on what part of the circle dwsmith wants to color.
  • Sudharaka later acknowledges a misunderstanding regarding the output, noting that the desired output appeared in the preview but not in the PDF file.
  • Sudharaka presents modified code in an attempt to resolve the issue, questioning if the new output aligns with dwsmith's expectations.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the effectiveness of the \filldraw command in this context, as there are differing experiences regarding its output in preview versus final rendering.

Contextual Notes

There are unresolved issues regarding the specific expectations for the graphical output and the conditions under which the \filldraw command fails to display as intended.

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
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K