2

I am using geogebra to do some graphics of functions in LaTeX, but it is not giving me the same results. This is how de graphic looks like in GeoGebra: Geogebra graph

Exporting the TikZ code, I get the image on top, exporting the PSTricks code I get the exact image I want (bottom)

TikZ and PSTricks graph

Usually I don't mind using PSTricks, but for this case I would rather not have to build the picture file separately. Does anyone know how do I get the shading part using the TikZ package??

P.S.: The code for this picture is too long for me to post here, sorry.

  • Please post the code and we won't be sorry. – Werner Jun 6 '17 at 20:13
  • @Werner github.com/lpeconick/TikZ/issues/1 – LauraP Jun 6 '17 at 20:29
  • Tip: A gist might be a more convenient place for things like this, it's meant as a way of sharing single blocks of code. – Torbjørn T. Jun 6 '17 at 21:50
  • 1
    You are better off not starting from that code if you need to edit it. Use pgfplots or redo the TikZ version. It is fine when exports give you usable-as-is code. But when they don't, the code is horrible. – cfr Jun 7 '17 at 0:45
4

This can be a starting point where good users can edit and add what is missing. enter image description here

\documentclass{article}
\usepackage{pgfplots}
\usepackage{amssymb, amsmath}
\usepackage{tikz}
\usepackage{xcolor}
\pgfplotsset{compat=1.7}
\begin{document}
\pgfmathdeclarefunction{gauss}{2}{\pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
}


\begin{tikzpicture}
\begin{axis}[no markers, domain=0:10, samples=100,
axis lines*=left, xlabel=fghjfgj, ylabel=fdgjfjfj,
height=6cm, width=10cm,
xtick={-3, -2, -1, 0, 1, 2, 3}, ytick=\empty,
enlargelimits=false, clip=false, axis on top]
\addplot[color=orange,line width=1.5pt, fill=cyan!20, domain=-2:2] {gauss(0,1)} \closedcycle;
\addplot [color=orange,line width=1.5pt, fill=white, domain=-3:-2] {gauss(0,1)} \closedcycle;
\addplot [color=orange,line width=1.5pt,fill=white, domain=2:3] {gauss(0,1)} \closedcycle;
\end{axis}
\end{tikzpicture}
\end{document}

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.