Robotics StackExchange | Archived questions

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

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?

Asked by Tom Iancovici on 2015-09-27 17:02:23 UTC

Comments

Answers

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

Asked by Airuno2L on 2015-09-29 08:21:37 UTC

Comments

Please read the question before attempting to answer, thanks.

Asked by Tom Iancovici on 2015-09-29 09:17:15 UTC

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?

Asked by Airuno2L on 2015-09-29 11:43:06 UTC