24 lines
488 B
Python
24 lines
488 B
Python
|
import numpy as np
|
||
|
import matplotlib.pyplot as plt
|
||
|
|
||
|
height = 10
|
||
|
radius = 2
|
||
|
base_radius = 0.5
|
||
|
base_length = 1.0
|
||
|
|
||
|
x_base = np.linspace(0, base_length, 10)
|
||
|
y_base = base_radius*np.ones(x_base.shape[0])
|
||
|
|
||
|
x_lamp = np.linspace(base_length, height, 100)
|
||
|
y_lamp = base_radius + ((x_lamp)/height)*(radius-base_radius)
|
||
|
|
||
|
x = np.append(x_base, x_lamp)
|
||
|
y = np.append(y_base, y_lamp)
|
||
|
plt.plot(x, y)
|
||
|
|
||
|
axes = plt.gca()
|
||
|
axes.set_xlim([0, 1.1*base_length+height])
|
||
|
axes.set_ylim([0,1.1*radius])
|
||
|
|
||
|
plt.show()
|