4

I have the following box plots:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usepgfplotslibrary{statistics}
\begin{document}
\begin{tikzpicture}
  \begin{axis}
    [title = {Deletion of Focal and Arm-level SCNAs},ylabel = {$log_{2}(I_{C}/I_{N})$},
    boxplot/draw direction=y,
    xtick={1,2},
    xticklabels={Focal, Arm}
    ]
    \addplot+[mark options = {blue},
    boxplot prepared={
      lower whisker=-0.9197604,
      lower quartile=-0.4621040,
      median=-0.2362183,
      upper quartile=-0.1566109,
      upper whisker=-0.1003486
    }, color = blue 
    ] coordinates {};
     \addplot+[mark = *,mark options = {blue},
    boxplot prepared={
     lower whisker=-0.2970707,
     lower quartile=-0.2019435,
     median=-0.1603655,
     upper quartile=-0.1199740,
     upper whisker=-0.1012605
    }, color = blue
    ] coordinates {(0,-0.3299711)(0,-0.3299711)(0,-0.3642782)(0,-0.3930741)(0,-0.4372732)(0,-0.6161027)};
     \draw[black, dashed]
      (axis cs:0, -0.1) coordinate (tmp)
      (current axis.west |- tmp) -- (current axis.east |- tmp);
    \end{axis}
\end{tikzpicture}
\hspace{0.15cm}
\end{document}

that gives:

enter image description here

I would like to modify the yaxis, so it can include zero in the label. Is there a simple trick? Thank you!

1
  • 1
    You can edit also the title as well as the body of the question; I did it for you.
    – egreg
    Commented May 13, 2015 at 22:07

1 Answer 1

2

Simple check with the pgfplots documentation http://texdoc.net/texmf-dist/doc/latex/pgfplots/pgfplots.pdf page 223, yields the following oneline edit:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usepgfplotslibrary{statistics}
\begin{document}
\begin{tikzpicture}
  \begin{axis}
    [title = {Deletion of Focal and Arm-level SCNAs},ylabel = {$log_{2}(I_{C}/I_{N})$},
    boxplot/draw direction=y,
    xtick={1,2},
    xticklabels={Focal, Arm},
    ymin=-1, ymax=0  %%%%%%%%%%%%%%%%%%%%%%%%%%% One Line edit
    ]
    \addplot+[mark options = {blue},
    boxplot prepared={
      lower whisker=-0.9197604,
      lower quartile=-0.4621040,
      median=-0.2362183,
      upper quartile=-0.1566109,
      upper whisker=-0.1003486
    }, color = blue 
    ] coordinates {};
     \addplot+[mark = *,mark options = {blue},
    boxplot prepared={
     lower whisker=-0.2970707,
     lower quartile=-0.2019435,
     median=-0.1603655,
     upper quartile=-0.1199740,
     upper whisker=-0.1012605
    }, color = blue
    ] coordinates {(0,-0.3299711)(0,-0.3299711)(0,-0.3642782)(0,-0.3930741)(0,-0.4372732)(0,-0.6161027)};
     \draw[black, dashed]
      (axis cs:0, -0.1) coordinate (tmp)
      (current axis.west |- tmp) -- (current axis.east |- tmp);
    \end{axis}
\end{tikzpicture}
\hspace{0.15cm}
\end{document}

enter image description here

1
  • Thank you very much for your time! I have decided to write my thesis with latex (first time), so I am learning. :)
    – Johnathan
    Commented May 13, 2015 at 22:30

You must log in to answer this question.

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