<jupyter_start><jupyter_text>Hardcoded inputs for Bar-Plots--> plt.bar()<jupyter_code>import matplotlib.pyplot as plt
 import numpy as np
 import csv
# using bar charts method the code is
plt.style.use('fivethirtyeight')

ages_x = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35] # will use for both plots
y_coordinates = [38496, 42000, 46752, 49320, 53200, 56000, 62316, 64928, 67317, 68748, 73752]

plt.bar(ages_x, y_coordinates, color= '#444444',  label = 'all devs')


# # Median Python Developer Salaries by Age
# py_dev_y = [45372, 48876, 53850, 57287, 63016,
#             65998, 70003, 70000, 71496, 75370, 83640]
# # adding level as legend alternative
# plt.plot(ages_x, py_dev_y, color= 'b',marker='o' , label = 'python')

# # x axis name
plt.xlabel('ages')

# # y axis name
# plt.ylabel('median salary')
plt.title('median salary by age')

# # to recognize which line represents what
# # legends = 
# # plt.legend(['all devs', 'Python'])
plt.legend()

plt.show()
# using the styles for plots
plt.style.use('fivethirtyeight')

ages_x = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35] # will use for both plots
y_coordinates = [38496, 42000, 46752, 49320, 53200, 56000, 62316, 64928, 67317, 68748, 73752]

# Median Python Developer Salaries by Age
py_dev_y = [45372, 48876, 53850, 57287, 63016,
            65998, 70003, 70000, 71496, 75370, 83640]
# adding level as legend alternative
plt.bar(ages_x, y_coordinates, color= '#444444',  label = 'all devs')



# Median JavaScript Developer Salaries by Age
js_dev_y = [37810, 43515, 46823, 49293, 53437,
            56373, 62375, 66674, 68745, 68746, 74583]
plt.plot(ages_x, js_dev_y, color= '#adad3b',linewidth=3 , label = 'javascript')



y_coordinates = [38496, 42000, 46752, 49320, 53200, 56000, 62316, 64928, 67317, 68748, 73752]
plt.plot(ages_x, py_dev_y, label = 'python')



# x axis name
plt.xlabel('ages')

# y axis name
plt.ylabel('median salary')
plt.title('median salary by age')

# to recognize which line represents what
# legends = 
# plt.legend(['all devs', 'Python'])
plt.legend()

# plt.tight_layout()

plt.show()
# using the styles for plots
plt.style.use('fivethirtyeight')

ages_x = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35] # will use for both plots
y_coordinates = [38496, 42000, 46752, 49320, 53200, 56000, 62316, 64928, 67317, 68748, 73752]

# Median Python Developer Salaries by Age
py_dev_y = [45372, 48876, 53850, 57287, 63016,
            65998, 70003, 70000, 71496, 75370, 83640]
# adding level as legend alternative

plt.bar(ages_x, y_coordinates, color= '#444444',  label = 'all devs')


# Median JavaScript Developer Salaries by Age
js_dev_y = [37810, 43515, 46823, 49293, 53437,
            56373, 62375, 66674, 68745, 68746, 74583]

plt.bar(ages_x, py_dev_y, label = 'python')


y_coordinates = [38496, 42000, 46752, 49320, 53200, 56000, 62316, 64928, 67317, 68748, 73752]

plt.bar(ages_x, js_dev_y, color= '#adad3b' , label = 'javascript')



# x axis name
plt.xlabel('ages')

# y axis name
plt.ylabel('median salary')
plt.title('median salary by age')

# to recognize which line represents what
# legends = 
# plt.legend(['all devs', 'Python'])
plt.legend()

# plt.tight_layout()

plt.show()
# offsetting x-values for better bar plots
# specify width for bars for clear understanding graphs

plt.style.use('fivethirtyeight')

ages_x = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35] # will use for both plots

x_indexes = np.arange(len(ages_x))
width = 0.25


y_coordinates = [38496, 42000, 46752, 49320, 53200, 56000, 62316, 64928, 67317, 68748, 73752]
plt.bar(x_indexes-width, y_coordinates,width = width ,color= '#444444',  label = 'all devs')
# Median Python Developer Salaries by Age
py_dev_y = [45372, 48876, 53850, 57287, 63016,
            65998, 70003, 70000, 71496, 75370, 83640]
# adding level as legend alternative
plt.bar(x_indexes, py_dev_y,width = width, color ='g' ,label = 'python')


# Median JavaScript Developer Salaries by Age
js_dev_y = [37810, 43515, 46823, 49293, 53437,
            56373, 62375, 66674, 68745, 68746, 74583]

plt.bar(x_indexes + width, js_dev_y,width = width ,color= '#adad3b' , label = 'javascript')

# x axis name
plt.xlabel('ages')

# y axis name
plt.ylabel('median salary')

# * adding xticks *
# plt.xticks(ticks=x_indexes, labels=ages_x)

plt.title('median salary by age')

# to recognize which line represents what
# legends = 
# plt.legend(['all devs', 'Python'])
plt.legend()

plt.tight_layout()

plt.show()
# offsetting x-values for better bar plots
# specify width for bars for clear understanding graphs
# adding xticks *imp*


plt.style.use('fivethirtyeight')

