Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. documentclass[tikz]{standalone}
  2. usepackage{pgfplots}
  3. usepackage{pgfplotstable}
  4. begin{document}
  5.  
  6. pgfplotstableread{
  7. 1
  8. 2.5
  9. 3
  10. } myTable % -- I can't use this method with the `expr` syntax ?
  11.  
  12. begin{tikzpicture}
  13. begin{axis}
  14. [
  15. xtick = {1,2.5,3},
  16. ytick = {1,6.25,9},
  17. domain = 0:4,
  18. axis lines = middle,
  19. ]
  20. addplot [thick, blue] {x^2} node [near end, anchor = east] {$y = x^2$};
  21. addplot [xcomb, red] table[x index = 0,y expr=x^2] {
  22. 1
  23. 2.5
  24. 3
  25. };
  26. addplot [ycomb, red] table[x index = 0,y expr=x^2] {
  27. 1
  28. 2.5
  29. 3
  30. };
  31. %addplot table[x index=0,y expr=x^2] {myTable}; % does not work ?!
  32. end{axis}
  33. end{tikzpicture}
  34. end{document}
  35.  
  36. draw [myStyle] (axis cs: 1, 0) |- (axis cs: 0, 1) ;
  37. draw [myStyle] (axis cs: 2.5, 0) |- (axis cs: 0, 6.25) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement