LaTeX forum ⇒ Graphics, Figures & TablesConnecting Line between Points not straight Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
mayankmi
Posts: 45
Joined: Sat Apr 20, 2013 7:52 pm
Location: portugal

Connecting Line between Points not straight

Postby mayankmi » Thu Jul 04, 2013 3:55 pm

Hey. I used this code, but the line joining two points (0.5,0.7) to (1,0.7) is not exactly straight. It is a bit curved. I want to make this line straight.

  1. \documentclass[11pt]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{pgfplots}
  4.  
  5. \pgfplotsset{compat=newest}
  6.  
  7. \begin{document}
  8. \begin{figure}[!htb]
  9. \centering
  10. \begin{tikzpicture}
  11. \begin{axis}[
  12. width=12cm,
  13. height=8cm,
  14. grid=both,
  15. xmin=0,
  16. xmax=1,
  17. ymin=0,
  18. ymax=1.5,
  19. xlabel={Weighing factor for NDT test (w)},
  20. ylabel={Trust factor (T)}
  21. ]
  22. \addplot[smooth,mark=*,black] plot coordinates {
  23. (0,1.3)
  24. (0.5,0.7)
  25. (1,0.7)
  26. };
  27. \addlegendentry{Trust factor T = 1.3 - 0.5 w};
  28. \end{axis}
  29. \end{tikzpicture}
  30. \caption{Proposed trust factor for NDT tests}
  31. \label{Proposed trust factor for NDT tests}
  32. \end{figure}
  33. \end{document}
Attachments
tmp.png
A bit curved instead of straight.
tmp.png (7.29 KiB) Viewed 3720 times

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 3584
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Thu Jul 04, 2013 4:20 pm

The first part isn't straight either. Just remove the smooth option from your \addplot command.

  1. \documentclass[11pt]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{pgfplots}
  4.  
  5. \begin{document}
  6. \begin{tikzpicture}
  7. \begin{axis}
  8. \addplot[
  9. % smooth,
  10. mark=*,
  11. black
  12. ] plot coordinates {
  13. (0,1.3)
  14. (0.5,0.7)
  15. (1,0.7)
  16. };
  17. \end{axis}
  18. \end{tikzpicture}
  19. \end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

mayankmi
Posts: 45
Joined: Sat Apr 20, 2013 7:52 pm
Location: portugal

Postby mayankmi » Thu Jul 04, 2013 6:59 pm

ohkk.. now it works... thx


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: alsanadm and 8 guests