<jupyter_start><jupyter_text>Some 2D Plots<jupyter_code>n = np.array([1,2,3,4,5])
fig,axes = plt.subplots(1,4,figsize=(12,3))
axes[0].scatter(xx, xx + 0.25*np.random.randn(len(xx)))
axes[0].set_title("Scatter")

axes[1].step(n,n**2,lw=2,color='Green')
axes[1].set_title('Step')

axes[2].bar(n,n**2,align='center',width=0.5)
axes[2].set_title('Bar')

axes[3].fill_between(x,x**2,x**3,color='green')
axes[3].set_title('Fill_Between')
plt.tight_layout()<jupyter_output><empty_output><jupyter_text>Text Annotation<jupyter_code>fig,ax = plt.subplots()
ax.plot(xx,xx**2,xx,xx**3)

ax.text(0.15,0.2,r"$y=x^2$",fontsize=20,color='blue')
ax.text(0.65,0.1,r"$y=x^3$",fontsize=20,color='green')
# Axes.text(self, x, y, s, fontdict=None, withdash=, **kwargs)
# s: This parameter is the text to be add.
# xy: This parameter is the point (x, y) where text is to be placed.<jupyter_output><empty_output><jupyter_text>Figures with multiple subplots and insets Axes can be added to a matplotlib Figure canvas manually using 'fig.add_axes' or using a sub-figure layout manager such as 'subplots', 'subplot2grid', or 'gridspec':<jupyter_code>fig = plt.figure()
ax1 = plt.subplot2grid((3,3), (0,0), colspan=3)
ax2 = plt.subplot2grid((3,3), (1,0), colspan=2)
ax3 = plt.subplot2grid((3,3), (1,2), rowspan=2)
ax4 = plt.subplot2grid((3,3), (2,0))
ax5 = plt.subplot2grid((3,3), (2,1))
fig.tight_layout()
# Reference link - https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.subplot2grid.html
import matplotlib.gridspec as gridspec
fig = plt.figure()

gs = gridspec.GridSpec(2,3,height_ratios=[2,1],width_ratios=[1,2,1])
for g in gs:
    ax = fig.add_subplot(g)
    
fig.tight_layout()<jupyter_output><empty_output><jupyter_text>add_axes<jupyter_code>fig, ax = plt.subplots()

ax.plot(xx, xx**2, xx, xx**3)
fig.tight_layout()

# inset
inset_ax = fig.add_axes([0.25,0.55, 0.35, 0.35]) # X, Y, width, height

inset_ax.plot(xx, xx**2, xx, xx**3)
inset_ax.set_title('zoom near origin')

# set axis range
inset_ax.set_xlim(-.2, .2)
inset_ax.set_ylim(-.005, .01)

# set axis tick locations
inset_ax.set_yticks([0, 0.005, 0.01])
inset_ax.set_xticks([-0.1,0,.1]);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19981541301338257, 'fraction_numerical': 0.0586063682510383, 'mean_word_length': 6.798561151079137, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '474676', 'license': 'MIT', 'n_tokens_mistral': 1025, 'n_tokens_neox': 969, 'n_words': 157, 'path': 'Graphical plotting using Matplotlib 1.ipynb', 'repo_name': 'talha6514/Data-Analysis-Visualization-Projects', 'size': '2167'}