0

I would like to put an angle between a curve and a particular axis (let's say the x-axis). I tried several options but chose to use angles however it's still not working.

Can somebody help me to identify the problem ?

Script :

\documentclass[margin=3mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{angles, arrows.meta, quotes} \usepackage{siunitx} \begin{center} \begin{tikzpicture}[scale=1, the_angle/.style args = {#1/#2}{draw,<->, angle radius=#1, angle eccentricity=#2, %anchor=south west, }, % angle label position dot/.style = {circle, fill, inner sep=-1.2pt} ] \pgfplotsset{ticks=none} \begin{axis}[axis lines=middle,xmin=0,xmax=15,ymin=0,ymax=7, ultra thick, xlabel=$\scriptstyle \log(t)$, ylabel=$\scriptstyle \log(R)$, x label style={at={(1,-0.01)},anchor=north}, y label style={at={(-0.15,1)},anchor=west}, ] % \addplot+[no marks,blue,domain=0:8,samples=300, thick] {(1/3)*x} coordinate (A); \coordinate (O) at (0,0); % intersection with coordinate axis \coordinate (C) at (2,0); \pic [the_angle=9mm/1.2, $\qty{30}{\degree}$] {angle = C--O--A}; \addplot+[no marks,dashed,blue,domain=8:14,samples=300, thin] {(1/3)*(x-8)+8/3}; \addplot+[no marks,ForestGreen,domain=8:14,samples=300, thick] {(1/2)*(x-8)+8/3}; \addplot+[no marks,dashed,ForestGreen,domain=0:8,samples=300, thin] {(1/2)*(x-8)+8/3}; % \node[dot, label=left:$\lambda_{E-G}$] at (0,8/3) {}; \draw[gray, thick, dash pattern=on 6pt off 3pt] (0,8/3) -- (8,8/3); \end{axis} \end{tikzpicture} \end{center} \end{document} 

this option was suggested in this post : here

and i obtain the following error :

enter image description here

Thank you for your help,

Sincerely.

1 Answer 1

4

You are missing the " " marks:

\documentclass[margin=3mm,tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{angles, arrows.meta, quotes} \usepackage{siunitx} \begin{document} \begin{tikzpicture}[scale=1, the_angle/.style args = {#1/#2}{draw,<->, angle radius=#1, angle eccentricity=#2, %anchor=south west, }, % angle label position dot/.style = {circle, fill, inner sep=-1.2pt} ] \pgfplotsset{ticks=none} \begin{axis}[axis lines=middle,xmin=0,xmax=15,ymin=0,ymax=7, ultra thick, xlabel=$\scriptstyle \log(t)$, ylabel=$\scriptstyle \log(R)$, xlabel style={at={(1,-0.01)},anchor=north}, ylabel style={at={(-0.15,1)},anchor=west}, ] % \addplot+[no marks,blue,domain=0:8,samples=300, thick] {(1/3)*x} coordinate (A); \coordinate (O) at (0,0); % intersection with coordinate axis \coordinate (C) at (2,0); \addplot+[no marks,dashed,blue,domain=8:14,samples=300, thin] {(1/3)*(x-8)+8/3}; \addplot+[no marks,green,domain=8:14,samples=300, thick] {(1/2)*(x-8)+8/3}; \addplot+[no marks,dashed,green,domain=0:8,samples=300, thin] {(1/2)*(x-8)+8/3}; \draw[gray, thick, dash pattern=on 6pt off 3pt] (0,8/3) -- (8,8/3); \end{axis} \pic [the_angle=9mm/1.2, "\qty{30}{\degree}"] {angle = C--O--A}; \node[dot, label=left:$\lambda_{E-G}$] at (0,8/3) {}; \end{tikzpicture} \end{document} 
6
  • Thank you a lot @codeR it works perfectly : very nice ! Commented Mar 29, 2024 at 8:41
  • it is off-topic but could I ask you why the node \node[dot, label=left:"$\lambda_{E-G}$"] at (0,8/3) {};is not showing up correctly in the generated figure ? thank you in advance Commented Mar 29, 2024 at 10:17
  • Your axis setup is clippling out the node. Move the line \node[dot, label=left:"$\lambda_{E-G}$"] at (0,8/3) {}; after \end{axis} to make it visible. Commented Mar 29, 2024 at 11:38
  • nodes are appearing now but their position in the graph seem totally disrupted (I need them precisely on the coordinates specified)... thank you for your kind help, I think I will open an another post for this issue Commented Mar 30, 2024 at 13:18
  • 1
    What do you mean the positions are wrong? Can you please elaborate? Also I have updated the code a little bit, hope it helps. Commented Apr 1, 2024 at 8:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.