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:



    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};
\draw(0.1,0.1) node{ 
    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};
\caption{Effects of expiration time of cache entry in delegates \newline}
\label{figure 4}


    10  83.70616734
    20  87.78888284
    30  89.30183444
    40  90.08903274
    50  90.58099978
    60  90.92872104
    10  90.98347396
    20  95.0861077
    30  96.60898943
    40  97.3979899
    50  97.89094057   
    60  98.23992643
  • 1
    pgfplots would be preferable in this case. – Alenanno Aug 6 '16 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. – Andrew Swann Aug 6 '16 at 9:54

One way:



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

enter image description here

| improve this answer | |
  • 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 Aug 8 '16 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 Aug 8 '16 at 11:37
  • I attached the .txt file this time. Thank you! – Sean Aug 9 '16 at 16:20
  • Hi, I attached the file, can you help me? – Sean Aug 20 '16 at 6:15

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.