Skip to content

Commit 44365aa

Browse files
committed
mtpltb
1 parent 5cc4a07 commit 44365aa

22 files changed

+359
-0
lines changed

.vscode/c_cpp_properties.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Win32",
5+
"includePath": [
6+
"${workspaceFolder}/**"
7+
],
8+
"defines": [
9+
"_DEBUG",
10+
"UNICODE",
11+
"_UNICODE"
12+
],
13+
"windowsSdkVersion": "10.0.18362.0",
14+
"compilerPath": "D:/Users/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe",
15+
"cStandard": "c11",
16+
"cppStandard": "c++17",
17+
"intelliSenseMode": "msvc-x64"
18+
}
19+
],
20+
"version": 4
21+
}

Cpp-note/课程/20200703/后缀表达式.cpp

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"Thomas": {
3+
"name": "Thomas",
4+
"age": 12,
5+
"weight": "none",
6+
"height": "none",
7+
"Sports": {
8+
"屈伸腿": null,
9+
"平板支撑": null,
10+
"俯卧撑": null
11+
}
12+
},
13+
"Victor": {
14+
"name": "Victor",
15+
"age": 46,
16+
"weight": "none",
17+
"height": "none",
18+
"Sports": {
19+
20+
}
21+
},
22+
"ZXM": {
23+
"name": "Mary",
24+
"age": 46,
25+
"weight": "none",
26+
"height": "none",
27+
"Sports": {
28+
29+
}
30+
}
31+
}

Project/PYT/家庭体能检测Python版本/main.py

Whitespace-only changes.

Python-Notes/例程/##matplotlib/.idea/##matplotlib.iml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python-Notes/例程/##matplotlib/.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python-Notes/例程/##matplotlib/.idea/inspectionProfiles/profiles_settings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python-Notes/例程/##matplotlib/.idea/misc.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python-Notes/例程/##matplotlib/.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python-Notes/例程/##matplotlib/.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[TOC]
2+
3+
# 散点图
4+
5+
接下来,我们将介绍散点图。散点图通常用于比较两个变量来寻找相关性或分组,如果你在 3 维绘制则是 3 个。
6+
散点图的一些示例代码:
7+
8+
```python
9+
import matplotlib.pyplot as plt
10+
x = [1,2,3,4,5,6,7,8]
11+
y = [5,2,4,2,1,4,5,2]
12+
plt.scatter(x,y, label='skitscat', color='k', s=25, marker="o")
13+
plt.xlabel('x')
14+
plt.ylabel('y')
15+
plt.title('Interesting Graph\nCheck it out')
16+
plt.legend()
17+
plt.show()
18+
```
19+
结果为:
20+
21+
![image-20200706212610924](F:\Coding-Thomas\Coding-Notes\Python-Notes\例程\##matplotlib\PDF教程\DOC\image-20200706212610924.png)
22+
23+
`plt.scatter`不仅允许我们绘制 x 和 y ,而且还可以让我们决定所使用的标记颜色,大小和类型。 有一堆标记选项,请参阅 ==Matplotlib 标记文档==中的所有选项。下一节讲饼图。
24+
25+
26+
27+
# 饼图
28+
29+
饼图通常以%为单位,但是matplotlib可以自动处理,我们只需要提供数值
30+
31+
实例代码:
32+
33+
```python
34+
import matplotlib.pyplot as plt
35+
slices = [7,2,2,13]
36+
activities = ['sleeping','eating','working','playing']
37+
cols = ['c','m','r','b']
38+
plt.pie(slices,
39+
labels=activities,
40+
colors=cols,
41+
startangle=90,
42+
shadow= True,
43+
explode=(0,0.1,0,0),
44+
autopct='%1.1f%%')
45+
plt.title('Interesting Graph\nCheck it out')
46+
plt.show()
47+
```
48+
49+
运行结果:
50+
51+
![image-20200707143049857](F:\Coding-Thomas\Coding-Notes\Python-Notes\例程\##matplotlib\PDF教程\DOC\image-20200707143049857.png)
52+
53+
详细解释:
54+
55+
+ `slices`用来存储切片大小,睡觉占7份,玩占13份
56+
+ `activities`列表存储名称,最后放到标签中
57+
+ `cols`存储颜色名称,标记每一片的颜色。matplotlib中的颜色还可以是一个字母的,也可以是全称,也可以是十六进制,但是单个字母不全也不好记,在文章最后给一个参考图
58+
+ `shadow`就是阴影,`True`为开启,`False`为关闭
59+
+ `explode`可以拉出一个切片,样例中`(0,0.1,0,0)`设置第二个切片就是eating部分拉出0.1距离。
60+
+ `autopct`最后将百分比放置在切片上
61+
62+
63+
64+
颜色表:
65+
66+
![img](https://upload-images.jianshu.io/upload_images/7017253-6edec09676cc466d.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Matplotlib条形图
2+
3+
这个教程中我们会涉及条形图和直方图。我们先来看条形图:
4+
5+
函数是`plt.bar`,提示一下,`import matplotlib.pyplot as plt`这一句和`from matplotlib import pyplot as plt`是一样的,使用函数时两个列表是两组坐标,第一个列表是x轴,第二个是y轴
6+
7+
```python
8+
import matplotlib.pyplot as plt
9+
plt.bar([1,3,5,7,9],[5,2,7,8,2], label="Example one")
10+
plt.bar([2,4,6,8,10],[8,6,2,5,6], label="Example two", color='g')
11+
plt.legend()
12+
plt.xlabel('bar number')
13+
plt.ylabel('bar height')
14+
plt.title('Epic Graph\nAnother Line! Whoa')
15+
plt.show()
16+
```
17+
18+
`plt.bar` 为我们创建条形图。 如果你没有明确选择一种颜色,那么虽然做了多个图,所有的条看起来会一样。 这让我们有机会使用一个新的 Matplotlib 自定义选项。 你可以在任何类型的绘图中使用颜色,例如 `g` 为绿色, `b` 为蓝色, `r` 为红色,等等。 你还可以使用十六进制颜色代码,如 `#191970`
19+
20+
![image-20200702122952092](E:\ProgramThomas\Coding-Notes\Python-Notes\例程\##matplotlib\PDF教程\DOC\image-20200702122952092.png)
21+
22+
# Matplotlib直方图
23+
24+
接下来,我们会讲解直方图。 直方图非常像条形图,倾向于通过将区段组合在一起来显示分布。 这个例子可能是年龄的分组,或测试的分数。 我们并不是显示每一组的年龄,而是按照 20 ~ 25,25 ~ 30... 等等来显示年龄。 这里有一个例子:
25+
26+
```python
27+
import matplotlib.pyplot as plt
28+
population_ages = [22,55,62,45,21,22,34,42,42,4,99,102,110,120,1
29+
21,122,130,111,115,112,80,75,65,54,44,43,42,48]
30+
bins = [0,10,20,30,40,50,60,70,80,90,100,110,120,130]
31+
plt.hist(population_ages, bins, histtype='bar', rwidth=0.8)
32+
plt.xlabel('x')
33+
plt.ylabel('y')
34+
plt.title('Interesting Graph\nCheck it out')
35+
plt.legend()
36+
plt.show()
37+
```
38+
39+
对于 plt.hist ,你首先需要放入所有的值,然后指定放入哪个桶或容器。 在我们的例子中,我们绘制了一堆年龄,并希望以 10 年的增量来显示它们。 我们将条形的宽度设为 0.8,但是如果你想让条形变宽,或者变窄,你可以选择其他的宽度。
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# 饼图
2+
3+
饼图通常以%为单位,但是matplotlib可以自动处理,我们只需要提供数值
4+
5+
实例代码:
6+
7+
```python
8+
import matplotlib.pyplot as plt
9+
slices = [7,2,2,13]
10+
activities = ['sleeping','eating','working','playing']
11+
cols = ['c','m','r','b']
12+
plt.pie(slices,
13+
labels=activities,
14+
colors=cols,
15+
startangle=90,
16+
shadow= True,
17+
explode=(0,0.1,0,0),
18+
autopct='%1.1f%%')
19+
plt.title('Interesting Graph\nCheck it out')
20+
plt.show()
21+
```
22+
23+
运行结果:
24+
25+
![image-20200707143049857](F:\Coding-Thomas\Coding-Notes\Python-Notes\例程\##matplotlib\PDF教程\DOC\image-20200707143049857.png)
26+
27+
详细解释:
28+
29+
+ `slices`用来存储切片大小,睡觉占7份,玩占13份
30+
+ `activities`列表存储名称,最后放到标签中
31+
+ `cols`存储颜色名称,标记每一片的颜色。matplotlib中的颜色还可以是一个字母的,也可以是全称,也可以是十六进制,但是单个字母不全也不好记,在文章最后给一个参考图
32+
+ `shadow`就是阴影,`True`为开启,`False`为关闭
33+
+ `explode`可以拉出一个切片,样例中`(0,0.1,0,0)`设置第二个切片就是eating部分拉出0.1距离。
34+
+ `autopct`最后将百分比放置在切片上
35+
36+
37+
38+
颜色表:
39+
40+
![img](https://upload-images.jianshu.io/upload_images/7017253-6edec09676cc466d.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[TOC]
2+
3+
# 散点图
4+
5+
接下来,我们将介绍散点图。散点图通常用于比较两个变量来寻找相关性或分组,如果你在 3 维绘制则是 3 个。
6+
散点图的一些示例代码:
7+
8+
```python
9+
import matplotlib.pyplot as plt
10+
x = [1,2,3,4,5,6,7,8]
11+
y = [5,2,4,2,1,4,5,2]
12+
plt.scatter(x,y, label='skitscat', color='k', s=25, marker="o")
13+
plt.xlabel('x')
14+
plt.ylabel('y')
15+
plt.title('Interesting Graph\nCheck it out')
16+
plt.legend()
17+
plt.show()
18+
```
19+
结果为:
20+
21+
![image-20200706212610924](F:\Coding-Thomas\Coding-Notes\Python-Notes\例程\##matplotlib\PDF教程\DOC\image-20200706212610924.png)
22+
23+
`plt.scatter`不仅允许我们绘制 x 和 y ,而且还可以让我们决定所使用的标记颜色,大小和类型。 有一堆标记选项,请参阅 ==Matplotlib 标记文档==中的所有选项。下一节讲饼图。
24+
25+
26+
27+
# 饼图
28+
29+
饼图通常以%为单位,但是matplotlib可以自动处理,我们只需要提供数值
30+
31+
实例代码:
32+
33+
```python
34+
import matplotlib.pyplot as plt
35+
slices = [7,2,2,13]
36+
activities = ['sleeping','eating','working','playing']
37+
cols = ['c','m','r','b']
38+
plt.pie(slices,
39+
labels=activities,
40+
colors=cols,
41+
startangle=90,
42+
shadow= True,
43+
explode=(0,0.1,0,0),
44+
autopct='%1.1f%%')
45+
plt.title('Interesting Graph\nCheck it out')
46+
plt.show()
47+
```
48+
49+
运行结果:
50+
51+
![image-20200707143049857](F:\Coding-Thomas\Coding-Notes\Python-Notes\例程\##matplotlib\PDF教程\DOC\image-20200707143049857.png)
52+
53+
详细解释:
54+
55+
+ `slices`用来存储切片大小,睡觉占7份,玩占13份
56+
+ `activities`列表存储名称,最后放到标签中
57+
+ `cols`存储颜色名称,标记每一片的颜色。matplotlib中的颜色还可以是一个字母的,也可以是全称,也可以是十六进制,但是单个字母不全也不好记,在文章最后给一个参考图
58+
+ `shadow`就是阴影,`True`为开启,`False`为关闭
59+
+ `explode`可以拉出一个切片,样例中`(0,0.1,0,0)`设置第二个切片就是eating部分拉出0.1距离。
60+
+ `autopct`最后将百分比放置在切片上
61+
62+
63+
64+
颜色表:
65+
66+
![img](https://upload-images.jianshu.io/upload_images/7017253-6edec09676cc466d.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import matplotlib.pyplot as plt
2+
plt.bar([1, 3, 5, 7, 9], [5, 2, 7, 8, 2], label="Example one")
3+
plt.bar([2, 4, 6, 8, 10], [8, 6, 2, 5, 6], label="Example two", color='g')
4+
plt.legend()
5+
plt.xlabel('bar number')
6+
plt.ylabel('bar height')
7+
plt.title('Epic Graph\nAnother Line! Whoa')
8+
plt.show()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import matplotlib.pyplot as plt
2+
x = [1,2,3,4,5,6,7,8]
3+
y = [5,2,4,2,1,4,5,2]
4+
plt.scatter(x,y, label='skitscat', color='k', s=25, marker="o")
5+
plt.xlabel('x')
6+
plt.ylabel('y')
7+
plt.title('Interesting Graph\nCheck it out')
8+
plt.legend()
9+
plt.show()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import matplotlib.pyplot as plt
2+
slices = [7, 2, 2, 13]
3+
activities = ['sleeping', 'eating', 'working', 'playing']
4+
cols = ['c', 'm', 'r', 'b']
5+
plt.pie(slices, labels=activities, colors=cols, startangle=90, shadow=True, explode=(0, 0.1, 0, 0), autopct='%1.1f%%')
6+
plt.title('Interesting Graph\nCheck it out')
7+
plt.show()
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from tkinter import *
2+
def calculate():
3+
result=eval(equ.get())
4+
equ.set(equ.get()+"=\n"+str(result))
5+
def show(buttonString):
6+
content=equ.get()
7+
if content=="0":
8+
content=""
9+
equ.set(content+buttonString)
10+
root = Tk()
11+
root.title("计算器")
12+
equ=StringVar()
13+
equ.set("0")
14+
label=Label(root, width=25, height=2, relief=RAISED, anchor=SE,
15+
textvariable=equ)
16+
label.grid(row=0, column=0, columnspan=4, padx=5, pady=5)
17+
clearButton=Button(root, text="C",fg="blue",width=5,command=lambda:equ.set("0"))
18+
clearButton.grid(row=1, column=0)
19+
Button(root, text="DEL",width=5,command=lambda:equ.set(str(equ.get()[:-1]))).grid(row=1,column=1)
20+
Button(root, text="%", width=5, command=lambda:show("%")).grid(row=1,column=2)
21+
Button(root, text="/", width=5, command=lambda:show("/")).grid(row=1,column=3)
22+
Button(root, text="7", width=5, command=lambda:show("7")).grid(row=2,column=0)
23+
Button(root, text="8", width=5, command=lambda:show("8")).grid(row=2,column=1)
24+
Button(root, text="9", width=5, command=lambda:show("9")).grid(row=2,column=2)
25+
Button(root, text="*", width=5, command=lambda:show("*")).grid(row=2,column=3)
26+
Button(root, text="4", width=5, command=lambda:show("4")).grid(row=3,column=0)
27+
Button(root, text="5", width=5, command=lambda:show("5")).grid(row=3,column=1)
28+
Button(root, text="6", width=5, command=lambda:show("6")).grid(row=3,column=2)
29+
Button(root, text="-", width=5, command=lambda:show("-")).grid(row=3,column=3)
30+
Button(root, text="1", width=5, command=lambda:show("1")).grid(row=4,column=0)
31+
Button(root, text="2", width=5, command=lambda:show("2")).grid(row=4,column=1)
32+
Button(root, text="3", width=5, command=lambda:show("3")).grid(row=4,column=2)
33+
Button(root, text="+", width=5, command=lambda:show("+")).grid(row=4, column=3)
34+
Button(root, text="0", width=5, command=lambda:show("0")).grid(row=5,column=0,columnspan=2)
35+
Button(root, text=".", width=5, command=lambda:show(".")).grid(row=5,column=2)
36+
Button(root, text="=", width=5, command=lambda:calculate()).grid(row=5,column=3)
37+
root.mainloop()

0 commit comments

Comments
 (0)