# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm as cm
import matplotlib.colors as mcolors
# %matplotlib inline

# +
plt.figure(dpi=150)
plt.plot([1,2,3,4,5],[1,4,9,16,25],'-r>', label='plot figure')#r表示颜色，v表示下三角线类型
plt.xlim((0.5, 5.5))
plt.ylim((-2.5, 27))
plt.xlabel('xlabel', fontsize = 12)
plt.ylabel('ylabel', fontsize = 12)
plt.legend(loc='best', edgecolor='None', frameon=True,)
plt.axhline(5., c='k', ls='--', lw='2')
plt.axvline(3., c='g', ls='--', lw='2')
plt.axhspan(ymin=0., ymax=10., facecolor='k', alpha=0.3)
plt.axvspan(xmin=2., xmax=4., facecolor='k', alpha=0.3)
plt.annotate("annotation", xy=(3., 9.), xytext=(2.1, 12.), weight='normal', color='b',
            arrowprops=dict(arrowstyle='->', connectionstyle='arc3', color='b'))
plt.text(4.5, 18., "Plot Line", weight='bold', color='k')
# plt.grid(linestyle=':', color='r')

# plt.show()
l.__dict__

# + tags=[]
x = np.linspace(0.5, 3.5, 100)
y = np.sin(x)
y1 = np.random.randn(100)

plt.figure(dpi=150)
plt.scatter(x, y1, c='0.25', label='scatter figure')
plt.plot(x, y, ls='--', lw=2, label='plot figure')

for spine in plt.gca().spines.keys():
    if spine in ['top','right']:
        plt.gca().spines[spine].set_color("none")

plt.gca().xaxis.set_ticks_position('bottom')
plt.gca().yaxis.set_ticks_position('left')

plt.xlim(0.0, 4.0)
plt.ylim(-3.0, 3.0)
plt.xlabel('x_axis', fontsize = 12)
plt.ylabel('y_axis', fontsize = 12)
plt.grid(True, linestyle=':', color='k', )

plt.axhline(0., c='r', ls='--', lw='2')
plt.axvspan(xmin=1., xmax=2., facecolor='y', alpha=0.3)

plt.annotate("maximum", xy=(np.pi / 2., 1.), xytext=((np.pi / 2) + 0.15, 1.5), weight='bold',
            color='r', arrowprops=dict(arrowstyle='->', connectionstyle='arc3', color='r'))
plt.annotate("spines", xy=(0.75, -3.), xytext=(0.35, -2.25), weight='bold',
            color='b', arrowprops=dict(arrowstyle='->', connectionstyle='arc3', color='r'))
plt.annotate("", xy=(0., -2.78), xytext=(0.4, -2.32), weight='bold',
            color='r', arrowprops=dict(arrowstyle='->', connectionstyle='arc3', color='r'))
plt.annotate("", xy=(3.5, -2.98), xytext=(3.6, -2.7), weight='bold',
            color='r', arrowprops=dict(arrowstyle='->', connectionstyle='arc3', color='r'))

plt.text(3.6, -2.5, "'|' is tickline", weight='bold', color='b', fontsize=8)
plt.text(3.6, -2.8, "3.5 is ticklabel", weight='bold', color='b', fontsize=8)

plt.legend(loc='upper right', edgecolor='k', frameon=True, framealpha=1.0, handlelength=2,
           bbox_transform=plt.gca().transAxes)
plt.title('structure matplotlib')

# +
a = np.random.randn(100)
b = np.random.randn(100)

plt.figure(dpi=150)
plt.scatter(a, b, s=np.power(10 * a + 20 * b, 2), c=np.random.rand(100), cmap=cm.RdYlBu,
            marker='o') 

# + tags=[]
x = np.linspace(0.1, 0.6, 6)
y = np.exp(x)

plt.figure(dpi=150)
err = plt.errorbar(x, y, fmt='ro:', ecolor='b', yerr=0.2, xerr=0.02, elinewidth=2, capsize=4,
                   capthick=1, barsabove=False)
