Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Visualizing Geographic Data | Data Analysis and Visualization for Media
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Python for Journalists and Media

bookVisualizing Geographic Data

Geographic data plays a vital role in journalism, offering new ways to present and interpret information for your audience. By mapping crime reports, election results, or the locations of news sources, you can reveal patterns and stories that might otherwise go unnoticed. Visualizing geographic data helps readers quickly grasp the scale, spread, and connections between events, making your reporting more engaging and informative.

123456789101112131415161718192021
import matplotlib.pyplot as plt # Example dataset: news events with latitude and longitude news_events = [ {"title": "City Hall Protest", "lat": 40.7128, "lon": -74.0060}, {"title": "Downtown Fire", "lat": 40.7135, "lon": -74.0090}, {"title": "Riverfront Festival", "lat": 40.7150, "lon": -74.0030}, {"title": "Museum Opening", "lat": 40.7100, "lon": -74.0150} ] # Extract latitude and longitude lats = [event["lat"] for event in news_events] lons = [event["lon"] for event in news_events] plt.figure(figsize=(8, 6)) plt.scatter(lons, lats, c='red', marker='o') plt.title("Map of News Events") plt.xlabel("Longitude") plt.ylabel("Latitude") plt.grid(True) plt.show()
copy

Geographic visualizations like the scatter plot above allow you to display the locations of news events on a map, helping readers see where stories are happening. This context can highlight clusters of incidents, reveal underserved areas, or support investigative reporting by connecting events to their locations. By plotting latitude and longitude data, you give your audience a visual anchor for your stories, making complex information easier to digest.

1234567891011121314151617181920
import matplotlib.pyplot as plt # Reuse the news_events dataset lats = [event["lat"] for event in news_events] lons = [event["lon"] for event in news_events] titles = [event["title"] for event in news_events] plt.figure(figsize=(8, 6)) # Customize marker size and color plt.scatter(lons, lats, s=150, c='blue', marker='^', alpha=0.7) # Add labels to each point for lon, lat, title in zip(lons, lats, titles): plt.text(lon + 0.0005, lat + 0.0005, title, fontsize=9) plt.title("Customized Map of News Events") plt.xlabel("Longitude") plt.ylabel("Latitude") plt.grid(True) plt.show()
copy

1. Why are maps useful in news reporting?

2. What data is needed to plot events on a map?

3. Fill in the blank: To plot latitude and longitude points in matplotlib, use _ _ _.

question mark

Why are maps useful in news reporting?

Select the correct answer

question mark

What data is needed to plot events on a map?

Select the correct answer

question-icon

Fill in the blank: To plot latitude and longitude points in matplotlib, use _ _ _.

plt.plotplt.barplt.hist

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

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 6

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Suggested prompts:

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

How can I add more data points or different event types to the visualization?

What are some best practices for labeling points on a geographic scatter plot?

bookVisualizing Geographic Data

Veeg om het menu te tonen

Geographic data plays a vital role in journalism, offering new ways to present and interpret information for your audience. By mapping crime reports, election results, or the locations of news sources, you can reveal patterns and stories that might otherwise go unnoticed. Visualizing geographic data helps readers quickly grasp the scale, spread, and connections between events, making your reporting more engaging and informative.

123456789101112131415161718192021
import matplotlib.pyplot as plt # Example dataset: news events with latitude and longitude news_events = [ {"title": "City Hall Protest", "lat": 40.7128, "lon": -74.0060}, {"title": "Downtown Fire", "lat": 40.7135, "lon": -74.0090}, {"title": "Riverfront Festival", "lat": 40.7150, "lon": -74.0030}, {"title": "Museum Opening", "lat": 40.7100, "lon": -74.0150} ] # Extract latitude and longitude lats = [event["lat"] for event in news_events] lons = [event["lon"] for event in news_events] plt.figure(figsize=(8, 6)) plt.scatter(lons, lats, c='red', marker='o') plt.title("Map of News Events") plt.xlabel("Longitude") plt.ylabel("Latitude") plt.grid(True) plt.show()
copy

Geographic visualizations like the scatter plot above allow you to display the locations of news events on a map, helping readers see where stories are happening. This context can highlight clusters of incidents, reveal underserved areas, or support investigative reporting by connecting events to their locations. By plotting latitude and longitude data, you give your audience a visual anchor for your stories, making complex information easier to digest.

1234567891011121314151617181920
import matplotlib.pyplot as plt # Reuse the news_events dataset lats = [event["lat"] for event in news_events] lons = [event["lon"] for event in news_events] titles = [event["title"] for event in news_events] plt.figure(figsize=(8, 6)) # Customize marker size and color plt.scatter(lons, lats, s=150, c='blue', marker='^', alpha=0.7) # Add labels to each point for lon, lat, title in zip(lons, lats, titles): plt.text(lon + 0.0005, lat + 0.0005, title, fontsize=9) plt.title("Customized Map of News Events") plt.xlabel("Longitude") plt.ylabel("Latitude") plt.grid(True) plt.show()
copy

1. Why are maps useful in news reporting?

2. What data is needed to plot events on a map?

3. Fill in the blank: To plot latitude and longitude points in matplotlib, use _ _ _.

question mark

Why are maps useful in news reporting?

Select the correct answer

question mark

What data is needed to plot events on a map?

Select the correct answer

question-icon

Fill in the blank: To plot latitude and longitude points in matplotlib, use _ _ _.

plt.plotplt.barplt.hist

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

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 6
some-alt