ages_x = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35] # will use for both plots

x_indexes = np.arange(len(ages_x))
width = 0.25


y_coordinates = [38496, 42000, 46752, 49320, 53200, 56000, 62316, 64928, 67317, 68748, 73752]
plt.bar(x_indexes-width, y_coordinates,width = width ,color= '#444444',  label = 'all devs')
# Median Python Developer Salaries by Age
py_dev_y = [45372, 48876, 53850, 57287, 63016,
            65998, 70003, 70000, 71496, 75370, 83640]
# adding level as legend alternative
plt.bar(x_indexes, py_dev_y,width = width, color ='g' ,label = 'python')


# Median JavaScript Developer Salaries by Age
js_dev_y = [37810, 43515, 46823, 49293, 53437,
            56373, 62375, 66674, 68745, 68746, 74583]

plt.bar(x_indexes + width, js_dev_y,width = width ,color= '#adad3b' , label = 'javascript')

# x axis name
plt.xlabel('ages')

# y axis name
plt.ylabel('median salary')

# * adding xticks *
plt.xticks(ticks=x_indexes, labels=ages_x)

plt.title('median salary by age')

# to recognize which line represents what
# legends = 
# plt.legend(['all devs', 'Python'])
plt.legend()

plt.tight_layout()

plt.show()<jupyter_output><empty_output><jupyter_text>Reading CSV files for bar-plots<jupyter_code>plt.style.use("fivethirtyeight")

# using csv module available in library (no pandas)
with open('data.csv') as csv_file:
    csv_reader = csv.DictReader(csv_file)

    row = next(csv_reader)
    print(row['LanguagesWorkedWith'].split(';'))
from collections import Counter
plt.style.use("fivethirtyeight")

# using csv module available in library (no pandas)
with open('data.csv') as csv_file:
    csv_reader = csv.DictReader(csv_file)

    language_counter = Counter()

    for row in csv_reader:
        language_counter.update(row['LanguagesWorkedWith'].split(';'))

print(language_counter.most_common(15))
# most common method returned a list
    # row = next(csv_reader)
    # print(row['LanguagesWorkedWith'].split(';'))
plt.style.use("fivethirtyeight")

# using csv module available in library (no pandas)
with open('data.csv') as csv_file:
    csv_reader = csv.DictReader(csv_file)

    language_counter = Counter()

    for row in csv_reader:
        language_counter.update(row['LanguagesWorkedWith'].split(';'))

languages = []
popularity = []

for item in language_counter.most_common(15):
    languages.append(item[0])
    popularity.append(item[1])


plt.bar(languages, popularity)

plt.title("Most popular languages")
plt.xlabel("Programming Languages")
plt.ylabel("People Using")

plt.tight_layout()

plt.show

# print(languages)
# print(popularity)

# print(language_counter.most_common(15))
# most common method returned a list
    # row = next(csv_reader)
    # print(row['LanguagesWorkedWith'].split(';'))
# adding the barh method to invert the x - axis & y axis

plt.style.use("fivethirtyeight")

# using csv module available in library (no pandas)
with open('data.csv') as csv_file:
    csv_reader = csv.DictReader(csv_file)

    language_counter = Counter()

    for row in csv_reader:
        language_counter.update(row['LanguagesWorkedWith'].split(';'))

languages = []
popularity = []

for item in language_counter.most_common(15):
    languages.append(item[0])
    popularity.append(item[1])

languages.reverse()
popularity.reverse()


plt.barh(languages, popularity)

plt.title("Most popular languages")
# plt.xlabel("Programming Languages")
plt.ylabel("People Using")

plt.tight_layout()

plt.show
# print(languages)f
# print(popularity)

# print(language_counter.most_common(15))
# most common method returned a list
    # row = next(csv_reader)
    # print(row['LanguagesWorkedWith'].split(';'))
#  reading through pandas
import pandas as pd

plt.style.use("fivethirtyeight")

# using csv module available in library (no pandas)
# with open('data.csv') as csv_file:
#     csv_reader = csv.DictReader(csv_file)
data = pd.read_csv('data.csv')
ids = data['Responder_id']
lang_responses = data['LanguagesWorkedWith']

language_counter = Counter()

for response in lang_responses:
    language_counter.update(response.split(';'))

languages = []
popularity = []

for item in language_counter.most_common(15):
    languages.append(item[0])
    popularity.append(item[1])

languages.reverse()
popularity.reverse()


plt.barh(languages, popularity)

plt.title("Most popular languages")
# plt.xlabel("Programming Languages")
plt.ylabel("People Using")

plt.tight_layout()

plt.show

# print(languages)f
# print(popularity)

# print(language_counter.most_common(15))
# most common method returned a list
    # row = next(csv_reader)
    # print(row['LanguagesWorkedWith'].split(';'))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1351205275105394, 'fraction_numerical': 0.11360933953086153, 'mean_word_length': 4.732342007434944, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '588287', 'license': 'MIT', 'n_tokens_mistral': 4285, 'n_tokens_neox': 3342, 'n_words': 905, 'path': 'bar-charts/bar-chart.ipynb', 'repo_name': 'VivanVatsa/matplotlib-castle_datascience_project', 'size': '9251'}