按时间绘制最低工资
让我们看看美国最低工资的长期趋势。您可以使用数据集 wages_stats,其中包含每一年的最低、最高,以及中位数最低工资:
53x4 DataFrame
Row | year median max min
| Int64 Float64 Float64 Float64
____|_________________________________
1| 1968 8.55 15.61 8.55
...
所有工资数据都已做通胀调整,因此数值相当于 2020 年的金额。对比中位数、最大值和最小值三条折线,您能观察到哪些有趣的趋势吗?
wages_stats 数据集以及 DataFrames 和 Plots 包已通过 using 关键字为您加载。
本练习是课程的一部分
Julia 中的数据操作
练习说明
- 绘制数据集中各年份的中位数最低工资折线图,并将其标签设为
median。 - 在同一张图上,分别添加最高值和最小值的折线,标签设为
max和min。 - 为图表添加标题 "Trends in minimum wages in the US"。
- 将 x 轴标注为
"Year",将 y 轴标注为"Inflation-adjusted Minimum Wage (USD)"。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Plot the median wage and label it
____(____, ____, ____)
# Plot the maximum and label it
____
# Plot the minimum and label it
____
# Add a title
____("Trends in minimum wages in the US")
# Add x and y labels
____("Year")
____("Inflation-adjusted Minimum Wage (USD)")