ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to plot histogram or 1D using a ros node in c++?

asked 2015-09-27 17:02:23 -0500

Tom Iancovici gravatar image

updated 2015-09-27 20:19:36 -0500

I haven't had luck finding an answer to this. I understand there's a somewaht convenient way to plot data in a python written node using matplotlib.

I'm hoping to plot a histogram with a 600 bins, and range 0 to 1.0, by taking an exisiting 600 element array with values between that range.

I've tried digging into rxplot, and matplotlib, and I'm starting to think I'll either have to use a regular c++ plugin or have to end up writing a plotting node in python that subscribes for a topic to get the array data.

I've tried creating a new topic, /array. Where I submit flot32multiarray, float-data-type arrays with 600 elements to plot then in cmd prompt called rosrun rqt_plot /array, or inside, but that doens't seem to work either.

Any tips or advice?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-09-29 08:21:37 -0500

Airuno2L gravatar image

Histograms are really easy using matplotlib. Here is an example. There are even more examples on the matplotlib site.

edit flag offensive delete link more


Please read the question before attempting to answer, thanks.

Tom Iancovici gravatar image Tom Iancovici  ( 2015-09-29 09:17:15 -0500 )edit

Hmm, I read it twice more. I must be missing something. It sounds like you're considering writing a node in python to grab an array of data and plot a histogram of that. I'm agreeing that it would be easy to do with python using matplotlib. Could you clarify why this answer doesn't help?

Airuno2L gravatar image Airuno2L  ( 2015-09-29 11:43:06 -0500 )edit

Question Tools

1 follower


Asked: 2015-09-27 17:02:23 -0500

Seen: 1,147 times

Last updated: Sep 29 '15