Announcement

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

  • Drawing a histogram by different taxes and two dates

    Hello Stata users,
    I have this data at hand:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str44 impot byte(moyenne_2009_2019 anne_2022)
    "TVA"                                          4 15
    "Autres Impots sur les Produits"               7  9
    "Impots sur les Revenus des Sociétés"          6 18
    "Autres Impots sur le Revenu et le Patrimoine" 5 16
    "Cotisations Sociales"                         5 25
    end
    As you can see, it is about some tax receipts (in million Euros) for some taxes that are measured for two periods: the average between 2009 and 2019, and the year 2022.
    My goal is to draw a histogram that has the tax receipts in million Euros on the Y axis, and on the X axis, I want to have two bars for each tax type, by the two periods (one bar showing the value of that tax receipt for 2009-2019, the other bar shows the value fir 2022). Is it also possible to have the exact value of each tax type and each period on top of the bar aswell?

    Thanks for the help!

  • #2
    I'd call that a bar chart. Some technique

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str44 impot byte(moyenne_2009_2019 anne_2022)
    "TVA"                                          4 15
    "Autres Impots sur les Produits"               7  9
    "Impots sur les Revenus des Sociétés"          6 18
    "Autres Impots sur le Revenu et le Patrimoine" 5 16
    "Cotisation
    Sociales"                         5 25
    end
    
    set scheme stcolor 
    
    graph hbar (asis) moyenne_2009_2019 anne_2022, ///
    over(impot, sort(2) descending) legend(pos(6) row(1)) blabel(total) ///
    subtitle(ajouter des unités monétaires ici)
    Click image for larger version

Name:	tunisian.png
Views:	2
Size:	45.4 KB
ID:	1769361

    Attached Files

    Comment


    • #3
      In addition, add good variable labels or improve the legend text directly

      Code:
      "Moyenne 2009-2019" 
      "Valeur 2022"
      for example would look better than what you have.

      Comment


      • #4
        Nick Cox Thanks! That worked

        Comment

        Working...
        X