1, 稍大的数据,y轴用科学计数法表示标签
plt.ticklabel_format(axis=’y’, style=’sci’, scilimits=(0,0))
2,合并列表里的元素
b=[[1,2,5],[3,4,10],[2,10,8]]
c=[item for lit in b for item in lit]
1, 稍大的数据,y轴用科学计数法表示标签
plt.ticklabel_format(axis=’y’, style=’sci’, scilimits=(0,0))
2,合并列表里的元素
b=[[1,2,5],[3,4,10],[2,10,8]]
c=[item for lit in b for item in lit]
pip install xlrd==1.2.0
xlrd-2.0.1只支持读取xls,不支持读取xlsx, xlrd-1.2.0版本同时支持xlsx和xls格式。
# show vector calculation in numpy function
import numpy as np
# new vec
vec_1 = np.array([1,1,0])
vec_2 = np.array([2,3,1])
# mode of the vec
vec_mode = np.linalg.norm(vec_1)
# dot:a.b=|a|*|b|*cos(theta)
vec_dot = np.dot(vec_1, vec_2)
# cross: a*b = c, |a*b|=|a|*|b|*sin(theta)
vec_cross = np.cross(vec_1, vec_2)
print(' mode for vev_1:', vec_mode, '\n dot:', vec_dot, '\n cross:', vec_cross)
import matplotlib.pyplot as plt
import numpy as np
import csv
column1=[]
column2=[]
with open('book1.csv','r',encoding='utf-8') as data_input:
reader= csv.reader(data_input)
for row in reader:
try:
data1=float(row[0])
data2=float(row[1])
column1.append(data1)
column2.append(data2)
except ValueError:
continue
'''
x=np.linspace(0,10,100)
y=np.sin(x)
y1=np.random.randn(100)
plt.scatter(x,y1,label="scatter figure")
'''
plt.plot(column1,column2,ls='-',lw=2,label="plot figure")
plt.legend()
#plt.xlim(0,10)
#plt.ylim(0,1)
plt.xlabel("x axis")
plt.ylabel("y axis")
#plt.axhline(y=0.5,ls='--')
plt.show()
pip 是 Python 包管理工具,该工具提供了对Python 包的查找、下载、安装、卸载的功能。 Continue reading PIP
:cd /etc/default
:/etc/default$ ls
:sudo vi grub
GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash”to “text”
:sudo update-grub
:sudo systemctl set-default multi-user.target
Created symlink /etc/systemd/system/default.target → /lib/systemd/system/multi-user.target.
:reboot
math.sin(math.radians(30))=0.5
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install apache2 -y
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.1-fpm php7.1-mcrypt php7.1-cli php7.1-xml php7.1-mysql php7.1-gd php7.1-imagick php7.1-recode php7.1-tidy php7.1-xmlrpc
sudo apt-get install libapache2-mod-php7.1
sudo apt-get install php7.1-sqlite3
wget https://wordpress.org/latest.tar.gz
wget https://downloads.wordpress.org/plugin/sqlite-integration.1.8.1.zip
tar xvfz ./latest.tar.gz
unzip ./sqlite-integration.1.8.1.zip
sudo mv wordpress /var/www/html/
sudo chown -R www-data:www-data /var/www/html/wordpress
mv wp-config-sample.php wp-config.php
mv sqlite-integration /var/lib/wordpress/wp-content/plugins/
mv /var/www/html/wordpress/wp-content/plugins/sqlite-integration/db.php /var/www/html/wordpress/wp-content/
sudo service apache2 restart
IP/wordpress #start installation
一、用默认设置绘制折线图
import matplotlib.pyplot as plt
x_values=list(range(11))
#x轴的数字是0到10这11个整数
y_values=[x**2 for x in x_values]
#y轴的数字是x轴数字的平方
plt.plot(x_values,y_values,c='green')
#用plot函数绘制折线图,线条颜色设置为绿色plt.title('Squares',fontsize=24)
#设置图表标题和标题字号plt.tick_params(axis='both',which='major',labelsize=14)
#设置刻度的字号
plt.xlabel('Numbers',fontsize=14)
#设置x轴标签及其字号
plt.ylabel('Squares',fontsize=14)
#设置y轴标签及其字号
plt.show()
#显示图表
1.删除以#开头的行
命令:
:g/^#/d; 将会删除全篇中以#开头的行 Continue reading vi editor 2