...

/

Creating the Bar Chart

Creating the Bar Chart

Learn how to create a single bar chart.

We’ve obtained the necessary data and identified the fields required for the bar chart to meet our specifications. Now, let’s explore how each field contributes to the chart’s creation and how they work together to visually represent the data effectively.

Fields to plot a bar chart

To create a bar chart, we require the following fields:

Data for the y-axis

The data corresponding to the y-axis denotes the categories or groups shown along the bar chart’s horizontal axis. In this instance, we aim to display the names of languages. However, we must extract these language names from the data before proceeding.

Extracting the programming languages

To extract only the programming languages from the DataFrame, we can simply access the column names, excluding the 'Date' column. Here’s how we can do it:

C++
# Extract languages (excluding the 'Date' column)
languages = df.columns[1:].tolist()
print("Languages:", languages)

We have extracted the languages and stored them in a list called languages. Now that we know a popularity score is associated with each language, we require this information to display the data on the x-axis.

Data for the x-axis

The x-axis data represents the popularity scores to be displayed on the vertical axis of the bar chart. In our context, these scores correspond to the level ...