#!/usr/bin/env python3
#-*- coding:utf-8 -*-
############################
#File Name: polar.py
#Author: frank
#Mail: frank0903@aliyun.com
#Created Time:2018-05-22 22:08:01
############################ import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl plt.subplot(111, polar=True)
plt.savefig('create_polar.jpg')
plt.show()

从上图可以看出,默认极坐标系的 极角显示刻度为(0, 360,45),极径显示刻度为(0,1.0,0.2),0度的方向为“E”,默认极坐标的方向是逆时针方向。

那么,

1. 怎么设置极坐标系的方向?

2. 怎么设置极坐标(ρ, 0)的起始位置?

3. 怎样设置极坐标系 的极角网格线(thetagrids)上的 显示刻度?

4. 怎样设置极坐标系 的极径网格线上(rgrids)的 显示刻度?

在平面内取一个定点O,叫极点,引一条射线Ox,叫做极轴,再选定一个长度单位和角度的正方向(通常取逆时针方向)。对于平面内任何一点M,用ρ表示线段OM的长度(有时也用r表示),θ表示从Ox到OM的角度,ρ叫做点M的极径,θ叫做点M的极角,有序数对 (ρ,θ)就叫点M的极坐标,这样建立的坐标系叫做极坐标系。通常情况下,M的极径坐标单位为1(长度单位),极角坐标单位为rad(或°)。(reference:https://baike.baidu.com/item/%E6%9E%81%E5%9D%90%E6%A0%87/7607962?fr=aladdin

matplotlib.pyplot.subplot(*args**kwargs)

Return a subplot axes at the given grid position.

subplot(nrows, ncols, index, **kwargs)

In the current figure, create and return an Axes, at position index of a (virtual) grid of nrows by ncols axes. Indexes go from 1 to nrows *ncols, incrementing in row-major order.

If nrowsncols and index are all less than 10, they can also be given as a single, concatenated, three-digit number.

For example, subplot(2, 3, 3) and subplot(233) both create an Axes at the top right corner of the current figure, occupying half of the figure height and a third of the figure width.

nrows, ncols, index表示在当前figure中,每个subplot的位置。

如果nrows,ncols and index 都小于10,那么可以将 nrow,ncols,index三个数组合成一个数来表示subplot的位置。例如subplot(2,3,3)等价于subplot(233),这个subplot位于当前figure的右上角,其高度占整个figure的一半,其宽度占整个figure的三分之一。

Note:

Creating a subplot will delete any pre-existing subplot that overlaps with it beyond sharing a boundary:

import matplotlib.pyplot as plt
# plot a line, implicitly creating a subplot(111)
plt.plot([1,2,3])
# now create a subplot which represents the top plot of a grid
# with 2 rows and 1 column. Since this subplot will overlap the
# first, the plot (and its axes) previously created, will be removed
plt.subplot(211)
plt.plot(range(12))
plt.subplot(212, facecolor='y') # creates 2nd subplot with yellow background

If you do not want this behavior, use the add_subplot() method or the axes() function instead.

在同一个figure中,如果之前已经创建了一个subplot0(如plt.plot([1,2,3])),然后有创建另一个subplot1(如plt.subplot(211)),那么sunplot1会将subplot0覆盖掉。

如果想避免这种情况发生,可以使用add_subplot()函数或axes()函数。

Keyword arguments:

facecolor:  The background color of the subplot, which can be any valid color specifier. See matplotlib.colors for more information.

  指定subplot的背景颜色。

polar:  A boolean flag indicating whether the subplot plot should be a polar projection. Defaults to False.

  指定subplot是否为极坐标

projection:  A string giving the name of a custom projection to be used for the subplot. This projection must have been previously registered. See matplotlib.projections.

    

参考资料:https://matplotlib.org/api/_as_gen/matplotlib.pyplot.subplot.html?highlight=subplot#matplotlib.pyplot.subplot

matplotlib之创建极坐标系的更多相关文章

  1. Python可视化学习(2):Matplotlib快速绘图基础

    Matplotlib将大部分的绘图对象都封装成为对象,故理论上所有的图表元素(如Line2D, Text,Label等)都是对象,都可以将其在图表中提取出来并配置实例的属性.同时,Matplotlib ...

  2. matplotlib初识

    Matplotlib 能够创建多数类型的图表,如条形图,散点图,条形图,饼图,堆叠图,3D 图和地图图表. import matplotlib.pyplot as plt plt.plot([,,], ...

  3. python数据分析scipy和matplotlib(三)

    Scipy 在numpy基础上增加了众多的数学.科学及工程常用的库函数: 线性代数.常微分方程求解.信号处理.图像处理.稀疏矩阵等: Matplotlib 用于创建出版质量图表的绘图工具库: 目的是为 ...

  4. Python学习笔记:Matplotlib(数据可视化)

    Matplotlib是一个可以将数据绘制为图形表示的Python三方库,包括线性图(折线图,函数图).柱形图.饼图等基础而直观的图形,在平常的开发当中需要绘图时就非常有用了. 安装:pip insta ...

  5. python使用matplotlib在一个图形中绘制多个子图以及一个子图中绘制多条动态折线问题

    在讲解绘制多个子图之前先简单了解一下使用matplotlib绘制一个图,导入绘图所需库matplotlib并创建一个等间隔的列表x,将[0,2*pi]等分为50等份,绘制函数sin(x).当没有给定x ...

  6. (数据科学学习手札128)在matplotlib中添加富文本的最佳方式

    本文示例代码及文件已上传至我的Github仓库https://github.com/CNFeffery/DataScienceStudyNotes 1 简介 长久以来,在使用matplotlib进行绘 ...

  7. 《利用Python进行数据分析》第8章学习笔记

    绘图和可视化 matplotlib入门 创建窗口和画布 fig = plt.figure() ax1 = fig.add_subplot(2,2,1) ax2 = fig.add_subplot(2, ...

  8. 六行python代码的爱心曲线

    前些日子在做绩效体系的时候,遇到了一件囧事,居然忘记怎样在Excel上拟合正态分布了,尽管在第二天重新拾起了Excel中那几个常见的函数和图像的做法,还是十分的惭愧.实际上,当时有效偏颇了,忽略了问题 ...

  9. Ubuntu安装Jupyter Notebook

    一.Jupyter介绍 Jupyter Notebook是一个交互式笔记本,支持运行40多种编程语言.Jupyter Notebook 的本质是一个 Web 应用程序,便于创建和共享文学化程序文档,支 ...

随机推荐

  1. html模板与json数据交互

    阅读这篇文章后,对html和json有很大的启发: http://www.zhangxinxu.com/wordpress/2012/09/javascript-html-json-template/ ...

  2. python笔记10-多线程之线程同步(锁lock)

    前言 关于吃火锅的场景,小伙伴并不陌生,吃火锅的时候a同学往锅里下鱼丸,b同学同时去吃掉鱼丸,有可能会导致吃到生的鱼丸. 为了避免这种情况,在下鱼丸的过程中,先锁定操作,让吃火锅的小伙伴停一会,等鱼丸 ...

  3. openwrt开源系统LUCI配置界面

    转自:http://www.right.com.cn/forum/thread-131035-1-1.html 本人菜鸟,最近在学习这方面的知识,在参考资料的基础上总结如下内容.这篇文章针对如何对op ...

  4. SQL locate()函数

    LOCATE(substr,str), LOCATE(substr,str,pos) 第一个语法返回字符串str第一次出现的子串substr的位置. 第二个语法返回第一次出现在字符串str的子串sub ...

  5. Linq:Group By用法

    1.简单形式: var q =from p in db.Products group p by p.CategoryID into g select g; 语句描述:使用Group By按Catego ...

  6. android4.1 JELLY_BEAN:All WebView methods must be called on the same thread[问题已解决]

    11-06 18:29:15.582: W/WebView(27807): java.lang.Throwable: A WebView method was called on thread 'Ja ...

  7. 新手遇到的问题:Easy UI的对话框老是在页面载入完毕后自己主动弹出

    因为是第一次接触Easy UI,还不是非常熟悉,尝试了一下对话框功能,还是非常不错的.但问题是页面载入完毕后.全部的对话框都自己主动弹出来了,百度了好久,也没有详细说明确的,貌似别人都没有这个问题哦 ...

  8. java中int取值范围是怎么计算的?

    首先jdk中定义int占4个字节 ===> 32位(后面全部的计算都是以此为根据的) 32位就是jvm仅仅给分配32个格子的空间,用以存放数据. 总所周知计算机中用0和1存放数据. 那么,32个 ...

  9. QT5.11下载与安装教程

    一.QT软件下载 Qt 5.9 之后的安装包与之前相比,不再区分 VS 版本和 MinGW 版本,而是全都整合到了一个安装包中.因此,与之前的安装包相比,体积也是大了不少,以前是 1G 多,现在是 2 ...

  10. deferred rendering with msaa

    https://docs.nvidia.com/gameworks/content/gameworkslibrary/graphicssamples/d3d_samples/antialiasedde ...