Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. documentclass{article}
  2. usepackage{tikz,pgfplots}
  3. usepgfplotslibrary{fillbetween}
  4. pagestyle{empty}
  5. begin{document}
  6.  
  7. begin{tikzpicture}
  8. % Eixos
  9. begin{axis}[
  10. grid,
  11. axis x line=center,
  12. axis y line=center,
  13. xtick={-1,0,1},
  14. ytick={-1,0,1},
  15. xlabel={$x$},
  16. ylabel={$y$},
  17. xlabel style={below right},
  18. ylabel style={above left},
  19. xmin=-0.5,
  20. xmax=1.1,
  21. ymin=-0.5,
  22. ymax=1.1]
  23.  
  24. % Função de cima contínua
  25. addplot[name path=f,domain=0:1,CCazul] {x};
  26. % Função de baixo cintínua
  27. addplot[name path=g,domain=0:1,CCvermelho] {x^2};
  28.  
  29. % Função de cima pontilhada
  30. addplot[dashed, name path=fpont1,domain=-.5:0,CCazul] {x};
  31. addplot[dashed, name path=fpont2,domain=1:1.1,CCazul] {x};
  32. % Função de baixo pontilhada
  33. addplot[dashed, name path=gpont1,domain=-.5:0,CCvermelho] {x^2};
  34. addplot[dashed, name path=gpont2,domain=1:1.1,CCvermelho] {x^2};
  35.  
  36. % Path
  37. path[name path=axis] (axis cs:0,0) -- (axis cs:1,0);
  38.  
  39. %Fill between
  40. addplot [
  41. thick,
  42. color=black,
  43. fill=black,
  44. fill opacity=0.05
  45. ]
  46. fill between[
  47. of=f and g,
  48. soft clip={domain=0:1},
  49. ];
  50.  
  51. % Labels dos nós
  52. node [color=CCazul] at (axis cs: .55, .8) {$f(x) = x$};
  53. node [color=CCvermelho] at (axis cs: 0.9, .4) {$g(x) = x^2$};
  54. end{axis}
  55. end{tikzpicture}
  56.  
  57. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement