Issue
I have some text file which describes antenna pattern and I convert it to arr in Python.
[0.03, 0.05, 0.15, 0.28, 0.42, 0.58, 0.79, 1.03, 1.33, 1.63, 2.02, 2.35, 2.74, 3.24, 3.75, 4.25, 4.83, 5.48, 6.23, 7.08, 8.07, 9.05, 10.21, 11.53, 13.17, 14.73, 16.52, 18.6, 20.83, 21.32, 21.46, 21.05, 20.56, 19.37, 18.86, 17.82, 16.87, 15.98, 15.71, 15.35, 14.78, 14.52, 14.28, 13.94, 13.7, 13.34, 13.27, 12.9, 12.79, 12.75, 12.52, 12.4, 12.31, 12.37, 12.26, 12.34, 12.28, 12.36, 12.46, 12.61, 12.77, 13.03, 13.17, 13.39, 13.59, 13.81, 14.13, 14.46, 14.79, 15.1, 15.32, 15.65, 15.84, 16.16, 16.22, 16.55, 16.81, 17.12, 17.29, 17.39, 17.84, 17.93, 18.19, 18.45, 18.82, 19.15, 19.51, 19.91, 20.47, 20.94, 22.15, 22.54, 22.76, 23.2, 23.26, 23.39, 23.72, 23.77, 23.61, 24.31, 24.3, 24.56, 24.95, 25.45, 26.24, 26.87, 27.63, 28.61, 29.35, 29.9, 28.6, 28.11, 26.99, 26.55, 26.1, 25.7, 25.26, 24.68, 24.65, 24.02, 23.47, 23.28, 22.9, 22.3, 21.87, 21.84, 21.24, 21.21, 20.95, 21.2, 21.39, 21.54, 22.08, 22.26, 22.68, 23.49, 23.9, 24.55, 25.35, 26.27, 27.53, 29.0, 30.36, 31.58, 31.07, 31.34, 29.37, 28.46, 26.89, 25.95, 24.88, 23.86, 22.95, 22.55, 22.12, 21.61, 21.12, 20.73, 20.19, 19.77, 19.39, 19.21, 18.89, 18.81, 18.75, 18.54, 18.54, 18.45, 18.39, 18.28, 17.99, 17.82, 17.72, 17.41, 17.09, 16.83, 16.87, 16.65, 16.58, 16.51, 16.32, 16.14, 16.24, 16.2, 15.95, 16.09, 16.04, 15.98, 16.22, 16.29, 16.48, 16.68, 17.02, 17.23, 17.45, 17.76, 17.99, 17.97, 18.17, 18.13, 18.13, 18.33, 18.46, 18.99, 19.35, 19.84, 20.61, 21.66, 22.37, 23.27, 24.02, 24.29, 24.57, 24.51, 24.32, 24.29, 23.99, 23.46, 23.27, 23.13, 22.91, 23.08, 23.29, 23.82, 24.37, 24.98, 25.8, 26.64, 27.44, 28.07, 28.82, 29.21, 28.7, 27.99, 27.29, 26.27, 25.76, 25.13, 24.57, 24.04, 23.7, 23.3, 22.94, 22.53, 22.22, 22.02, 21.77, 21.46, 21.31, 21.26, 21.28, 21.55, 21.69, 21.82, 22.06, 22.46, 22.8, 23.18, 23.47, 23.92, 24.13, 24.56, 24.71, 25.0, 24.98, 25.04, 25.35, 25.4, 25.03, 25.32, 24.68, 24.27, 23.86, 23.32, 22.91, 22.45, 22.25, 21.65, 21.48, 21.33, 21.17, 21.18, 21.13, 21.05, 21.1, 21.1, 21.04, 20.98, 20.79, 20.31, 19.84, 19.47, 19.08, 18.7, 18.4, 18.03, 17.68, 17.46, 17.23, 16.94, 16.72, 16.54, 16.34, 16.28, 16.12, 15.93, 15.94, 16.02, 16.01, 16.04, 16.16, 16.29, 16.46, 16.78, 16.94, 17.29, 17.51, 17.96, 18.12, 18.45, 18.71, 19.12, 19.48, 19.65, 19.64, 19.73, 19.59, 19.62, 19.4, 19.29, 19.09, 18.79, 18.25, 16.87, 15.23, 13.69, 12.45, 11.0, 9.88, 8.66, 7.78, 6.73, 5.91, 5.06, 4.3, 3.57, 2.98, 2.45, 2.0, 1.59, 1.26, 0.97, 0.77, 0.58, 0.41, 0.24, 0.15, 0.09, 0.0, 0.03]
The first item its on 0 deg and the last is 359 deg. The Gain is 13.04 , I tried to plot it with Python but I failed and I am requesting help to plot it like that:
Solution
You need a polar projection:
import matplotlib.pyplot as plt
import numpy as np
data = [0.03, 0.05, 0.15, 0.28, 0.42, 0.58, 0.79, 1.03, 1.33, 1.63, 2.02, 2.35, 2.74, 3.24, 3.75, 4.25, 4.83, 5.48, 6.23, 7.08, 8.07, 9.05, 10.21, 11.53, 13.17, 14.73, 16.52, 18.6, 20.83, 21.32, 21.46, 21.05, 20.56, 19.37, 18.86, 17.82, 16.87, 15.98, 15.71, 15.35, 14.78, 14.52, 14.28, 13.94, 13.7, 13.34, 13.27, 12.9, 12.79, 12.75, 12.52, 12.4, 12.31, 12.37, 12.26, 12.34, 12.28, 12.36, 12.46, 12.61, 12.77, 13.03, 13.17, 13.39, 13.59, 13.81, 14.13, 14.46, 14.79, 15.1, 15.32, 15.65, 15.84, 16.16, 16.22, 16.55, 16.81, 17.12, 17.29, 17.39, 17.84, 17.93, 18.19, 18.45, 18.82, 19.15, 19.51, 19.91, 20.47, 20.94, 22.15, 22.54, 22.76, 23.2, 23.26, 23.39, 23.72, 23.77, 23.61, 24.31, 24.3, 24.56, 24.95, 25.45, 26.24, 26.87, 27.63, 28.61, 29.35, 29.9, 28.6, 28.11, 26.99, 26.55, 26.1, 25.7, 25.26, 24.68, 24.65, 24.02, 23.47, 23.28, 22.9, 22.3, 21.87, 21.84, 21.24, 21.21, 20.95, 21.2, 21.39, 21.54, 22.08, 22.26, 22.68, 23.49, 23.9, 24.55, 25.35, 26.27, 27.53, 29.0, 30.36, 31.58, 31.07, 31.34, 29.37, 28.46, 26.89, 25.95, 24.88, 23.86, 22.95, 22.55, 22.12, 21.61, 21.12, 20.73, 20.19, 19.77, 19.39, 19.21, 18.89, 18.81, 18.75, 18.54, 18.54, 18.45, 18.39, 18.28, 17.99, 17.82, 17.72, 17.41, 17.09, 16.83, 16.87, 16.65, 16.58, 16.51, 16.32, 16.14, 16.24, 16.2, 15.95, 16.09, 16.04, 15.98, 16.22, 16.29, 16.48, 16.68, 17.02, 17.23, 17.45, 17.76, 17.99, 17.97, 18.17, 18.13, 18.13, 18.33, 18.46, 18.99, 19.35, 19.84, 20.61, 21.66, 22.37, 23.27, 24.02, 24.29, 24.57, 24.51, 24.32, 24.29, 23.99, 23.46, 23.27, 23.13, 22.91, 23.08, 23.29, 23.82, 24.37, 24.98, 25.8, 26.64, 27.44, 28.07, 28.82, 29.21, 28.7, 27.99, 27.29, 26.27, 25.76, 25.13, 24.57, 24.04, 23.7, 23.3, 22.94, 22.53, 22.22, 22.02, 21.77, 21.46, 21.31, 21.26, 21.28, 21.55, 21.69, 21.82, 22.06, 22.46, 22.8, 23.18, 23.47, 23.92, 24.13, 24.56, 24.71, 25.0, 24.98, 25.04, 25.35, 25.4, 25.03, 25.32, 24.68, 24.27, 23.86, 23.32, 22.91, 22.45, 22.25, 21.65, 21.48, 21.33, 21.17, 21.18, 21.13, 21.05, 21.1, 21.1, 21.04, 20.98, 20.79, 20.31, 19.84, 19.47, 19.08, 18.7, 18.4, 18.03, 17.68, 17.46, 17.23, 16.94, 16.72, 16.54, 16.34, 16.28, 16.12, 15.93, 15.94, 16.02, 16.01, 16.04, 16.16, 16.29, 16.46, 16.78, 16.94, 17.29, 17.51, 17.96, 18.12, 18.45, 18.71, 19.12, 19.48, 19.65, 19.64, 19.73, 19.59, 19.62, 19.4, 19.29, 19.09, 18.79, 18.25, 16.87, 15.23, 13.69, 12.45, 11.0, 9.88, 8.66, 7.78, 6.73, 5.91, 5.06, 4.3, 3.57, 2.98, 2.45, 2.0, 1.59, 1.26, 0.97, 0.77, 0.58, 0.41, 0.24, 0.15, 0.09, 0.0, 0.03]
fig = plt.figure(layout='constrained')
ax1 = fig.add_subplot(1, 2, 1, projection='polar', theta_offset=np.pi/2)
ax1.plot(np.linspace(0, 2 * np.pi, 360), data)
ax2 = fig.add_subplot(1, 2, 2)
ax2.plot(range(360), np.array(data)/max(data))
plt.show()
Answered By - Stef
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.