0

I need to draw a graph for my table values. I use xl sheet input data. My article is two column. But Graph go out side the column.I need some expert help to take graph in blue color range.

enter image description here

This is my code.

    .The SSIM results see in below ~\textit{\autoref{tab: c5T1} \nameref{tab: c5T1}}.

%Table
\setlength\tabcolsep{3pt} % default: 6pt
 \begin{table}[h]
    \caption{SSIM Values Change with Contrast}
    \label{tab: c5T1}
    \begin{tabularx}{0.47\textwidth}{|X|X|X|X|X|}
        \hline \centering\arraybackslash{\textbf{Method}}  & 
         \centering\arraybackslash{\textbf{0}}  &
          \centering\arraybackslash{\textbf{25}} & 
          \centering\arraybackslash{\textbf{50}} & 
          \centering\arraybackslash{\textbf{100}} \\
        \hline    \centering\arraybackslash{Hard}  &   
        \centering\arraybackslash{0.43576} &  
        \centering\arraybackslash{0.51213} &  
        \centering\arraybackslash{0.63486} &  
        \centering\arraybackslash{0.85057}  \\
        \hline  \centering\arraybackslash{Soft} &  
        \centering\arraybackslash{0.0000} & 
         \centering\arraybackslash{0.16220} & 
          \centering\arraybackslash{0.68675} & 
           \centering\arraybackslash{0.69883}  \\
        \hline
    \end{tabularx}
\end{table}


%%%%%%%%%%%%%%%%%%Graphe 2 -change with contrastt

\begin{tikzpicture}
    \begin{axis}[
    width=\textwidth,
    height=6cm,
    xlabel={Contrast},
    ylabel={SSIM},   
    ymajorgrids,
    xmajorgrids,
    ymin=0,
    xmin=0,
    title = {SSIM value change with Contrast},
    x tick label style={/pgf/number format/1000 sep=},
    legend pos=south east
    ]
        \addplot table[x=Contrast,y=Hard] {data.csv};\addlegendentry{Hard}
        \addplot table[x=Contrast,y=Soft] {data.csv};\addlegendentry{Soft}
    \end{axis}
\end{tikzpicture}

\newpage
4
  • 1
    Please make your code compilable. – leandriis Jul 29 '20 at 17:07
  • 1
    You may use width=\columnwidth instead of width=\textwidth, – LaTeXdraw-com Jul 29 '20 at 17:23
  • @LaTeXdraw-com \columnwidth bring it to inside column , but not it more shifted right side. (it is not align with paragraphe above) – uma Jul 30 '20 at 2:12
  • \noindent -fix that issue – uma Jul 30 '20 at 2:19
1

In the following example, I have used width=\columnwidth to make sure the graph is as wide as one column in a twocolumn document. Additionally, I have use siunitx in order to avoid repetitive code in the table:

\documentclass[twocolumn]{article}
\usepackage{tabularx}
\usepackage{tikz, pgfplots}
\usepackage{showframe}
\usepackage{lipsum}

\usepackage{siunitx}
\begin{document}

    .The SSIM results see in below 

\begin{table}[h]
  \caption{SSIM Values Change with Contrast}
  \label{tab: c5T1}
  \sisetup{table-format=1.5}
  \setlength\tabcolsep{3pt}
  \begin{tabularx}{\columnwidth}{|>{\centering\arraybackslash}X|S|S|S|S|}
    \hline 
    \textbf{Method} & {\textbf{0}} & {\textbf{25}} & {\textbf{50}} & {\textbf{100}} \\
    \hline   
    Hard            &  0.43576     & 0.51213       & 0.63486       & 0.85057        \\
    \hline  
    Soft            &  0.0000      & 0.16220       & 0.68675       & 0.69883        \\
    \hline
    \end{tabularx}
\end{table}


%%%%%%%%%%%%%%%%%%Graphe 2 -change with contrastt
\noindent
\begin{tikzpicture}
    \begin{axis}[
    width=\columnwidth,
    height=6cm,
    xlabel={Contrast},
    ylabel={SSIM},   
    ymajorgrids,
    xmajorgrids,
    ymin=0,
    xmin=0,
    title = {SSIM value change with Contrast},
    x tick label style={/pgf/number format/1000 sep=},
    legend pos=south east
    ]
        \addplot table[x=Contrast,y=Hard] {data.csv};\addlegendentry{Hard}
        \addplot table[x=Contrast,y=Soft] {data.csv};\addlegendentry{Soft}
    \end{axis}
\end{tikzpicture}

\lipsum

\end{document}
2
  • is ti need to put \lipsum , when put that , my total article below that point change – uma Jul 30 '20 at 2:20
  • 1
    The command just produces dummy text. Remove it and the lipsum package from your actual document. – leandriis Jul 30 '20 at 5:01

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.