Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{pgf}
- pgfmathsetseed{numberpdfrandomseed}
- usepackage{pgffor}
- usepackage{tikz}
- pgfmathdeclarerandomlist{FracSlopes}
- {%
- {frac{1}{2}}
- {frac{3}{2}}
- {frac{5}{2}}
- {frac{7}{2}}
- {frac{1}{3}}
- {frac{2}{3}}
- {frac{4}{3}}
- {frac{5}{3}}
- {frac{7}{3}}
- }
- pgfmathrandomitem{FracSlope}{FracSlopes}
- begin{document}
- % Since the line below works
- % I know the fraction is being selected randomly.
- (y=FracSlope{x})
- begin{tikzpicture}[scale=0.3]
- draw[help lines, gray, thin] (-10,-10) grid (10,10);
- draw[very thick,<->] (-10.3,0)--(10.3,0);
- draw[very thick,<->] (0,-10.3)--(0,10.3);
- %
- % Everythig compiles if the next two lines are commented out.
- clip (-10,-10) rectangle (10,10);
- draw[blue, very thick, domain=-10:10] plot (x,FracSlope*x);
- % It's interpreting FracSlope as a string, not a number.
- % I'm *pretty* sure that's the problem.
- end{tikzpicture}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement