python 画园和椭圆,,from matpl
python 画园和椭圆,,from matpl
from matplotlib.patches import Ellipse, Circleimport matplotlib.pyplot as pltfig = plt.figure()ax = fig.add_subplot(111)ell1 = Ellipse(xy = (0.0, 0.0), width = 10, height = 5, angle = 0.0, facecolor= ‘yellow‘, alpha=0.3)cir1 = Circle(xy = (0.0, 0.0), radius=2, alpha=0.5)ax.add_patch(ell1)ax.add_patch(cir1)x, y = 0, 0ax.plot(x, y, ‘ro‘)plt.axis(‘scaled‘)ax.spines[‘right‘].set_color(‘none‘) # 设置右‘脊梁’为无色ax.spines[‘top‘].set_color(‘none‘) # 设置上‘脊梁’为无色ax.xaxis.set_ticks_position(‘bottom‘) # 底部‘脊梁’设置为X轴ax.spines[‘bottom‘].set_position((‘data‘, 0)) # 底部‘脊梁’移动位置,y的dataax.yaxis.set_ticks_position(‘left‘) # 左部‘脊梁’设置为Y轴ax.spines[‘left‘].set_position((‘data‘, 0)) # 左部‘脊梁’移动位置,x的dataplt.savefig(‘d:/test2.png‘)#plt.axis(‘equal‘) #changes limits of x or y axis so that equal increments of x and y have the same lengthplt.show()
来自:https://www.cnblogs.com/yibeimingyue/p/9916048.html
from matplotlib.patches import Ellipse, Circle
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ell1 = Ellipse(xy = (0.0, 0.0), width = 10, height = 5, angle = 0.0, facecolor= ‘yellow‘, alpha=0.3)
cir1 = Circle(xy = (0.0, 0.0), radius=2, alpha=0.5)
ax.add_patch(ell1)
ax.add_patch(cir1)
x, y = 0, 0
ax.plot(x, y, ‘ro‘)
plt.axis(‘scaled‘)
ax.spines[‘right‘].set_color(‘none‘) # 设置右‘脊梁’为无色
ax.spines[‘top‘].set_color(‘none‘) # 设置上‘脊梁’为无色
ax.xaxis.set_ticks_position(‘bottom‘) # 底部‘脊梁’设置为X轴
ax.spines[‘bottom‘].set_position((‘data‘, 0)) # 底部‘脊梁’移动位置,y的data
ax.yaxis.set_ticks_position(‘left‘) # 左部‘脊梁’设置为Y轴
ax.spines[‘left‘].set_position((‘data‘, 0)) # 左部‘脊梁’移动位置,x的data
plt.savefig(‘d:/test2.png‘)
#plt.axis(‘equal‘) #changes limits of x or y axis so that equal increments of x and y have the same length
plt.show()
python 画园和椭圆
相关内容
- Windows安装Python3,,下载1.官网下载需要
- python (turtle)画五环,,实现代码:impor
- cmd如何进入和退出Python编程环境?,,cmd里面进入pyt
- python3 笔记,,.1# 数的定义:#
- python并发编程:异步IO(Asynchronous I/O),,异步IO(Async
- python之网络编程,,TCP编程——htt
- python3 str和bytes之间转换,, a bytes-
- 2. Python中的基本输入、输出、格式化,,本文利用的是
- python3版 2048(修改于python2版),,就不上源码了,直接
- python mysql安装,,本文主要介绍不同系统
评论关闭