本文整理汇总了Python中matplotlib.testing.jpl_units.deg方法的典型用法代码示例。如果您正苦于以下问题:Python jpl_units.deg方法的具体用法?Python jpl_units.deg怎么用?Python jpl_units.deg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.testing.jpl_units
的用法示例。
在下文中一共展示了jpl_units.deg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_fill_units
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import deg [as 别名]
def test_fill_units():
from datetime import datetime
import matplotlib.testing.jpl_units as units
units.register()
# generate some data
t = units.Epoch("ET", dt=datetime(2009, 4, 27))
value = 10.0 * units.deg
day = units.Duration("ET", 24.0 * 60.0 * 60.0)
fig = plt.figure()
# Top-Left
ax1 = fig.add_subplot(221)
ax1.plot([t], [value], yunits='deg', color='red')
ax1.fill([733525.0, 733525.0, 733526.0, 733526.0],
[0.0, 0.0, 90.0, 0.0], 'b')
# Top-Right
ax2 = fig.add_subplot(222)
ax2.plot([t], [value], yunits='deg', color='red')
ax2.fill([t, t, t+day, t+day],
[0.0, 0.0, 90.0, 0.0], 'b')
# Bottom-Left
ax3 = fig.add_subplot(223)
ax3.plot([t], [value], yunits='deg', color='red')
ax3.fill([733525.0, 733525.0, 733526.0, 733526.0],
[0*units.deg, 0*units.deg, 90*units.deg, 0*units.deg], 'b')
# Bottom-Right
ax4 = fig.add_subplot(224)
ax4.plot([t], [value], yunits='deg', color='red')
ax4.fill([t, t, t+day, t+day],
[0*units.deg, 0*units.deg, 90*units.deg, 0*units.deg],
facecolor="blue")
fig.autofmt_xdate()
示例2: test_polar_units
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import deg [as 别名]
def test_polar_units():
import matplotlib.testing.jpl_units as units
from nose.tools import assert_true
units.register()
pi = np.pi
deg = units.UnitDbl(1.0, "deg")
km = units.UnitDbl(1.0, "km")
x1 = [pi/6.0, pi/4.0, pi/3.0, pi/2.0]
x2 = [30.0*deg, 45.0*deg, 60.0*deg, 90.0*deg]
y1 = [1.0, 2.0, 3.0, 4.0]
y2 = [4.0, 3.0, 2.0, 1.0]
fig = plt.figure()
plt.polar(x2, y1, color="blue")
# polar(x2, y1, color = "red", xunits="rad")
# polar(x2, y2, color = "green")
fig = plt.figure()
# make sure runits and theta units work
y1 = [y*km for y in y1]
plt.polar(x2, y1, color="blue", thetaunits="rad", runits="km")
assert_true(isinstance(plt.gca().get_xaxis().get_major_formatter(), units.UnitDblFormatter))
示例3: test_fill_units
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import deg [as 别名]
def test_fill_units():
from datetime import datetime
import matplotlib.testing.jpl_units as units
units.register()
# generate some data
t = units.Epoch("ET", dt=datetime(2009, 4, 27))
value = 10.0 * units.deg
day = units.Duration("ET", 24.0 * 60.0 * 60.0)
fig = plt.figure()
# Top-Left
ax1 = fig.add_subplot(221)
ax1.plot([t], [value], yunits='deg', color='red')
ax1.fill([733525.0, 733525.0, 733526.0, 733526.0],
[0.0, 0.0, 90.0, 0.0], 'b')
# Top-Right
ax2 = fig.add_subplot(222)
ax2.plot([t], [value], yunits='deg', color='red')
ax2.fill([t, t, t + day, t + day],
[0.0, 0.0, 90.0, 0.0], 'b')
# Bottom-Left
ax3 = fig.add_subplot(223)
ax3.plot([t], [value], yunits='deg', color='red')
ax3.fill([733525.0, 733525.0, 733526.0, 733526.0],
[0 * units.deg, 0 * units.deg, 90 * units.deg, 0 * units.deg],
'b')
# Bottom-Right
ax4 = fig.add_subplot(224)
ax4.plot([t], [value], yunits='deg', color='red')
ax4.fill([t, t, t + day, t + day],
[0 * units.deg, 0 * units.deg, 90 * units.deg, 0 * units.deg],
facecolor="blue")
fig.autofmt_xdate()
示例4: test_polar_units
# 需要导入模块: from matplotlib.testing import jpl_units [as 别名]
# 或者: from matplotlib.testing.jpl_units import deg [as 别名]
def test_polar_units():
import matplotlib.testing.jpl_units as units
units.register()
pi = np.pi
deg = units.deg
km = units.km
x1 = [pi/6.0, pi/4.0, pi/3.0, pi/2.0]
x2 = [30.0*deg, 45.0*deg, 60.0*deg, 90.0*deg]
y1 = [1.0, 2.0, 3.0, 4.0]
y2 = [4.0, 3.0, 2.0, 1.0]
fig = plt.figure()
plt.polar(x2, y1, color="blue")
# polar(x2, y1, color = "red", xunits="rad")
# polar(x2, y2, color = "green")
fig = plt.figure()
# make sure runits and theta units work
y1 = [y*km for y in y1]
plt.polar(x2, y1, color="blue", thetaunits="rad", runits="km")
assert isinstance(plt.gca().get_xaxis().get_major_formatter(),
units.UnitDblFormatter)