Efficiently Scale Pictures in TikZ with Simple Code | No Quotation Marks

In summary, the conversation discusses the process of scaling a picture using the TikZ package. The expert summarizer notes that the scale must be placed inside the square brackets after \begin{tikzpicture} and provides an example of how to do so. They also mention that the use of x and y ticks can be limited in Desmos, prompting the original speaker to try using previous examples.
  • #1
karush
Gold Member
MHB
3,269
5
as you see from %[scale=0.8]
I tried to scale the picture but it didn't after removing the %

\begin{tikzpicture}%[scale=0.8]
[declare function = {
tilde_y(\q) = sign(\q)*sqrt(abs(\q) / (1 - (abs(\q)-3)^3));},
pics/coordinates/.style args={(#1,#2),(#3,#4)}{ code={
%\draw[help lines] (#1,#2) grid (#3,#4);
\draw[-latex] (#1,0) -- (#3,0);
\draw[-latex] (0,#2) -- (0,#4);
%\node foreach \i in {#1,...,#3} at (\i,-0.1) [ below ] {$\i$};
%\node foreach \i in {#2,...,#4} at (-0.1,\i) [ left ] {$\i$};
}},
every node/.style={fill=black!5},
fill=black!5,]
\pic {coordinates={(-3,-2),(3,4)}};
\begin{scope}[draw=blue, ultra thick]
\draw[domain=-3.5:3.5, variable=\q, smooth] plot ({(abs(\q) - 3) * tilde_y(\q)}, {1 + tilde_y(\q)});
\filldraw foreach \p in {(1,3),(-1,2),(1,0),(-1,-1)} { \p circle (0.06) };
\end{scope}
\end{tikzpicture}
 
Last edited:
Physics news on Phys.org
  • #2
karush said:
as you see from %[scale=0.8]
I tried to scale the picture but it didn't after removing the %
There are already square brackets after \begin{tikzpicture}, which contain the declare function.
The scale must be inside like [scale=0.8, declare function....
When we do so, we get:
\begin{tikzpicture}
[scale=0.8, declare function = {
tilde_y(\q) = sign(\q)*sqrt(abs(\q) / (1 - (abs(\q)-3)^3));},
pics/coordinates/.style args={(#1,#2),(#3,#4)}{ code={
%\draw[help lines] (#1,#2) grid (#3,#4);
\draw[-latex] (#1,0) -- (#3,0);
\draw[-latex] (0,#2) -- (0,#4);
%\node foreach \i in {#1,...,#3} at (\i,-0.1) [ below ] {$\i$};
%\node foreach \i in {#2,...,#4} at (-0.1,\i) [ left ] {$\i$};
}},
every node/.style={fill=black!5},
fill=black!5,]
\pic {coordinates={(-3,-2),(3,4)}};
\begin{scope}[draw=blue, ultra thick]
\draw[domain=-3.5:3.5, variable=\q, smooth] plot ({(abs(\q) - 3) * tilde_y(\q)}, {1 + tilde_y(\q)});
\filldraw foreach \p in {(1,3),(-1,2),(1,0),(-1,-1)} { \p circle (0.06) };
\end{scope}
\end{tikzpicture}
 
  • #3
mahalo, yes I didn't know that...
i was going to put x and y ticks in where the critical points are but
but will try from previous examples
don't really need here but just want to see how it works
the one think i didn't like about desmos was the very limited setup for ticks
 

Similar threads

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