Skip to content

Auto-scale vio_visu.py axes if used with --file option and --initialScale=auto #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2025

Conversation

oseiskar
Copy link
Member

@oseiskar oseiskar commented Jul 9, 2025

No description provided.

@oseiskar oseiskar requested review from Bercon and kaatrasa July 9, 2025 15:26
import numpy as np
from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure()
ax = Axes3D(fig)
ax = Axes3D(fig, auto_add_to_figure=False)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also piggy-backing this unrelated fix to suppress a warning from Matplotlib

Comment on lines 127 to 140
if args.file:
import numpy as np
data = { c: [] for c in 'xyz' }
for vio_out in file_vio_reader(args.file):
data_loaded_from_file.append(vio_out)
pos = get_position(vio_out)
if not np.isnan(pos['x']):
for c, v in pos.items():
if not np.isnan(v):
data[c].append(v)

if len(data['x']) > 1:
scale = max([(np.max(data[c]) - np.min(data[c])) for c in 'xyz'] + [1e-10])
center = [(np.max(data[c]) + np.min(data[c]))/2 for c in 'xyz']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, the --file option can no longer be used to display data live from a pipe

parser.add_argument('--file', type=argparse.FileType('r'),
help='Read data from a JSONL file or pipe instead of displaying it live',

@oseiskar oseiskar changed the title Auto-scale vio_visu.py axes if used with --file option Auto-scale vio_visu.py axes if used with --file option and --initialScale=auto Jul 10, 2025
@oseiskar oseiskar merged commit 0774e05 into main Jul 11, 2025
@oseiskar oseiskar deleted the vio-visu-auto-scale-with-file branch July 11, 2025 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants