#!/usr/bin/env python # coding: utf-8 # # Practice Problems # ### Lecture 17 # Answer each number in a separate cell # # Rename this notebook with your last name and the lecture # # ex. Cych_B_17 # # Turn-in this notebook on Canvas # ## 1. Kernel Density Estimates and Jointplots # - Use pandas to read in the tab separated file Datasets/ZirconData.txt. These data are from Bisnath et al (2006) and were downloaded from the Pangaea database (https://doi.pangaea.de/10.1594/PANGAEA.847015) # - These data are Lead-Lead and Uranium-Lead age dates for zircons from Dronning Maud Land, Antartica. The zircon ages show two stages of growth associated with two stages of mountain building in the region. # # - The columns \['Age dated \[ka\] (Age, 206Pb/238U Lead-Uranium)'\] and \['Age dated \[ka\] (Age, 207Pb/206Pb Lead-Lead)'\] are the different age systems. Get the mean of each of these ages. # - Use **plt.hist()** to plot a histogram of both age dates. # - Use **sns.kdeplot()** to plot a kernel density of both age systems. Experiment with the **bw** argument to see how this alters your result. According to the seaborn documentation, the bandwidth (bw) parameter of the KDE controls how tightly the estimation is fit to the data, much like the bin size in a histogram. It corresponds to the width of the kernels we plotted above. The default behavior tries to guess a good value using a common reference rule, but it may be helpful to try larger or smaller values: # - Use **sns.jointplot()** to plot a 2d kernel density estimate of the data. # ## 2. Box and Violin Plots # - Plot a boxplot of the Pb-U age for each sample (designated by the 'Sample ID' column). Plot the mean Pb-U age for the whole dataset as a horizontal line. # - Plot a violin plot for each of these samples. Plot a swarm plot on top of this plot. # - Does the boxplot or the violin plot tell you more about the data in this case? # ## 3. Pairplots # - Filter the DataFrame to only include rows with 207Pb/206Pb and 206Pb/238U <0.5 # - Plot the four elemental ratios 232Th/238U, 207Pb/206Pb, 207Pb/235U and 206Pb/238U against one another # - Can you see a bimodal distribution in any of these plots? # - Are any of these ratios strongly correlated? # In[ ]: