Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Introduction to Data Visualization | Data Analysis and Visualization for Media
Python for Journalists and Media

bookIntroduction to Data Visualization

Data visualization plays a crucial role in modern journalism, transforming complex datasets into clear, compelling stories. Charts, graphs, and infographics allow readers to quickly grasp patterns, trends, and outliers that might otherwise remain hidden in raw numbers. For example, a news story about election results becomes far more engaging and informative when accompanied by a bar chart comparing vote counts across candidates. Similarly, a timeline of COVID-19 case numbers or a map of unemployment rates by region can turn abstract statistics into tangible narratives that resonate with audiences. Visualizations not only make information more accessible but also help journalists uncover insights that drive impactful reporting.

12345678
import matplotlib.pyplot as plt # Sample data: article counts by topic topics = ['Politics', 'Health', 'Sports', 'Technology', 'Culture'] article_counts = [34, 22, 18, 27, 15] plt.bar(topics, article_counts) plt.show()
copy

In the code above, you use the matplotlib library to create a simple bar chart showing the number of articles published on different topics. Bar charts are especially useful for comparing quantities across categories, making it easy for readers to spot which topics receive the most or least coverage. In a newsroom, such a chart could reveal if certain issues are underreported or highlight shifts in editorial focus over time. By translating numbers into visuals, bar charts help both journalists and their audiences quickly interpret and act on the data.

123456789101112
import matplotlib.pyplot as plt # Data topics = ['Politics', 'Health', 'Sports', 'Technology', 'Culture'] article_counts = [34, 22, 18, 27, 15] colors = ['#377eb8', '#4daf4a', '#f781bf', '#ff7f00', '#a65628'] plt.bar(topics, article_counts, color=colors) plt.title("Number of Articles by Topic") plt.xlabel("Topic") plt.ylabel("Article Count") plt.show()
copy

1. What is one advantage of using charts in news stories?

2. Which Python library is commonly used for creating visualizations?

3. Fill in the blank: To display a plot in matplotlib, use _____ .

question mark

What is one advantage of using charts in news stories?

Select the correct answer

question mark

Which Python library is commonly used for creating visualizations?

Select the correct answer

question-icon

Fill in the blank: To display a plot in matplotlib, use _____ .

Click or drag`n`drop items and fill in the blanks

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 1

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

Suggested prompts:

Can you explain how to customize the appearance of the chart further?

What other types of charts can I create with matplotlib for journalism?

How can I add data labels to each bar in the chart?

bookIntroduction to Data Visualization

Desliza para mostrar el menú

Data visualization plays a crucial role in modern journalism, transforming complex datasets into clear, compelling stories. Charts, graphs, and infographics allow readers to quickly grasp patterns, trends, and outliers that might otherwise remain hidden in raw numbers. For example, a news story about election results becomes far more engaging and informative when accompanied by a bar chart comparing vote counts across candidates. Similarly, a timeline of COVID-19 case numbers or a map of unemployment rates by region can turn abstract statistics into tangible narratives that resonate with audiences. Visualizations not only make information more accessible but also help journalists uncover insights that drive impactful reporting.

12345678
import matplotlib.pyplot as plt # Sample data: article counts by topic topics = ['Politics', 'Health', 'Sports', 'Technology', 'Culture'] article_counts = [34, 22, 18, 27, 15] plt.bar(topics, article_counts) plt.show()
copy

In the code above, you use the matplotlib library to create a simple bar chart showing the number of articles published on different topics. Bar charts are especially useful for comparing quantities across categories, making it easy for readers to spot which topics receive the most or least coverage. In a newsroom, such a chart could reveal if certain issues are underreported or highlight shifts in editorial focus over time. By translating numbers into visuals, bar charts help both journalists and their audiences quickly interpret and act on the data.

123456789101112
import matplotlib.pyplot as plt # Data topics = ['Politics', 'Health', 'Sports', 'Technology', 'Culture'] article_counts = [34, 22, 18, 27, 15] colors = ['#377eb8', '#4daf4a', '#f781bf', '#ff7f00', '#a65628'] plt.bar(topics, article_counts, color=colors) plt.title("Number of Articles by Topic") plt.xlabel("Topic") plt.ylabel("Article Count") plt.show()
copy

1. What is one advantage of using charts in news stories?

2. Which Python library is commonly used for creating visualizations?

3. Fill in the blank: To display a plot in matplotlib, use _____ .

question mark

What is one advantage of using charts in news stories?

Select the correct answer

question mark

Which Python library is commonly used for creating visualizations?

Select the correct answer

question-icon

Fill in the blank: To display a plot in matplotlib, use _____ .

Click or drag`n`drop items and fill in the blanks

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 1
some-alt