pgfplots - draw boxplot without outliers The 2019 Stack Overflow Developer Survey Results Are...

What information about me do stores get via my credit card?

Why did Peik Lin say, "I'm not an animal"?

"... to apply for a visa" or "... and applied for a visa"?

How can I define good in a religion that claims no moral authority?

How do spell lists change if the party levels up without taking a long rest?

Match Roman Numerals

how can a perfect fourth interval be considered either consonant or dissonant?

Can a novice safely splice in wire to lengthen 5V charging cable?

Homework question about an engine pulling a train

One-dimensional Japanese puzzle

What is the padding with red substance inside of steak packaging?

Did the new image of black hole confirm the general theory of relativity?

Can the DM override racial traits?

Why can't devices on different VLANs, but on the same subnet, communicate?

What force causes entropy to increase?

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

Why can't wing-mounted spoilers be used to steepen approaches?

Is this wall load bearing? Blueprints and photos attached

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

Accepted by European university, rejected by all American ones I applied to? Possible reasons?

Is every episode of "Where are my Pants?" identical?

Can we generate random numbers using irrational numbers like π and e?

How to type a long/em dash `—`

Sort list of array linked objects by keys and values



pgfplots - draw boxplot without outliers



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Do we need more moderators?plotting two time series with boundsGrouped bar chartHow do i get the x axis on top but keep a line on the bottomPGFPLOTS: Insert a boxplot outside the chart axis labels, much like GNU RLocation and size of pgf plot axis in a tikzpicture - with tikz positioning library?How to prevent rounded and duplicated tick labels in pgfplots with fixed precision?How to hide empty (value 0) ybars with pgfplots?Show mark labels near marks and not centered in ybar interaval graphpgfplots: percentage in matrix plotCenter the axes in the coordinate origin












6















I am creating a boxplot with pgfplots, using the builtin statistics library. I load the input data from a table file.



usepackage{pgfplots}
usepgfplotslibrary{statistics}
...
begin{tikzpicture}
begin{axis}[boxplot/draw direction=y]
addplot+[boxplot] table[
col sep=tab,
x expr=coordindex,
y=aColName] {aFileName};
end{axis}
end{tikzpicture}


Is it possible to draw the plot without outliers? Or hide them? I don't want to pre-calculate the boxplot values by hand.










share|improve this question





























    6















    I am creating a boxplot with pgfplots, using the builtin statistics library. I load the input data from a table file.



    usepackage{pgfplots}
    usepgfplotslibrary{statistics}
    ...
    begin{tikzpicture}
    begin{axis}[boxplot/draw direction=y]
    addplot+[boxplot] table[
    col sep=tab,
    x expr=coordindex,
    y=aColName] {aFileName};
    end{axis}
    end{tikzpicture}


    Is it possible to draw the plot without outliers? Or hide them? I don't want to pre-calculate the boxplot values by hand.










    share|improve this question



























      6












      6








      6


      2






      I am creating a boxplot with pgfplots, using the builtin statistics library. I load the input data from a table file.



      usepackage{pgfplots}
      usepgfplotslibrary{statistics}
      ...
      begin{tikzpicture}
      begin{axis}[boxplot/draw direction=y]
      addplot+[boxplot] table[
      col sep=tab,
      x expr=coordindex,
      y=aColName] {aFileName};
      end{axis}
      end{tikzpicture}


      Is it possible to draw the plot without outliers? Or hide them? I don't want to pre-calculate the boxplot values by hand.










      share|improve this question
















      I am creating a boxplot with pgfplots, using the builtin statistics library. I load the input data from a table file.



      usepackage{pgfplots}
      usepgfplotslibrary{statistics}
      ...
      begin{tikzpicture}
      begin{axis}[boxplot/draw direction=y]
      addplot+[boxplot] table[
      col sep=tab,
      x expr=coordindex,
      y=aColName] {aFileName};
      end{axis}
      end{tikzpicture}


      Is it possible to draw the plot without outliers? Or hide them? I don't want to pre-calculate the boxplot values by hand.







      pgfplots statistics boxplot






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 3 '13 at 10:23









      Claudio Fiandrino

      52.9k11156314




      52.9k11156314










      asked Jun 3 '13 at 10:14









      EntropiaEntropia

      334




      334






















          3 Answers
          3






          active

          oldest

          votes


















          6














          If you add the following code snippet to your preamble, you can use hide outliers to locally disable plotting the outliers:



          makeatletter
          pgfplotsset{
          boxplot/hide outliers/.code={
          defpgfplotsplothandlerboxplot@outlier{}%
          }
          }
          makeatother




          documentclass{article}
          usepackage{pgfplots}
          usepgfplotslibrary{statistics}
          begin{document}

          makeatletter
          pgfplotsset{
          boxplot/hide outliers/.code={
          defpgfplotsplothandlerboxplot@outlier{}%
          }
          }
          makeatother


          begin{tikzpicture}
          begin{axis}[y=1cm, try min ticks=2]
          addplot+[boxplot]
          table[row sep=\,y index=0] {
          data\
          1\ 2\ 1\ 5\ 4\ 10\
          7\ 10\ 9\ 8\ 9\ 9\
          21\
          };
          end{axis}
          end{tikzpicture}

          begin{tikzpicture}
          begin{axis}[y=1cm, try min ticks=2]
          addplot+[boxplot, hide outliers]
          table[row sep=\,y index=0] {
          data\
          1\ 2\ 1\ 5\ 4\ 10\
          7\ 10\ 9\ 8\ 9\ 9\
          21\
          };
          end{axis}
          end{tikzpicture}


          end{document}





          share|improve this answer


























          • I tried your sample both on my local Latex as well as on Overleaf and I always get Package pgfkeys Error: I do not know the key '/tikz/hide outliers' and I amd going to ignore it.

            – schneida
            Mar 31 at 13:01



















          1














          Just for completeness here is a solution using the combination of 'R-knitr-LaTeX'.



          documentclass[border=5mm]{standalone}
          begin{document}
          <<echo=FALSE>>=
          #par(pin=c(5,.1))
          #par(mar=c(.2,.2,.2,.2))
          par(bty="n")
          #par(mai=c(.35,.35,.35,.35),omi=c(0,0,0,0))
          par(mfrow=c(2,1))
          x=c(1,2,1,5,4,10,7,10,9,8,9,9,21)
          boxplot(x,horizontal=TRUE,outline=TRUE,plot=TRUE,axes=TRUE)
          axis(side=1, at=c(0,5,10,15,20))
          boxplot(x,horizontal=TRUE,outline=FALSE,plot=TRUE, col='lightblue',axes=TRUE)
          axis(side=1, at=c(0,2,4,6,8,10))
          @
          end{document}


          enter image description here






          share|improve this answer































            0














            I have simply done that by just adding mark=. to addplot+[boxplot]



            begin{tikzpicture}
            begin{axis}[boxplot/draw direction=y,]

            addplot+[boxplot]
            table[row sep=\,y index=0] {
            data\
            1\ 2\ 1\ 5\ 4\ 10\
            7\ 10\ 9\ 8\ 9\ 9\
            21\
            };

            % box plot without outliers
            addplot+[boxplot, mark=.]
            table[row sep=\,y index=0] {
            data\
            1\ 2\ 1\ 5\ 4\ 10\
            7\ 10\ 9\ 8\ 9\ 9\
            21\
            };
            end{axis}
            end{tikzpicture}


            enter image description here





            share
























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "85"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f117398%2fpgfplots-draw-boxplot-without-outliers%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              6














              If you add the following code snippet to your preamble, you can use hide outliers to locally disable plotting the outliers:



              makeatletter
              pgfplotsset{
              boxplot/hide outliers/.code={
              defpgfplotsplothandlerboxplot@outlier{}%
              }
              }
              makeatother




              documentclass{article}
              usepackage{pgfplots}
              usepgfplotslibrary{statistics}
              begin{document}

              makeatletter
              pgfplotsset{
              boxplot/hide outliers/.code={
              defpgfplotsplothandlerboxplot@outlier{}%
              }
              }
              makeatother


              begin{tikzpicture}
              begin{axis}[y=1cm, try min ticks=2]
              addplot+[boxplot]
              table[row sep=\,y index=0] {
              data\
              1\ 2\ 1\ 5\ 4\ 10\
              7\ 10\ 9\ 8\ 9\ 9\
              21\
              };
              end{axis}
              end{tikzpicture}

              begin{tikzpicture}
              begin{axis}[y=1cm, try min ticks=2]
              addplot+[boxplot, hide outliers]
              table[row sep=\,y index=0] {
              data\
              1\ 2\ 1\ 5\ 4\ 10\
              7\ 10\ 9\ 8\ 9\ 9\
              21\
              };
              end{axis}
              end{tikzpicture}


              end{document}





              share|improve this answer


























              • I tried your sample both on my local Latex as well as on Overleaf and I always get Package pgfkeys Error: I do not know the key '/tikz/hide outliers' and I amd going to ignore it.

                – schneida
                Mar 31 at 13:01
















              6














              If you add the following code snippet to your preamble, you can use hide outliers to locally disable plotting the outliers:



              makeatletter
              pgfplotsset{
              boxplot/hide outliers/.code={
              defpgfplotsplothandlerboxplot@outlier{}%
              }
              }
              makeatother




              documentclass{article}
              usepackage{pgfplots}
              usepgfplotslibrary{statistics}
              begin{document}

              makeatletter
              pgfplotsset{
              boxplot/hide outliers/.code={
              defpgfplotsplothandlerboxplot@outlier{}%
              }
              }
              makeatother


              begin{tikzpicture}
              begin{axis}[y=1cm, try min ticks=2]
              addplot+[boxplot]
              table[row sep=\,y index=0] {
              data\
              1\ 2\ 1\ 5\ 4\ 10\
              7\ 10\ 9\ 8\ 9\ 9\
              21\
              };
              end{axis}
              end{tikzpicture}

              begin{tikzpicture}
              begin{axis}[y=1cm, try min ticks=2]
              addplot+[boxplot, hide outliers]
              table[row sep=\,y index=0] {
              data\
              1\ 2\ 1\ 5\ 4\ 10\
              7\ 10\ 9\ 8\ 9\ 9\
              21\
              };
              end{axis}
              end{tikzpicture}


              end{document}





              share|improve this answer


























              • I tried your sample both on my local Latex as well as on Overleaf and I always get Package pgfkeys Error: I do not know the key '/tikz/hide outliers' and I amd going to ignore it.

                – schneida
                Mar 31 at 13:01














              6












              6








              6







              If you add the following code snippet to your preamble, you can use hide outliers to locally disable plotting the outliers:



              makeatletter
              pgfplotsset{
              boxplot/hide outliers/.code={
              defpgfplotsplothandlerboxplot@outlier{}%
              }
              }
              makeatother




              documentclass{article}
              usepackage{pgfplots}
              usepgfplotslibrary{statistics}
              begin{document}

              makeatletter
              pgfplotsset{
              boxplot/hide outliers/.code={
              defpgfplotsplothandlerboxplot@outlier{}%
              }
              }
              makeatother


              begin{tikzpicture}
              begin{axis}[y=1cm, try min ticks=2]
              addplot+[boxplot]
              table[row sep=\,y index=0] {
              data\
              1\ 2\ 1\ 5\ 4\ 10\
              7\ 10\ 9\ 8\ 9\ 9\
              21\
              };
              end{axis}
              end{tikzpicture}

              begin{tikzpicture}
              begin{axis}[y=1cm, try min ticks=2]
              addplot+[boxplot, hide outliers]
              table[row sep=\,y index=0] {
              data\
              1\ 2\ 1\ 5\ 4\ 10\
              7\ 10\ 9\ 8\ 9\ 9\
              21\
              };
              end{axis}
              end{tikzpicture}


              end{document}





              share|improve this answer















              If you add the following code snippet to your preamble, you can use hide outliers to locally disable plotting the outliers:



              makeatletter
              pgfplotsset{
              boxplot/hide outliers/.code={
              defpgfplotsplothandlerboxplot@outlier{}%
              }
              }
              makeatother




              documentclass{article}
              usepackage{pgfplots}
              usepgfplotslibrary{statistics}
              begin{document}

              makeatletter
              pgfplotsset{
              boxplot/hide outliers/.code={
              defpgfplotsplothandlerboxplot@outlier{}%
              }
              }
              makeatother


              begin{tikzpicture}
              begin{axis}[y=1cm, try min ticks=2]
              addplot+[boxplot]
              table[row sep=\,y index=0] {
              data\
              1\ 2\ 1\ 5\ 4\ 10\
              7\ 10\ 9\ 8\ 9\ 9\
              21\
              };
              end{axis}
              end{tikzpicture}

              begin{tikzpicture}
              begin{axis}[y=1cm, try min ticks=2]
              addplot+[boxplot, hide outliers]
              table[row sep=\,y index=0] {
              data\
              1\ 2\ 1\ 5\ 4\ 10\
              7\ 10\ 9\ 8\ 9\ 9\
              21\
              };
              end{axis}
              end{tikzpicture}


              end{document}






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jun 10 '17 at 13:06









              David Carlisle

              499k4111451895




              499k4111451895










              answered Jun 3 '13 at 11:45









              JakeJake

              196k24660765




              196k24660765













              • I tried your sample both on my local Latex as well as on Overleaf and I always get Package pgfkeys Error: I do not know the key '/tikz/hide outliers' and I amd going to ignore it.

                – schneida
                Mar 31 at 13:01



















              • I tried your sample both on my local Latex as well as on Overleaf and I always get Package pgfkeys Error: I do not know the key '/tikz/hide outliers' and I amd going to ignore it.

                – schneida
                Mar 31 at 13:01

















              I tried your sample both on my local Latex as well as on Overleaf and I always get Package pgfkeys Error: I do not know the key '/tikz/hide outliers' and I amd going to ignore it.

              – schneida
              Mar 31 at 13:01





              I tried your sample both on my local Latex as well as on Overleaf and I always get Package pgfkeys Error: I do not know the key '/tikz/hide outliers' and I amd going to ignore it.

              – schneida
              Mar 31 at 13:01











              1














              Just for completeness here is a solution using the combination of 'R-knitr-LaTeX'.



              documentclass[border=5mm]{standalone}
              begin{document}
              <<echo=FALSE>>=
              #par(pin=c(5,.1))
              #par(mar=c(.2,.2,.2,.2))
              par(bty="n")
              #par(mai=c(.35,.35,.35,.35),omi=c(0,0,0,0))
              par(mfrow=c(2,1))
              x=c(1,2,1,5,4,10,7,10,9,8,9,9,21)
              boxplot(x,horizontal=TRUE,outline=TRUE,plot=TRUE,axes=TRUE)
              axis(side=1, at=c(0,5,10,15,20))
              boxplot(x,horizontal=TRUE,outline=FALSE,plot=TRUE, col='lightblue',axes=TRUE)
              axis(side=1, at=c(0,2,4,6,8,10))
              @
              end{document}


              enter image description here






              share|improve this answer




























                1














                Just for completeness here is a solution using the combination of 'R-knitr-LaTeX'.



                documentclass[border=5mm]{standalone}
                begin{document}
                <<echo=FALSE>>=
                #par(pin=c(5,.1))
                #par(mar=c(.2,.2,.2,.2))
                par(bty="n")
                #par(mai=c(.35,.35,.35,.35),omi=c(0,0,0,0))
                par(mfrow=c(2,1))
                x=c(1,2,1,5,4,10,7,10,9,8,9,9,21)
                boxplot(x,horizontal=TRUE,outline=TRUE,plot=TRUE,axes=TRUE)
                axis(side=1, at=c(0,5,10,15,20))
                boxplot(x,horizontal=TRUE,outline=FALSE,plot=TRUE, col='lightblue',axes=TRUE)
                axis(side=1, at=c(0,2,4,6,8,10))
                @
                end{document}


                enter image description here






                share|improve this answer


























                  1












                  1








                  1







                  Just for completeness here is a solution using the combination of 'R-knitr-LaTeX'.



                  documentclass[border=5mm]{standalone}
                  begin{document}
                  <<echo=FALSE>>=
                  #par(pin=c(5,.1))
                  #par(mar=c(.2,.2,.2,.2))
                  par(bty="n")
                  #par(mai=c(.35,.35,.35,.35),omi=c(0,0,0,0))
                  par(mfrow=c(2,1))
                  x=c(1,2,1,5,4,10,7,10,9,8,9,9,21)
                  boxplot(x,horizontal=TRUE,outline=TRUE,plot=TRUE,axes=TRUE)
                  axis(side=1, at=c(0,5,10,15,20))
                  boxplot(x,horizontal=TRUE,outline=FALSE,plot=TRUE, col='lightblue',axes=TRUE)
                  axis(side=1, at=c(0,2,4,6,8,10))
                  @
                  end{document}


                  enter image description here






                  share|improve this answer













                  Just for completeness here is a solution using the combination of 'R-knitr-LaTeX'.



                  documentclass[border=5mm]{standalone}
                  begin{document}
                  <<echo=FALSE>>=
                  #par(pin=c(5,.1))
                  #par(mar=c(.2,.2,.2,.2))
                  par(bty="n")
                  #par(mai=c(.35,.35,.35,.35),omi=c(0,0,0,0))
                  par(mfrow=c(2,1))
                  x=c(1,2,1,5,4,10,7,10,9,8,9,9,21)
                  boxplot(x,horizontal=TRUE,outline=TRUE,plot=TRUE,axes=TRUE)
                  axis(side=1, at=c(0,5,10,15,20))
                  boxplot(x,horizontal=TRUE,outline=FALSE,plot=TRUE, col='lightblue',axes=TRUE)
                  axis(side=1, at=c(0,2,4,6,8,10))
                  @
                  end{document}


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 30 '15 at 2:11









                  R. SchumacherR. Schumacher

                  8,50122239




                  8,50122239























                      0














                      I have simply done that by just adding mark=. to addplot+[boxplot]



                      begin{tikzpicture}
                      begin{axis}[boxplot/draw direction=y,]

                      addplot+[boxplot]
                      table[row sep=\,y index=0] {
                      data\
                      1\ 2\ 1\ 5\ 4\ 10\
                      7\ 10\ 9\ 8\ 9\ 9\
                      21\
                      };

                      % box plot without outliers
                      addplot+[boxplot, mark=.]
                      table[row sep=\,y index=0] {
                      data\
                      1\ 2\ 1\ 5\ 4\ 10\
                      7\ 10\ 9\ 8\ 9\ 9\
                      21\
                      };
                      end{axis}
                      end{tikzpicture}


                      enter image description here





                      share




























                        0














                        I have simply done that by just adding mark=. to addplot+[boxplot]



                        begin{tikzpicture}
                        begin{axis}[boxplot/draw direction=y,]

                        addplot+[boxplot]
                        table[row sep=\,y index=0] {
                        data\
                        1\ 2\ 1\ 5\ 4\ 10\
                        7\ 10\ 9\ 8\ 9\ 9\
                        21\
                        };

                        % box plot without outliers
                        addplot+[boxplot, mark=.]
                        table[row sep=\,y index=0] {
                        data\
                        1\ 2\ 1\ 5\ 4\ 10\
                        7\ 10\ 9\ 8\ 9\ 9\
                        21\
                        };
                        end{axis}
                        end{tikzpicture}


                        enter image description here





                        share


























                          0












                          0








                          0







                          I have simply done that by just adding mark=. to addplot+[boxplot]



                          begin{tikzpicture}
                          begin{axis}[boxplot/draw direction=y,]

                          addplot+[boxplot]
                          table[row sep=\,y index=0] {
                          data\
                          1\ 2\ 1\ 5\ 4\ 10\
                          7\ 10\ 9\ 8\ 9\ 9\
                          21\
                          };

                          % box plot without outliers
                          addplot+[boxplot, mark=.]
                          table[row sep=\,y index=0] {
                          data\
                          1\ 2\ 1\ 5\ 4\ 10\
                          7\ 10\ 9\ 8\ 9\ 9\
                          21\
                          };
                          end{axis}
                          end{tikzpicture}


                          enter image description here





                          share













                          I have simply done that by just adding mark=. to addplot+[boxplot]



                          begin{tikzpicture}
                          begin{axis}[boxplot/draw direction=y,]

                          addplot+[boxplot]
                          table[row sep=\,y index=0] {
                          data\
                          1\ 2\ 1\ 5\ 4\ 10\
                          7\ 10\ 9\ 8\ 9\ 9\
                          21\
                          };

                          % box plot without outliers
                          addplot+[boxplot, mark=.]
                          table[row sep=\,y index=0] {
                          data\
                          1\ 2\ 1\ 5\ 4\ 10\
                          7\ 10\ 9\ 8\ 9\ 9\
                          21\
                          };
                          end{axis}
                          end{tikzpicture}


                          enter image description here






                          share











                          share


                          share










                          answered 5 mins ago









                          sisamansisaman

                          81




                          81






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f117398%2fpgfplots-draw-boxplot-without-outliers%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              IEEEtran - How to include ORCID in TeX/PDF with PdfLatexIs there a standard way to include ORCID in TeX /...

                              Cicindela nigrior Przypisy | Menu nawigacyjneCicindela varians unicolorManual for the Identification of the...

                              Forked arrows with chemfig Unicorn Meta Zoo #1: Why another podcast? ...