<jupyter_start><jupyter_text>Basic Imports<jupyter_code>from numpy import *
import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>Basic Plot<jupyter_code>x = arange(0.,10.,0.1) # generate a range of values as an array, using begin, end, step as input 
y = sin(x)
ll = plt.plot(x,y) # this is the simplest plotting idiom
plt.show()<jupyter_output><empty_output><jupyter_text>Setting Plot Parameters and annotating<jupyter_code>ll = plt.plot(x,y)
xl = plt.xlabel('horizontal axis')
yl = plt.ylabel('vertical axis')
ttl = plt.title('sine function')
ax = plt.axis([-2, 12, -1.5, 1.5])
grd = plt.grid(True)
txt = plt.text(0,1.3,'here is some text')
ann = plt.annotate('a point on curve',xy=(4.7,-1),xytext=(3,-1.3),arrowprops=dict(arrowstyle='->'))
plt.show()<jupyter_output><empty_output><jupyter_text>Multiple Graphs On the Same Plot<jupyter_code>x = arange(0.,10,0.1)
a = cos(x)
b = sin(x)
c = exp(x/10)
d = exp(-x/10)
la = plt.plot(x,a,'b-',label='cosine')
lb = plt.plot(x,b,'r--',label='sine')
lc = plt.plot(x,c,'gx',label='exp(+x)')
ld = plt.plot(x,d,'y-', linewidth = 5,label='exp(-x)')
ll = plt.legend(loc='upper left')
lx = plt.xlabel('xaxis')
ly = plt.ylabel('yaxis')
plt.show()<jupyter_output><empty_output><jupyter_text>Plotting with multiple plots on a grid Details on grid plotting  Some neat tricks with legends, bg colors and arrows in labels<jupyter_code>a = np.arange(0,3,.02)
b = np.arange(0,3,.02)
c = np.exp(a)
d = c[::-1]

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(a,c,'k--',a,d,'k:',a,c+d,'k')
leg = ax.legend(('Model length', 'Data length', 'Total message length'),
           'upper center', shadow=True)
ax.set_ylim([-1,20])
ax.grid(True)
ax.set_xlabel('Model complexity --->')
ax.set_ylabel('Message length --->')
ax.set_title('Minimum Message Length')

ax.set_yticklabels([])
ax.set_xticklabels([])

# set some legend properties.  All the code below is optional.  The
# defaults are usually sensible but if you need more control, this
# shows you how

# the matplotlib.patches.Rectangle instance surrounding the legend
frame  = leg.get_frame()
frame.set_facecolor('0.80')    # set the frame face color to light gray

# matplotlib.text.Text instances
for t in leg.get_texts():
    t.set_fontsize('small')    # the legend text fontsize

# matplotlib.lines.Line2D instances
for l in leg.get_lines():
    l.set_linewidth(1.5)  # the legend line width
plt.show()
### Plotting using the OO interface and setting low level parameters
import matplotlib.pyplot as plt #1
figsize = (8, 5) #2 
fig = plt.figure(figsize=figsize) #3 
ax = fig.add_subplot(111) #4 
line = ax.plot(range(10))[0] #5 
ax.set_title('Plotted with OO interface') #6 
ax.set_xlabel('measured') 
ax.set_ylabel('calculated')
ax.grid(True) #7 
line.set_marker('o')
plt.savefig('oo.png',dpi=150)
plt.show()<jupyter_output><empty_output><jupyter_text>Basic Pylab Boxplot also see pandas.boxplot<jupyter_code>import pandas as pd    
from pylab import boxplot as bp
loansmin = pd.read_csv('../datasets/loanf.csv')
data = loansmin['FICO.Score']
arrdata = np.array(data)
print(data[1:3])
print("****")
print(type(arrdata))   
    # basic plot
b = bp(arrdata)<jupyter_output><empty_output><jupyter_text>References[1] Graphics with Matplotlib   [2] Details on grid plotting<jupyter_code>import pandas as pd<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16337522441651706, 'fraction_numerical': 0.022142429682824656, 'mean_word_length': 5.46615087040619, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 32, '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': '608272', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1303, 'n_words': 297, 'path': 'notebooks/Z1. Appendix 1 Plotting code snippets .ipynb', 'repo_name': 'blaiseyuri/LearnDataScience', 'size': '3342'}