Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rafaelhbarros/32d01cce83adc6e77ca2be23c0abf8ba to your computer and use it in GitHub Desktop.

Select an option

Save rafaelhbarros/32d01cce83adc6e77ca2be23c0abf8ba to your computer and use it in GitHub Desktop.
salary_plot
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
# data sourced from https://www.levels.fyi/t/software-engineer/locations/united-states
years_experience = [5, 6, 7, 8, 9, 10, 11, 12, 13, 15]
base_salary = [140000, 150000, 160000, 170000, 180000, 190000, 200000, 210000, 220000, 240000]
total_comp = [180000, 200000, 220000, 240000, 260000, 280000, 300000, 320000, 340000, 380000]
fig, ax = plt.subplots()
fig.set_size_inches(10, 6)
ax.plot(years_experience, base_salary, marker='o', label='Base Salary')
ax.plot(years_experience, total_comp, marker='o', label='Total Compensation')
ax.set_xlabel('Years of Experience')
ax.set_ylabel('Salary (USD)')
ax.set_title('Software Engineer Salary Growth (5–15 Years Experience)')
ax.yaxis.set_major_formatter(mtick.StrMethodFormatter('${x:,.0f}'))
# Grid + legend
ax.grid(True)
ax.legend()
plt.savefig("salary_plot.png", bbox_inches='tight')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment