LaTeX forum ⇒ Math & Sciencedraw a graph

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
magi6162
Posts: 6
Joined: Thu Jan 14, 2021 8:33 pm

draw a graph

Postby magi6162 » Tue Jan 19, 2021 11:20 pm

This is the end result, it definitely isn't "clean", so who has suggestions to make it better ....
thanks to those who helped me.

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \begin{tikzpicture}[>=latex,scale=1]
  2. \begin{polaraxis}[
  3. domain = 0:360,
  4. samples = 100,
  5. hide axis,
  6. ]
  7. \foreach \w in {140,160,...,340} {
  8. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+\w))} [arrow inside={end=stealth,opt={black, scale=1.05}}{0.5}];}
  9. \addplot[ultra thick, white, domain={97.5:200}] {(1*(1-0.8^2)/(1.2+0.8*cos(x+140)};
  10. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+360))};
  11. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+340))};
  12. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+320))};
  13. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+300))};
  14. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+280))};
  15. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+260))};
  16. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+240))};
  17. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+220))};
  18. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+200))};
  19. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+180))};
  20. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+160))};
  21.  
  22. \addplot[ultra thick, white, domain={10:300}] {(1*(1-0.8^2)/(1.2+0.8*cos(x+360))};
  23. \addplot[thick, black, domain={295:360}] {(1*(1-0.8^2)/(1.2+0.8*cos(x+360))} [arrow inside={end=stealth,opt={black, scale=1.05}}{0.2}];
  24.  
  25. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+340))};
  26. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+320))};
  27. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+300))};
  28. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+280))};
  29. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+260))};
  30. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+240))};
  31. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+220))};
  32. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+200))};
  33. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+180))};
  34. \addplot[thick, black] {(1*(1-0.8^2)/(1.2+0.8*cos(x+160))};
  35. \addplot[thick, black, domain={285:300}] {(1*(1-0.8^2)/(1.2+0.8*cos(x+140))};
  36. \addplot [->] [thin] coordinates {(0,0) (120,0.9)};
  37. \addplot [->] [thin] coordinates {(0,0) (0,0.18)};
  38. \addplot [thin] coordinates {(220,0.92) (220,0.89)};
  39. \addplot [thin] coordinates {(200,0.92) (200,0.89)};
  40. \addplot [thin, black,dashed] {0.9};
  41. \addplot [thin, black,dashed] {0.18};
  42. \addplot [thin, black, fill=white] {0.02};
  43. \end{polaraxis}
  44. \draw[decorate,decoration=brace,rotate around={-230:(1.66,2.3)}] (1.5,3) -- (2.8,2.8);
  45. \coordinate [label={[font=\small] center:$\mathit{\Delta}\varphi$}] (D) at (0.45,2.2);
  46. \coordinate [label={[font=\small] center:$r_{\text{max}}$}] (rmax) at (2.45,6.5);
  47. \coordinate [label={[font=\small] center:$r_{\text{min}}$}] (rmin) at (4.5,3.9);
  48. \end{tikzpicture}


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 3 guests