Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте 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

Натисніть або перетягніть елементи та заповніть пропуски

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 6

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

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

Натисніть або перетягніть елементи та заповніть пропуски

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 6
some-alt