plt.xlim(0., 0.7)
print(err)

# + tags=[]
x = np.linspace(0.5, 3.5, 100)
y1 = np.sin(x)
y2 = np.random.randn(100)

# fig = plt.figure(dpi=150)
fig, ax = plt.subplots(1, 1, )
l1, = ax.plot(x, y2, label='up')
l2, = ax.plot(x, y1, color='red', linewidth=1.0, linestyle='--', label='down')
plt.legend(handles=[l1, l2,], labels=['aaa', 'bbb'], loc='best')


# + tags=[]
fig = plt.figure(dpi=150)
ax = fig.add_subplot(111)

t = np.arange(0.0, 5.0, 0.01)
s = np.cos(2 * np.pi * t)
line, = ax.plot(t, s, lw=2)

# ax.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
#             arrowprops=dict(facecolor='black', shrink=0.05))

ax.annotate('local max', xy=(3, 1),  xycoords='data',
            xytext=(0.8, 0.95), textcoords='axes fraction',
            arrowprops=dict(facecolor='black', shrink=0.05),
            horizontalalignment='right', verticalalignment='top')

ax.set_ylim(-2,2)
plt.show()

# +
x=[1,2,3,4,5]  
y=[3,6,7,9,2]  

fig,ax=plt.subplots(1,1)  
ax.plot(x,y,label='trend')  

ax.set_title('title test',fontsize=12,color='r')  


# +
x = np.linspace(0, 2*np.pi, 400)
y = np.sin(x**2)

# fig, ax = plt.subplots()
# ax.plot(x, y)
# ax.set_title('Simple plot')

# f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
# ax1.plot(x, y)
# ax1.set_title('Sharing Y axis')
# ax2.scatter(x, y)

# fig, axes = plt.subplots(2, 2, subplot_kw=dict(polar=True))
# axes[0, 0].plot(x, y)
# axes[1, 1].scatter(x, y)

# plt.subplots(2, 2, sharex='col')

# plt.subplots(2, 2, sharey='row')

# plt.subplots(2, 2, sharex='all', sharey='all')

# plt.subplots(2, 2, sharex=True, sharey=True)

fig, ax=plt.subplots(num=10, clear=True)
# -

x = np.arange(0, 6)  
y = x * x  
plt.plot(x, y, marker='o')  
for xy in zip(x, y):  
    plt.annotate("(%s,%s)" % xy, xy=xy, xytext=(-20, 10), textcoords='offset points')  
plt.show()  

# + tags=[]
C_t = 0.75
I_a = np.arange(0.03, 0.20, 0.005)


k_star = 0.11 * (C_t**1.07) * (I_a**0.20)
epsilon = 0.23 * (C_t**-0.25) * (I_a**0.17)
a = 0.93 * (C_t**-0.75) * (I_a**0.17)
b = 0.42 * (C_t**0.6) * (I_a**0.2)
c = 0.15 * (C_t**-0.25) * (I_a**-0.7)
# d = 2.3 * (C_t**-1.2)
e = 1.0 * (I_a**0.1)
f = 0.7 * (C_t**-3.2) * (I_a**-0.45)
y = [k_star, epsilon, a, b, c, e, f,]
labels = ["k_star", "epsilon", "a", "b", "c", "e", "f",]
line_styles = ["-", "--", "-.", ":", "-", "--", "-."]

fig = plt.figure(dpi=200)
ax = fig.add_subplot(111)
colors = list(mcolors.TABLEAU_COLORS.keys())
for i, label in enumerate(labels):
    ax.plot(I_a, y[i], color=colors[i], linewidth=2, linestyle=line_styles[i], label=label)
ax.legend(loc="best", edgecolor='None', frameon=False,
          labelspacing=0.4, bbox_transform=ax.transAxes)
ax.set_xlabel("Ambient Turbulence Intensity")
ax.set_ylabel("Parameter Value")
plt.show()

# -





StarcoderdataJupyterScriptsDedupFiltered