econ-visualization

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Econ Visualization

经济学可视化

Purpose

用途

This skill creates publication-quality figures for economics papers, using clean styling, consistent scales, and export-ready formats.
本Skill可为经济学论文创建具备出版级质量的图表,采用简洁的样式、统一的刻度以及可直接导出的格式。

When to Use

使用场景

  • Building figures for empirical results and descriptive analysis
  • Standardizing chart style across a paper or presentation
  • Exporting figures to PDF or PNG at journal quality
  • 为实证结果和描述性分析制作图表
  • 统一整篇论文或演示文稿的图表样式
  • 将图表导出为符合期刊要求的PDF或PNG格式

Instructions

操作步骤

Follow these steps to complete the task:
请按照以下步骤完成任务:

Step 1: Understand the Context

步骤1:了解背景信息

Before generating any code, ask the user:
  • What is the dataset and key variables?
  • What chart type is needed (line, bar, scatter, event study)?
  • What output format and size are required?
在生成任何代码之前,请向用户确认:
  • 数据集和关键变量是什么?
  • 需要哪种类型的图表(折线图、柱状图、散点图、事件研究图)?
  • 要求的输出格式和尺寸是什么?

Step 2: Generate the Output

步骤2:生成输出内容

Based on the context, generate code that:
  1. Uses a consistent theme for academic styling
  2. Labels axes and legends clearly
  3. Exports figures at high resolution
  4. Includes reproducible steps for data preparation
根据背景信息,生成满足以下要求的代码:
  1. 采用统一的学术风格主题
  2. 清晰标注坐标轴和图例
  3. 以高分辨率导出图表
  4. 包含可复现的数据准备步骤

Step 3: Verify and Explain

步骤3:验证与说明

After generating output:
  • Explain how to regenerate or update the plot
  • Suggest alternatives (log scales, faceting, smoothing)
  • Note any data transformations used
生成输出内容后:
  • 说明如何重新生成或更新图表
  • 提供替代方案(对数刻度、分面、平滑处理)
  • 标注所使用的任何数据转换方法

Example Prompts

示例提示词

  • "Create an event study plot with confidence intervals"
  • "Plot GDP per capita over time for three countries"
  • "Build a scatter plot with fitted regression line"
  • "创建带置信区间的事件研究图"
  • "绘制三个国家的人均GDP随时间变化的趋势图"
  • "构建带拟合回归线的散点图"

Example Output

示例输出

r
undefined
r
undefined

============================================

============================================

Publication-Quality Figure in R

Publication-Quality Figure in R

============================================

============================================

library(tidyverse)
df <- read_csv("data.csv")
ggplot(df, aes(x = year, y = gdp_per_capita, color = country)) + geom_line(size = 1) + scale_y_continuous(labels = scales::comma) + labs( title = "GDP per Capita Over Time", x = "Year", y = "GDP per Capita (USD)", color = "Country" ) + theme_minimal(base_size = 12) + theme( legend.position = "bottom", panel.grid.minor = element_blank() )
ggsave("figures/gdp_per_capita.pdf", width = 7, height = 4, dpi = 300)
undefined
library(tidyverse)
df <- read_csv("data.csv")
ggplot(df, aes(x = year, y = gdp_per_capita, color = country)) + geom_line(size = 1) + scale_y_continuous(labels = scales::comma) + labs( title = "GDP per Capita Over Time", x = "Year", y = "GDP per Capita (USD)", color = "Country" ) + theme_minimal(base_size = 12) + theme( legend.position = "bottom", panel.grid.minor = element_blank() )
ggsave("figures/gdp_per_capita.pdf", width = 7, height = 4, dpi = 300)
undefined

Requirements

环境要求

Software

软件

  • R 4.0+ or Python 3.10+
  • R 4.0+ 或 Python 3.10+

Packages

  • For R:
    ggplot2
    ,
    scales
    ,
    dplyr
  • For Python:
    matplotlib
    ,
    seaborn
    (optional alternative)
  • 对于R:
    ggplot2
    ,
    scales
    ,
    dplyr
  • 对于Python:
    matplotlib
    ,
    seaborn
    (可选替代方案)

Best Practices

最佳实践

  1. Use vector formats (PDF, SVG) for publication
  2. Keep labels concise and readable
  3. Document data filters used in the figure
  1. 使用矢量格式(PDF、SVG)用于出版
  2. 保持标签简洁且易读
  3. 记录图表中使用的数据筛选规则

Common Pitfalls

常见误区

  • Overcrowded plots without clear labeling
  • Inconsistent scales across figures
  • Exporting low-resolution images
  • 图表过于拥挤且标注不清晰
  • 不同图表间刻度不统一
  • 导出低分辨率图片

References

参考资料

Changelog

更新日志

v1.0.0

v1.0.0

  • Initial release
  • 初始版本