https://github.com/yuricst/trajplotlib
matplotlib extension functions to plot trajectories
https://github.com/yuricst/trajplotlib
Last synced: about 1 year ago
JSON representation
matplotlib extension functions to plot trajectories
- Host: GitHub
- URL: https://github.com/yuricst/trajplotlib
- Owner: Yuricst
- License: mit
- Created: 2021-07-19T08:50:40.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-06-24T19:51:36.000Z (almost 4 years ago)
- Last Synced: 2025-02-09T20:39:12.917Z (over 1 year ago)
- Language: Python
- Size: 721 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trajplotlib
matplotlib extension functions to plot trajectories
[](https://trajplotlib.readthedocs.io/en/latest/?badge=latest)
Dependencies: Python>=3.7, Matplotlib, numpy
### 3D trajectory with equal size axes
To generate a quick 3D trajectory plot with equal-axis is a one-liner:
```python
import matplotlib.pyplot as plt
import trajplotlib
# compute/load data for xs, ys, zs
# create plot
fig, ax = trajplotlib.quickplot3(xs, ys, zs, radius=184.0)
plt.show()
```
In the above, `xs`, `ys`, and `zs` are arrays of the trajectory coordinates, and `radius` is an optional value for plotting a sphere of radius `radius`.
This generates the following:
The above function returns `ax`, which is an `Axes3DSubplot` object. As such, the plot may be modified or more elements may be appended just as one would do with regular `matplotlib`:
```python
ax.set_xlabel('x, km')
ax.set_ylabel('y, km')
ax.set_zlabel('z, km')
ax.set_title("My trajectory")
```