1

The picture is like this: enter image description here

I hope to generate it by tikz. Thank you!

New Problem:

I'm trying to generate a more complex figure. But it has some bugs. I don't know why. The code is as follows:

\usepackage[pdftex]{graphicx}
\usepackage{amsmath,environ}
\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{caption}
\usepackage{pgfplots}

\begin{document}

\begin{figure*}[!tp]
\begin{minipage}{.49\textwidth}
\begin{tikzpicture}[scale=0.5]
\begin{axis}[
    xlabel style={align=center},
    xlabel=$Expiration\ Time\ (s)$ \\(a),
    ylabel style={align=center},
    ylabel=$Reduced\ RTT\ Ratio\ (\%)$,
    xmin=10, xmax=60,
    ymin=75, ymax=95,
    legend style={nodes=right},
    legend pos= south east]
\addplot table {Fig4delay10000.txt};
\addlegendentry{10000}
\end{axis}
\draw(0.1,0.1) node{ 
\begin{axis}[scale=0.2][
    xlabel style={align=center},
    xlabel=$Expiration\ Time\ (s)$ \\(b),
    xlabel style={align=center},
    ylabel=$Cache\ Hit\ Rate\ (\%)$,
    xmin=10, xmax=60,
    ymin=80, ymax=100,
    legend style={nodes=right},
    legend pos= south east]
\addplot table {Fig4hit10000.txt};
\addlegendentry{10000}
\end{axis}};
\end{tikzpicture}
\caption{Effects of expiration time of cache entry in delegates \newline}
\label{figure 4}
\end{minipage}
\end{figure*}

\end{document}

Fig4delay10000.txt:
    10  83.70616734
    20  87.78888284
    30  89.30183444
    40  90.08903274
    50  90.58099978
    60  90.92872104
Fig4hit10000.txt:
    10  90.98347396
    20  95.0861077
    30  96.60898943
    40  97.3979899
    50  97.89094057   
    60  98.23992643
2
  • 1
    pgfplots would be preferable in this case.
    – Alenanno
    Commented Aug 6, 2016 at 9:40
  • 2
    Welcome to TeX - LaTeX! pdfplots as mentioned by Alenanno is built on top of tikz and indeed is a good starting point. Have a look at the package and try yourself. When you get stuck you can then ask a question here about the specific problem you have. Commented Aug 6, 2016 at 9:54

1 Answer 1

2

One way:

\documentclass{article}

\usepackage{pgfplots}



\begin{document}
    \begin{tikzpicture}
    \begin{axis}[xlabel=$x$,ylabel=$y$]
    \addplot[red,domain=-90:270,smooth] {cos(x)};
    \end{axis}
    \draw(2.0,1.7) node{ \begin{axis}[scale=15.0] \addplot[green,domain=-1:1,smooth]{x^2}; \end{axis}};
    \end{tikzpicture}
\end{document}

enter image description here

4
  • When I try to finish more complex figure, I have problems. Can you help me? I don't know how to publish the new problem. So I add it into the old question.
    – Sean
    Commented Aug 8, 2016 at 6:44
  • I'd help but your code is incomplete in that I can't compile it as is plus I don't have the data files.
    – JPi
    Commented Aug 8, 2016 at 11:37
  • I attached the .txt file this time. Thank you!
    – Sean
    Commented Aug 9, 2016 at 16:20
  • Hi, I attached the file, can you help me?
    – Sean
    Commented Aug 20, 2016 at 6:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .