Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Labeling the X var of a horizontal bar graph

    Hi everyone!
    I am struggling with an apparently easy command. I should label the categories of my X axes (that is on the left, with cats. 1,2, 3, etc.). Attached the graph.
    The command I used was

    tw ///
    (bar v2 sett, hor ) (bar v1 sett, hor ), ///
    xlabel (0(0.1)1.0) ///
    ylabel (1(1)9) ///
    legend(order(1 "Uomini" 2 "Donne")) ///
    title("Distribuzione di genere per settore professionale") ///
    ytitle("") ///
    note("", span) ///
    scheme(s1mono)

    I tried to manage it with the Stata help, but I did not succeed.
    Someone can help me?

    Thanks a lot, G.

    Grapha.gph

  • #2
    You don't have to use twoway bar.
    Code:
    graph hbar v1 v2, over(sett) stack
    The command above is a guess because I don't have your data. I assume that the values of the variable sett have labels.

    For more concrete advice, please share an excerpt from your data with the dataex package (described in section 12 of the FAQ).

    Comment


    • #3
      Dear Friedrich, thanks a lot, your command worked perfectly.

      Why I have not to use the twoway in this case?

      I would like also to ask you something else: now I have the attached graph, but I need to put the labels in the range of the graph (if you see, the end and the begininnig of some of the labels does not appear --> see: "ustria, estrazione, manifattu" instead of "industria, estrazione, manifattura".

      Do you know how to solve this problem?

      Thanks a lot, G. Graph2.gph

      Comment


      • #4
        Please read the FAQ, especially section 12, including sections 12.4 and 12.5.

        Comment

        Working...
        X