TransWikia.com

Two column Paper , Graph go out side the column

TeX - LaTeX Asked by uma on February 3, 2021

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
setlengthtabcolsep{3pt} % default: 6pt
 begin{table}[h]
    caption{SSIM Values Change with Contrast}
    label{tab: c5T1}
    begin{tabularx}{0.47textwidth}{|X|X|X|X|X|}
        hline centeringarraybackslash{textbf{Method}}  & 
         centeringarraybackslash{textbf{0}}  &
          centeringarraybackslash{textbf{25}} & 
          centeringarraybackslash{textbf{50}} & 
          centeringarraybackslash{textbf{100}} 
        hline    centeringarraybackslash{Hard}  &   
        centeringarraybackslash{0.43576} &  
        centeringarraybackslash{0.51213} &  
        centeringarraybackslash{0.63486} &  
        centeringarraybackslash{0.85057}  
        hline  centeringarraybackslash{Soft} &  
        centeringarraybackslash{0.0000} & 
         centeringarraybackslash{0.16220} & 
          centeringarraybackslash{0.68675} & 
           centeringarraybackslash{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

One Answer

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}
  setlengthtabcolsep{3pt}
  begin{tabularx}{columnwidth}{|>{centeringarraybackslash}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}

Answered by leandriis on February 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP