How to create 2 variables in 2 rows under x-axis in barplot in r (not using ggplot)Rotating x axis labels in R for barplotConstant width in ggplot barplotsBarplot using ggplotHow can I change the Y-axis figures into percentages in a barplot?Remove all of x axis labels in ggplotggplot barplot - percentage on y axisR line graphs, values outside plot areaprevent ggplot barplot moving along x axisSimple Grouped Barplot (ggplot)Making a grouped bar chart using a matrix in R

Can this word order be rearranged?

How to make interviewee comfortable interviewing in lounge chairs

Does the Orange League not count as an official Pokemon League, making the Alolan League his first-ever win?

An Algorithm Which Schedules Your Life

Cut a cake into 3 equal portions with only a knife

If the EU does not offer an extension to UK's Article 50 invocation, is the Benn Bill irrelevant?

Social leper versus social leopard

Idiom for "I came, I saw, I ate" (or drank)

Was there a trial by combat between a man and a dog in medieval France?

Has my MacBook been hacked?

Way of the bicycle

Performance for simple code that converts a RGB tuple to hex string

The 100 soldier problem

Examples of "unsuccessful" theories with afterlives

How to ask a man to not take up more than one seat on public transport while avoiding conflict?

A high quality contribution but an annoying error is present in my published article

Where are they calling from?

1, 2, 4, 8, 16, ... 33?

Do the villains know Batman has no superpowers?

How to deal with my team leader who keeps calling me about project updates even though I am on leave for personal reasons?

I reverse the source code, you negate the input!

Is this a Sherman, and if so what model?

Wrong result by FindRoot

Why is the missed-approach course for the "RNAV (GNSS) - A" approach to runway 28 at ENSB shaped all funny?



How to create 2 variables in 2 rows under x-axis in barplot in r (not using ggplot)


Rotating x axis labels in R for barplotConstant width in ggplot barplotsBarplot using ggplotHow can I change the Y-axis figures into percentages in a barplot?Remove all of x axis labels in ggplotggplot barplot - percentage on y axisR line graphs, values outside plot areaprevent ggplot barplot moving along x axisSimple Grouped Barplot (ggplot)Making a grouped bar chart using a matrix in R






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm trying to create a clearer x-axis in bar-plot but don't know how to do. Could anyone please help?



With my current code, I'm able to draw a barplot with 2 variables in x-axis. But the value of 2 variables is standing next to each other make it unclear from reader. I want to have each row for each variable in x-axis. This is my current code and the result



My expected result will be: in the x-axis, first row is 0.1, 0.0555, etc and second row is S1-2, S2-3



mxCarabooda <- structure(c(13.47258, 7.430879, 13.47151, 7.53012, 14.83685, 
8.940968, 15.37691, 9.617533), .Dim = c(2L, 4L), .Dimnames = list(
c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.1", "S2-3 0.055",
"S3-4 0.056", "S4-5 0.056")))
mxNeerabup <- structure(c(3.499426, 2.232676, 3.499596, 2.239664, 3.836086,
2.566649, 3.995115, 2.725839), .Dim = c(2L, 4L), .Dimnames = list(
c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.01", "S2-3 0.01",
"S3-4 0.01", "S4-5 0.02")))

mxNowergup <- structure(c(3.5135, 1.700544, 3.513586, 1.710387, 3.850266, 2.034689,
4.009113, 2.194351), .Dim = c(2L, 4L), .Dimnames = list(
c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.02", "S2-3 0.01",
"S3-4 0.02", "S4-5 0.02")))



tiff("barplot.tiff", width=260, height=100, units='mm', res=300)
par(mfrow=c(1,3), mar=c(5, 4, 4, 0.2))
colours <- c("gray63","gray87")

barplot(mxCarabooda, main='Carabooda', ylab='Profit loss ($m)',
xlab='Change in water table at each level of GW cut', beside=TRUE,
col=colours, ylim=c(0,30))
legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
col=c("gray63","gray87"))

barplot(mxNeerabup,main='Neerabup', ylab='',
xlab='Change in water table at each level of GW cut', beside=TRUE,
col=colours, ylim=c(0,30))
legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
col=c("gray63","gray87"), pch=15)

barplot(mxNowergup,main='Nowergup', ylab='',
xlab='Change in water table at each level of GW cut',beside=TRUE,
col=colours, ylim=c(0,30))
legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
col=c("gray63","gray87"), pch=15)

dev.off()


enter image description here










share|improve this question
































    0















    I'm trying to create a clearer x-axis in bar-plot but don't know how to do. Could anyone please help?



    With my current code, I'm able to draw a barplot with 2 variables in x-axis. But the value of 2 variables is standing next to each other make it unclear from reader. I want to have each row for each variable in x-axis. This is my current code and the result



    My expected result will be: in the x-axis, first row is 0.1, 0.0555, etc and second row is S1-2, S2-3



    mxCarabooda <- structure(c(13.47258, 7.430879, 13.47151, 7.53012, 14.83685, 
    8.940968, 15.37691, 9.617533), .Dim = c(2L, 4L), .Dimnames = list(
    c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.1", "S2-3 0.055",
    "S3-4 0.056", "S4-5 0.056")))
    mxNeerabup <- structure(c(3.499426, 2.232676, 3.499596, 2.239664, 3.836086,
    2.566649, 3.995115, 2.725839), .Dim = c(2L, 4L), .Dimnames = list(
    c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.01", "S2-3 0.01",
    "S3-4 0.01", "S4-5 0.02")))

    mxNowergup <- structure(c(3.5135, 1.700544, 3.513586, 1.710387, 3.850266, 2.034689,
    4.009113, 2.194351), .Dim = c(2L, 4L), .Dimnames = list(
    c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.02", "S2-3 0.01",
    "S3-4 0.02", "S4-5 0.02")))



    tiff("barplot.tiff", width=260, height=100, units='mm', res=300)
    par(mfrow=c(1,3), mar=c(5, 4, 4, 0.2))
    colours <- c("gray63","gray87")

    barplot(mxCarabooda, main='Carabooda', ylab='Profit loss ($m)',
    xlab='Change in water table at each level of GW cut', beside=TRUE,
    col=colours, ylim=c(0,30))
    legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
    col=c("gray63","gray87"))

    barplot(mxNeerabup,main='Neerabup', ylab='',
    xlab='Change in water table at each level of GW cut', beside=TRUE,
    col=colours, ylim=c(0,30))
    legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
    col=c("gray63","gray87"), pch=15)

    barplot(mxNowergup,main='Nowergup', ylab='',
    xlab='Change in water table at each level of GW cut',beside=TRUE,
    col=colours, ylim=c(0,30))
    legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
    col=c("gray63","gray87"), pch=15)

    dev.off()


    enter image description here










    share|improve this question




























      0












      0








      0








      I'm trying to create a clearer x-axis in bar-plot but don't know how to do. Could anyone please help?



      With my current code, I'm able to draw a barplot with 2 variables in x-axis. But the value of 2 variables is standing next to each other make it unclear from reader. I want to have each row for each variable in x-axis. This is my current code and the result



      My expected result will be: in the x-axis, first row is 0.1, 0.0555, etc and second row is S1-2, S2-3



      mxCarabooda <- structure(c(13.47258, 7.430879, 13.47151, 7.53012, 14.83685, 
      8.940968, 15.37691, 9.617533), .Dim = c(2L, 4L), .Dimnames = list(
      c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.1", "S2-3 0.055",
      "S3-4 0.056", "S4-5 0.056")))
      mxNeerabup <- structure(c(3.499426, 2.232676, 3.499596, 2.239664, 3.836086,
      2.566649, 3.995115, 2.725839), .Dim = c(2L, 4L), .Dimnames = list(
      c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.01", "S2-3 0.01",
      "S3-4 0.01", "S4-5 0.02")))

      mxNowergup <- structure(c(3.5135, 1.700544, 3.513586, 1.710387, 3.850266, 2.034689,
      4.009113, 2.194351), .Dim = c(2L, 4L), .Dimnames = list(
      c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.02", "S2-3 0.01",
      "S3-4 0.02", "S4-5 0.02")))



      tiff("barplot.tiff", width=260, height=100, units='mm', res=300)
      par(mfrow=c(1,3), mar=c(5, 4, 4, 0.2))
      colours <- c("gray63","gray87")

      barplot(mxCarabooda, main='Carabooda', ylab='Profit loss ($m)',
      xlab='Change in water table at each level of GW cut', beside=TRUE,
      col=colours, ylim=c(0,30))
      legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
      col=c("gray63","gray87"))

      barplot(mxNeerabup,main='Neerabup', ylab='',
      xlab='Change in water table at each level of GW cut', beside=TRUE,
      col=colours, ylim=c(0,30))
      legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
      col=c("gray63","gray87"), pch=15)

      barplot(mxNowergup,main='Nowergup', ylab='',
      xlab='Change in water table at each level of GW cut',beside=TRUE,
      col=colours, ylim=c(0,30))
      legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
      col=c("gray63","gray87"), pch=15)

      dev.off()


      enter image description here










      share|improve this question
















      I'm trying to create a clearer x-axis in bar-plot but don't know how to do. Could anyone please help?



      With my current code, I'm able to draw a barplot with 2 variables in x-axis. But the value of 2 variables is standing next to each other make it unclear from reader. I want to have each row for each variable in x-axis. This is my current code and the result



      My expected result will be: in the x-axis, first row is 0.1, 0.0555, etc and second row is S1-2, S2-3



      mxCarabooda <- structure(c(13.47258, 7.430879, 13.47151, 7.53012, 14.83685, 
      8.940968, 15.37691, 9.617533), .Dim = c(2L, 4L), .Dimnames = list(
      c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.1", "S2-3 0.055",
      "S3-4 0.056", "S4-5 0.056")))
      mxNeerabup <- structure(c(3.499426, 2.232676, 3.499596, 2.239664, 3.836086,
      2.566649, 3.995115, 2.725839), .Dim = c(2L, 4L), .Dimnames = list(
      c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.01", "S2-3 0.01",
      "S3-4 0.01", "S4-5 0.02")))

      mxNowergup <- structure(c(3.5135, 1.700544, 3.513586, 1.710387, 3.850266, 2.034689,
      4.009113, 2.194351), .Dim = c(2L, 4L), .Dimnames = list(
      c("ChangeNP", "ChangeNP.1"), c("Sl-2 0.02", "S2-3 0.01",
      "S3-4 0.02", "S4-5 0.02")))



      tiff("barplot.tiff", width=260, height=100, units='mm', res=300)
      par(mfrow=c(1,3), mar=c(5, 4, 4, 0.2))
      colours <- c("gray63","gray87")

      barplot(mxCarabooda, main='Carabooda', ylab='Profit loss ($m)',
      xlab='Change in water table at each level of GW cut', beside=TRUE,
      col=colours, ylim=c(0,30))
      legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
      col=c("gray63","gray87"))

      barplot(mxNeerabup,main='Neerabup', ylab='',
      xlab='Change in water table at each level of GW cut', beside=TRUE,
      col=colours, ylim=c(0,30))
      legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
      col=c("gray63","gray87"), pch=15)

      barplot(mxNowergup,main='Nowergup', ylab='',
      xlab='Change in water table at each level of GW cut',beside=TRUE,
      col=colours, ylim=c(0,30))
      legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
      col=c("gray63","gray87"), pch=15)

      dev.off()


      enter image description here







      r bar-chart






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 16:26









      Parfait

      62.1k10 gold badges57 silver badges77 bronze badges




      62.1k10 gold badges57 silver badges77 bronze badges










      asked Mar 28 at 15:51









      LaraLara

      436 bronze badges




      436 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0
















          Consider adjusting the names.arg of barplot which defaults to names attribute of your matrix. Specifically, create new vectors of names that reverse the space-separated original colnames and replaces space with line breaks:



          Bar Labels



          barsCarabooda <- gsub(" ", "n", 
          lapply(strsplit(colnames(mxCarabooda), split=" "),
          function(x) paste(rev(x), collapse=" "))
          )

          barsNeerabup <- gsub(" ", "n",
          lapply(strsplit(colnames(mxNeerabup), split=" "),
          function(x) paste(rev(x), collapse=" "))
          )

          barsNowergup <- gsub(" ", "n",
          lapply(strsplit(colnames(mxNowergup), split=" "),
          function(x) paste(rev(x), collapse=" "))
          )


          Plotting with names.arg



          par(mfrow=c(1,3), mar=c(5, 4, 4, 0.2))
          colours <- c("gray63","gray87")

          barplot(mxCarabooda, main='Carabooda', ylab='Profit loss ($m)',
          xlab='Change in water table at each level of GW cut', beside=TRUE,
          col=colours, ylim=c(0,30), names.arg=barsCarabooda)
          legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
          col=c("gray63","gray87"), pch=15)

          barplot(mxNeerabup,main='Neerabup', ylab='',
          xlab='Change in water table at each level of GW cut', beside=TRUE,
          col=colours, ylim=c(0,30), names.arg=barsNeerabup)
          legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
          col=c("gray63","gray87"), pch=15)

          barplot(mxNowergup,main='Nowergup', ylab='',
          xlab='Change in water table at each level of GW cut',beside=TRUE,
          col=colours, ylim=c(0,30), names.arg=barsNowergup)
          legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
          col=c("gray63","gray87"), pch=15)


          Bar Plot with Line Break X-Axis Labels






          share|improve this answer



























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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/4.0/"u003ecc by-sa 4.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%2fstackoverflow.com%2fquestions%2f55401877%2fhow-to-create-2-variables-in-2-rows-under-x-axis-in-barplot-in-r-not-using-ggpl%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0
















            Consider adjusting the names.arg of barplot which defaults to names attribute of your matrix. Specifically, create new vectors of names that reverse the space-separated original colnames and replaces space with line breaks:



            Bar Labels



            barsCarabooda <- gsub(" ", "n", 
            lapply(strsplit(colnames(mxCarabooda), split=" "),
            function(x) paste(rev(x), collapse=" "))
            )

            barsNeerabup <- gsub(" ", "n",
            lapply(strsplit(colnames(mxNeerabup), split=" "),
            function(x) paste(rev(x), collapse=" "))
            )

            barsNowergup <- gsub(" ", "n",
            lapply(strsplit(colnames(mxNowergup), split=" "),
            function(x) paste(rev(x), collapse=" "))
            )


            Plotting with names.arg



            par(mfrow=c(1,3), mar=c(5, 4, 4, 0.2))
            colours <- c("gray63","gray87")

            barplot(mxCarabooda, main='Carabooda', ylab='Profit loss ($m)',
            xlab='Change in water table at each level of GW cut', beside=TRUE,
            col=colours, ylim=c(0,30), names.arg=barsCarabooda)
            legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
            col=c("gray63","gray87"), pch=15)

            barplot(mxNeerabup,main='Neerabup', ylab='',
            xlab='Change in water table at each level of GW cut', beside=TRUE,
            col=colours, ylim=c(0,30), names.arg=barsNeerabup)
            legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
            col=c("gray63","gray87"), pch=15)

            barplot(mxNowergup,main='Nowergup', ylab='',
            xlab='Change in water table at each level of GW cut',beside=TRUE,
            col=colours, ylim=c(0,30), names.arg=barsNowergup)
            legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
            col=c("gray63","gray87"), pch=15)


            Bar Plot with Line Break X-Axis Labels






            share|improve this answer





























              0
















              Consider adjusting the names.arg of barplot which defaults to names attribute of your matrix. Specifically, create new vectors of names that reverse the space-separated original colnames and replaces space with line breaks:



              Bar Labels



              barsCarabooda <- gsub(" ", "n", 
              lapply(strsplit(colnames(mxCarabooda), split=" "),
              function(x) paste(rev(x), collapse=" "))
              )

              barsNeerabup <- gsub(" ", "n",
              lapply(strsplit(colnames(mxNeerabup), split=" "),
              function(x) paste(rev(x), collapse=" "))
              )

              barsNowergup <- gsub(" ", "n",
              lapply(strsplit(colnames(mxNowergup), split=" "),
              function(x) paste(rev(x), collapse=" "))
              )


              Plotting with names.arg



              par(mfrow=c(1,3), mar=c(5, 4, 4, 0.2))
              colours <- c("gray63","gray87")

              barplot(mxCarabooda, main='Carabooda', ylab='Profit loss ($m)',
              xlab='Change in water table at each level of GW cut', beside=TRUE,
              col=colours, ylim=c(0,30), names.arg=barsCarabooda)
              legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
              col=c("gray63","gray87"), pch=15)

              barplot(mxNeerabup,main='Neerabup', ylab='',
              xlab='Change in water table at each level of GW cut', beside=TRUE,
              col=colours, ylim=c(0,30), names.arg=barsNeerabup)
              legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
              col=c("gray63","gray87"), pch=15)

              barplot(mxNowergup,main='Nowergup', ylab='',
              xlab='Change in water table at each level of GW cut',beside=TRUE,
              col=colours, ylim=c(0,30), names.arg=barsNowergup)
              legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
              col=c("gray63","gray87"), pch=15)


              Bar Plot with Line Break X-Axis Labels






              share|improve this answer



























                0














                0










                0









                Consider adjusting the names.arg of barplot which defaults to names attribute of your matrix. Specifically, create new vectors of names that reverse the space-separated original colnames and replaces space with line breaks:



                Bar Labels



                barsCarabooda <- gsub(" ", "n", 
                lapply(strsplit(colnames(mxCarabooda), split=" "),
                function(x) paste(rev(x), collapse=" "))
                )

                barsNeerabup <- gsub(" ", "n",
                lapply(strsplit(colnames(mxNeerabup), split=" "),
                function(x) paste(rev(x), collapse=" "))
                )

                barsNowergup <- gsub(" ", "n",
                lapply(strsplit(colnames(mxNowergup), split=" "),
                function(x) paste(rev(x), collapse=" "))
                )


                Plotting with names.arg



                par(mfrow=c(1,3), mar=c(5, 4, 4, 0.2))
                colours <- c("gray63","gray87")

                barplot(mxCarabooda, main='Carabooda', ylab='Profit loss ($m)',
                xlab='Change in water table at each level of GW cut', beside=TRUE,
                col=colours, ylim=c(0,30), names.arg=barsCarabooda)
                legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
                col=c("gray63","gray87"), pch=15)

                barplot(mxNeerabup,main='Neerabup', ylab='',
                xlab='Change in water table at each level of GW cut', beside=TRUE,
                col=colours, ylim=c(0,30), names.arg=barsNeerabup)
                legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
                col=c("gray63","gray87"), pch=15)

                barplot(mxNowergup,main='Nowergup', ylab='',
                xlab='Change in water table at each level of GW cut',beside=TRUE,
                col=colours, ylim=c(0,30), names.arg=barsNowergup)
                legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
                col=c("gray63","gray87"), pch=15)


                Bar Plot with Line Break X-Axis Labels






                share|improve this answer













                Consider adjusting the names.arg of barplot which defaults to names attribute of your matrix. Specifically, create new vectors of names that reverse the space-separated original colnames and replaces space with line breaks:



                Bar Labels



                barsCarabooda <- gsub(" ", "n", 
                lapply(strsplit(colnames(mxCarabooda), split=" "),
                function(x) paste(rev(x), collapse=" "))
                )

                barsNeerabup <- gsub(" ", "n",
                lapply(strsplit(colnames(mxNeerabup), split=" "),
                function(x) paste(rev(x), collapse=" "))
                )

                barsNowergup <- gsub(" ", "n",
                lapply(strsplit(colnames(mxNowergup), split=" "),
                function(x) paste(rev(x), collapse=" "))
                )


                Plotting with names.arg



                par(mfrow=c(1,3), mar=c(5, 4, 4, 0.2))
                colours <- c("gray63","gray87")

                barplot(mxCarabooda, main='Carabooda', ylab='Profit loss ($m)',
                xlab='Change in water table at each level of GW cut', beside=TRUE,
                col=colours, ylim=c(0,30), names.arg=barsCarabooda)
                legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
                col=c("gray63","gray87"), pch=15)

                barplot(mxNeerabup,main='Neerabup', ylab='',
                xlab='Change in water table at each level of GW cut', beside=TRUE,
                col=colours, ylim=c(0,30), names.arg=barsNeerabup)
                legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
                col=c("gray63","gray87"), pch=15)

                barplot(mxNowergup,main='Nowergup', ylab='',
                xlab='Change in water table at each level of GW cut',beside=TRUE,
                col=colours, ylim=c(0,30), names.arg=barsNowergup)
                legend('topright', bty="n", legend=c('Loss in GM','Loss in adjusted GM'),
                col=c("gray63","gray87"), pch=15)


                Bar Plot with Line Break X-Axis Labels







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 28 at 16:53









                ParfaitParfait

                62.1k10 gold badges57 silver badges77 bronze badges




                62.1k10 gold badges57 silver badges77 bronze badges

































                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Stack Overflow!


                    • 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%2fstackoverflow.com%2fquestions%2f55401877%2fhow-to-create-2-variables-in-2-rows-under-x-axis-in-barplot-in-r-not-using-ggpl%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

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript