<jupyter_start><jupyter_text>Data Visualization in PythonIn this example, we will be plotting the percent actinomycetes by measurements of soil carbon.We start by importing additional packages necessary for this visualization.<jupyter_code>import pandas
import seaborn

print("Packages loaded!")<jupyter_output><empty_output><jupyter_text>Next, we load data and look at the first few rows.<jupyter_code>micro = pandas.read_csv("data/Soil_Micro_Data.csv")
micro.head()<jupyter_output><empty_output><jupyter_text>Our first plot will be plotting the percent actinomycete bacteria vs. the percent of organic Carbon. Using the seaborn method `regplot`, it will automatically draw the line from linear regression.<jupyter_code>seaborn.regplot(x = "Organic_C", y = "Per_Actinomycetes", data = micro)<jupyter_output><empty_output><jupyter_text>We should update our axis labels, using the `set` command. Note here we also assigned the plot to a variable (`micro_plot`), so we could manipulate it.<jupyter_code>micro_plot = seaborn.regplot(x = "Organic_C", y = "Per_Actinomycetes", data = micro)
micro_plot.set(xlabel = "% Organic carbon", ylabel = "% Actinomycetes")<jupyter_output><empty_output><jupyter_text>Next, we will modify our code to change what we plot on the x-axis. In this case we want to plot `Total_C` on the x-axis. Update the code below to change the values we are plotting on the x-axis.<jupyter_code>micro_plot = seaborn.regplot(x = "Organic_C", y = "Per_Actinomycetes", data = micro)<jupyter_output><empty_output><jupyter_text>By default, it will add a linear regression line and confidence intervals. This does not look like a linear relationship (the amount of actinomycetes doesn't appear to decrease continuously with carbon). Try a polynomial relationship by adding `order = 2` to the `regplot` method (immediately following the data specification).<jupyter_code># Paste your code from above here, and update
# Paste your code from the previous code block and update<jupyter_output><empty_output><jupyter_text>To finish off this plot, we want to write the plot to a png file.<jupyter_code>micro_plot = # Copy and paste the plot code from the code block above

# Saves the plot to vaccination-cases.png
micro_plot.get_figure().savefig("output/actino-carbon-plot.png")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08217993079584775, 'fraction_numerical': 0.00043252595155709344, 'mean_word_length': 6.437299035369775, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '346938', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 723, 'n_tokens_neox': 680, 'n_words': 254, 'path': 'intro-envs-seaborn.ipynb', 'repo_name': 'jcoliver/data-viz-roadshow', 'size': '2312'}