IniziaInizia gratis

Stacking states

In this exercise, you will explore and compare the prices of various food commodities across three Indian states: Jammu and Kashmir, Bihar, and Punjab. To facilitate this analysis, you will utilize grouped histograms, where the bars representing different commodities will be stacked on top of each other.

For your convenience, the DataFrames, and StatsPlots packages have already been imported. Additionally, the commodities DataFrame is readily accessible, containing the relevant data for your analysis.

Questo esercizio fa parte del corso

Introduction to Data Visualization with Julia

Visualizza il corso

Istruzioni dell'esercizio

  • Generate a grouped histogram using the Retail Price column from the commodities DataFrame.
  • Define the groups using the State column, assigning the colors limegreen, fuchsia, and orange1 to represent each state, respectively.
  • Utilize the bar_position argument to stack the bars on top of one another.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Create grouped histogram
____(
	____."____",
    # Define groups and colors
	____=____.____,
    color=[____],
    # Stack the bars
    bar_position=:____
)
title!("Commodity Prices in India")
xlabel!("Price (Rupees)")
ylabel!("Frequency")
Modifica ed esegui il codice