0

Thanks to Torbjørn T.'s answer at Best way to generate a nice function plots in LaTeX?, there is an easy way to show multiple graphs using TikZ's datavisualization. Is there a way to shade i.e. fill in the region bounded by these graphs?

  • 1
    An MWE of the two functions on one axis would be useful. – John Kormylo Nov 29 '16 at 20:08
  • As an aside, if you're not locked to the datavisualization library, you could look at pgfplots. Search the site for e.g. [pgfplots] fill between – Torbjørn T. Nov 29 '16 at 20:16
1

Try:

\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
  \begin{axis}
    \addplot[name path=f] {x^2 - x +4}; 
    \addplot[name path=g] {x^2 - x}; 
    \addplot [
        fill=blue, 
        fill opacity=0.2
    ]
    fill between[
        of=f and g
    ];
  \end{axis}
\end{tikzpicture}
\end{document}

Output: enter image description here

| improve this answer | |
  • 1
    Is there a way to do it with datavisualization? – An Hoa Nov 29 '16 at 21:01
  • Sorry, didn't read that part of your question. – Hood Chatham Nov 30 '16 at 0:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.