<jupyter_start><jupyter_text>Matplotlib assignment (Week 2)Written by <NAME>First, our standard imports:<jupyter_code>%matplotlib inline

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

mpl.rc('font', family='sans serif', size=16)<jupyter_output><empty_output><jupyter_text>1. Creating a "Corner" plotIn this short assignment you will create a "corner" plot, which is a really nice way of visualizing multi-dimensional histograms. In this notebook, we'll deal with the 2-dimensional case.**Note:** The Python package [corner.py](https://corner.readthedocs.io/en/latest/) is a beautiful Python implementation of this, but we'll write our own using what we learned in the Matplotlib tutorial.  The dataUsing numpy we generate a 2-dimensional Gaussian distribution, with a strong covariance between the two variables.<jupyter_code>mean = [0, 0]
cov  = [[1, 1], [1, 2]]  # covariance matrix

x, y = np.random.multivariate_normal(mean, cov, 10000).T<jupyter_output><empty_output><jupyter_text>The assignmentCreate a "corner" plot displaying the 2-D Gaussian data above. This should include the following elements:1. A histogram of the x-data2. A histogram of the y-data3. A "density" plot of the x, y data. This can be a scatter plot with some transparency set (e.g. alpha=)You may find the command (courtesy of [StackOverflow](https://stackoverflow.com/questions/4209467/matplotlib-share-x-axis-but-dont-show-x-axis-tick-labels-for-both-just-one))`plt.setp(ax1.get_xticklabels(), visible=False)`useful for hiding the ticklabels for `ax1` while `sharex=True` between `ax1` and `ax2`, but still keeping ticklabels for `ax2`. A similar thing can be done for yticklabels. You can also use `orientation='horizontal'` in a `hist` plot to rotate the histogram 90 degrees.Finally, save the figure using the `plt.savefig` command. Some possible output formats are .eps (vectorized), .pdf, or .png. For outputting figures to include in a paper, for example, .eps is usually the way to go. Don't forget to set `bbox_inches='tight'` when saving your figure, so that everything is nicely formatted (try saving a figure with and without that option to see how much of a difference it makes!)The final output should look something like this:![corner.png](attachment:corner.png) Feel free to change colors, fonts, plot styles (e.g. a bar histogram instead of filled, colorscale for the density plot) to your personal desire. The sky is the limit! When you've created and exported your plot, copy it into your Google doc folder.<jupyter_code>'''
Fill-in code here.

First, create a figure using plt.figure
Then add the three subplots using plt.subplot(nrow, ncol, index), 
sharing axes where appropriate (i.e. sharex between the density 
plot and x-hist, sharey between density plot and y-hist)

Also, hide the ticklabels for the x-axis of the x-hist and 
the y-axis of the y-hist. The command above should be helpful.
'''




'''
Then,
1. Generate a scatterplot for the bottom-left subplot, adjusting 
   colors/opacity as necessary.
2. Generate a histogram for the x-data in the top-left subplot
3. Generate a histogram for the y-data in the bottom-right subplot.
   Rotate 90-degrees by setting the orientation to horizontal.
   
Don't forget to call fig.tight_layout() to keep the subplots nice & tidy!

Finally, save your figure using plt.savefig
'''<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08547008547008547, 'fraction_numerical': 0.011788977306218685, 'mean_word_length': 4.882149046793761, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 2, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '256424', 'license': 'MIT', 'n_tokens_mistral': 1038, 'n_tokens_neox': 964, 'n_words': 444, 'path': 'Week2_matplotlib_pandas/matplotlib_assignment.ipynb', 'repo_name': 'priyahasan/Intro-to-Astro-2021', 'size': '3401'}