[Python] How to plot coordinates (1,2) against time (0.5) in python

Discussão em 'Python' iniciado por Stack, Junho 4, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to plot vehicle position (coordinates - x,y) against time(1s,2s,3s...). I tried with matplotlib but could not succeed. I am new in python. Could anyone help me please.

    My code:

    import matplotlib.pyplot as plt
    import numpy as np

    coordinate = [[524.447876,1399.091919], [525.1377563,1399.95105], [525.7932739,1400.767578], [526.4627686,1401.601563],
    [527.2360229,1402.564575], [527.8989258,1403.390381], [528.5689697,1404.224854]]

    timestamp =[0,0.05,0.1,0.15,0.2,0.25,0.3]

    plt.plot(coordinate,timestamp)


    Plot comes like: But this is wrong one. I did wrong.

    [​IMG]

    Plot supposed to become, in particular, timestamp (1s) the vehicle position is (x,y). So there should be one line just like vehicle trajectory.

    Thanks.

    Continue reading...

Compartilhe esta Página