Graphics, Figures & TablesHelp to correct my graph

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
dasag
Posts: 30
Joined: Wed Dec 10, 2014 3:43 pm

Help to correct my graph

Post by dasag »

edit legend, also all parametrs my graph under my picture, I want when generate my latex code will be same as picture.
Dear Stefan I know You can help
This post also my: http://tex.stackexchange.com/questions/ ... 414_220939

Code: Select all

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\usepackage{caption} % <----
    \captionsetup{font = small} % <----

\usepackage[active,floats,tightpage]{preview}% <---
    \setlength\PreviewBorder{1em}

    \begin{document}
%---------------------------------------------------------------%
\begin{figure} % <---
    \centering % <---
\begin{tikzpicture}
%%%% f1
    \begin{axis}[scale only axis,
        xlabel=Time,
        xmin=0, xmax=168,
        ylabel={log(Cfu/cm$^{2}$)},
        axis y line*=left,
        ymin=0, ymax=10,
        legend style={at={(0.48,-0.15)},  % <---
                      anchor=north east}] % <---
    \addplot [black, fill=white, mark=square*]
        table[row sep=crcr]{
            0 9\\
            4 9.1\\
            8 9.8\\
            12 9.8\\
            24 9.162\\
            48 9\\
            72 9.1\\
            168 9.8\\};
             \addplot [black, fill=white, mark=*]
        table[row sep=crcr]{
            0 9.2\\
            4 8.1\\
            8 8.8\\
            12 8.8\\
            24 9.62\\
            48 9.3\\
            72 9.1\\
            168 8.8\\};
            \addplot [black, fill=white, mark=diamond*]
        table[row sep=crcr]{
            0 8.7\\
            4 9.2\\
            8 8.9\\
            12 9.6\\
            24 9.2\\
            48 8\\
            72 8.1\\
            168 8.8\\};
            \addlegendentry{plot 3} % <---
            \addplot [black, fill=white, mark=triangle*]
        table[row sep=crcr]{
           0 7\\
           4 7.1\\
           8 7.8\\
           12 7.8\\
           24 7.162\\
           48 7.6\\
           72 7.1\\
           168 7.8\\};
    \label{plot_one}
    \addlegendentry{plot 4}
    \end{axis}
%%%% f2
    \begin{axis}[scale only axis,
        hide x axis,
        xmin=0, xmax=168,
        ylabel={Relative Expression},
        axis y line*=right,
        ymin=0, ymax=6,   
        legend style={at={(0.52,-0.15)}, % <---
                      anchor=north west}]% <---
]
%    \addlegendimage{/pgfplots/refstyle=plot_one}
    \addplot [black, mark=square*]
        table[row sep=crcr]{
            0 1.3\\
4 1.8\\
8 1.4\\
12 1.3\\
24 1.85\\
48 1.48\\
72 1.63\\
168 1.75\\};

             \addplot [black, mark=*]
        table[row sep=crcr]{
            0 1.6\\
4 3.8\\
8 2.4\\
12 1.3\\
24 2.85\\
48 1.48\\
72 2.63\\
168 3.75\\};

            \addplot [black, mark=diamond*]
        table[row sep=crcr]{
            0 0.3\\
4 0.8\\
8 0.4\\
12 0.3\\
24 0.85\\
48 0.48\\
72 0.63\\
168 0.75\\};
    \addlegendentry{plot 3} % <---
            \addplot [black, mark=triangle*]
        table[row sep=crcr]{
0 0.8\\
4 1.2\\
8 1.24\\
12 2.3\\
24 2.85\\
48 2.48\\
72 2.63\\
168 2.75\\};
    \label{plot_four}
    \addlegendentry{plot 4} % <---
    \end{axis}
\end{tikzpicture}

    \caption{Growth of different types foodborne pathogens.} % <---
    \end{figure} % <---
\end{document}
Attachments
wJp8c.jpg
wJp8c.jpg (102.09 KiB) Viewed 3159 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply