Hi, 

I know this could be a stupid question, but as I am new with this toolbox 
and with the python programming, it is not trivial for me. 
I am loading some data, and I end up with 3 pair of vectors x and y 
containing the data i want to plot. the result are three lines in the plot. 
And everything is fine so far. 

However i would like to change the grid parameters, for having a 
customizable x and y spacing for the grid. If possible, I also would like 
to change the "markerSize" of the 
lines, to have them more clear and visible.

This is my code:


#!/usr/bin/env python

# modules
# ROS stuff and multithreading
import rospy
import rosbag
import sys
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg




if __name__ == '__main__':

    rospy.init_node('plotting')

    #   Open the required bag file
    bag = rosbag.Bag( sys.argv[1] )

    #   Obatin the real path that the robot has followed
    x_real = []
    y_real = []
    for topic, robot, t in bag.read_messages(topics=['/RobotPosture']):
        x_real.append(robot.position.x)
        y_real.append(robot.position.y)

    #   Obtain an estimation of the path odometry based
    x_odom = []
    y_odom = []
    for topic, odom, t in bag.read_messages(topics=['/RobotOdometry']):
        x_odom.append(odom.pose.pose.position.x)
        y_odom.append(odom.pose.pose.position.y)

    #   Obain the path that the estimator has computed
    x_estm = []
    y_estm = []
    for topic, estm, t in bag.read_messages(topics=['/EstimatedPosture']):
        x_estm.append(estm.pose.position.x)
        y_estm.append(estm.pose.position.y)

    #   Obtain information about the measurements
    x_m = []
    y_m = []
    for topic, meas, t in bag.read_messages(topics=['/Measurements']):
        x_m.append(meas.pose.position.x)
        y_m.append(meas.pose.position.y)

    #   No need of the bag file anymore
    bag.close()

    #   Start the console
    app = QtGui.QApplication([])

    #   Create a window
    win = pg.GraphicsWindow(title="Trajectories, measurements and 
distances")
    win.resize(1000,600)
    win.setWindowTitle('Trajectories, measurements and distances')

    #   Enable antialiasing for prettier plots
    pg.setConfigOptions(antialias=True)

    p1 = win.addPlot(title="Trajectories")
    p1.addLegend()
    p1.plot(x_real, y_real, pen=(255,0,0), name="Real path")
    p1.plot(x_odom, y_odom, pen=(0,255,0), name="Odometry path")
    p1.plot(x_estm, y_estm, pen=(0,0,255), name="Estimated path")
    p1.plot(x_m, y_m, pen=None, symbol='o')
    p1.setLabel('left', "Y Axis", units='m')
    p1.setLabel('bottom', "X Axis", units='m')
    p1 = pg.gridItem().setTickSpacing(x=[1.0], y=[1.0])
    p1.showGrid(x=True, y=True)



    QtGui.QApplication.instance().exec_()

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/a612286a-97ad-4c0c-acb2-370fb20bb528o%40googlegroups.com.

Reply via email to