- 博客(10)
- 收藏
- 关注
原创 latex_子图标题带括号
Latex中,插入多张图片,作为一张图片的子图时,需要添加{subsection}包,即\usepackage{subcaption}不过,这样的子图时带括号,而引用子图时,不带括号。示例:\usepackage{subcaption}\begin{document}Reference the sub-figure in full form: \ref{sf1}.Re...
2019-04-30 22:21:35
25276
8
原创 Box plot (箱形图) 中 quartile (四分位数)原理,及python_matplotlib中Q1和Q3定义的不同
1. 首先介绍Boxplot(箱形图)的定义,这里参考:Understanding Boxplots,非常精彩的一篇介绍boxplot的博文。该图片显示的即是一个boxplot的基本组成部分,它由5个基本数值决定,即 最小值 (minimum); 下四分位数 (first quartile, Q1); 中值或中位数(median), 或第二个四分位数 (second quartile,...
2019-04-28 19:09:04
20730
6
原创 python_matplotlib中用两种方法画线性规划图
示例:假设3个函数分别为:y=-2+4x,y = 2+0.5x, y = 7 -0.3x, 现求不等式y <= -2+4x, y >= 2+0.5x, y <= 7 -0.3x包含的范围。1. 使用fill_between()函数画线性规划关于fill_between()函数,其官方文档:fill_between()根据定义,fill_between()函数是填充两...
2019-03-31 22:17:00
7005
2
原创 python_matplotlib分别使用plot()和scatter()画散点图,以及如何改变点的大小
1. 使用plot()画散点图根据关于matplotlip.pyplot的官方文档:pyplot,其plot部分的解释plot()的作用是画出线条和线条上的标记:根据pyplot的官方教学文档:Pyplot tutorial,如果不改变其默认设置,画出的是蓝色的线条,即"b-":代码示例:import numpy as npimport matplotlib.pyp...
2019-03-16 19:57:36
128666
5
原创 sagemath-list_plot()调整图例(legend)中点的数量(参考python_matplotlib)
之前用sagemath中的list_plot画二维散点图时,本来落在二维空间的就是一些离散的点,所以想加上图例(legend),在图例中显示和这些点相同的一个点,用以代表这些所有的点是表示了什么,但往往显示的是3个点,代码和效果如下:代码:a=range(10)b=range(10)plot1 = list_plot(zip(a,b),plotjoined=False,color=...
2019-03-14 22:10:42
1414
原创 Python_matplotlib图例放在外侧保存时显示不完整问题解决
上次说到的,使用如下代码保存矢量图时,放在外侧的图例往往显示不完整:import numpy as npimport matplotlib.pyplot as pltfig, ax = plt.subplots()x1 = np.random.uniform(-10, 10, size=20)x2 = np.random.uniform(-10, 10, size=20)#prin...
2019-03-07 20:12:54
25682
4
原创 Python_matplotlib保存矢量图
用python的matplotlib画出的图,一般是需要保存到本地使用的。如果是用show()展出的图,再右键保存,这样的图是失帧而非矢量的。保存矢量图的方法是使用函数savefig(),官方资料:savefig()可以看到它的参数还是很多的,但保存矢量图只需要三个参数,即fname, 文件名称,和dpi, the resolution in dots per inch (每英...
2019-03-07 20:12:46
76436
6
原创 sagemath-list_plot()改变点的大小
sagemath中,使用list_plot()函数画散点图时,默认情况下的点的大小较小。示例:a=range(10)b=(random()*20 for _ in range(10))array=[]plot1 = list_plot(zip(a,b),color=(0,.5,1),marker='o',ticks=[range(10),range(20)],legend_lab...
2018-09-11 13:15:20
15137
原创 python_matplotlib改变横坐标和纵坐标上的刻度(ticks)
用matplotlib画二维图像时,默认情况下的横坐标和纵坐标显示的值有时达不到自己的需求,需要借助xticks()和yticks()分别对横坐标x-axis和纵坐标y-axis进行设置。import numpy as npimport matplotlib.pyplot as pltx = range(1,13,1)y = range(1,13,1)plt.plot(x,y)pl...
2018-09-10 20:00:24
206479
17
原创 Python_matplotlib画图时图例说明(legend)放到图像外侧
用python的matplotlib画图时,往往需要加图例说明。如果不设置任何参数,默认是加到图像的内侧的最佳位置。import matplotlib.pyplot as pltimport numpy as npx = np.arange(10)fig = plt.figure()ax = plt.subplot(111)for i in xrange(5): ax...
2018-09-08 22:22:47
87070
7
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人