The source code for the rviz_plugin_tutorials package can be downloaded from the chapter3_tutorials/rviz_plugin_tutorials/ file, which contains the code for ImuDisplay in these files: src/imu_display.h, src/imu_display.cpp, src/imu_visual.h, and src/imu_visual.cpp.
Alternatively, we can create a package with the ImuDisplay plugin and add the source code in the respective files:
$ catkin_create_pkg rviz_plugin_tutorials roscpp rviz std_msgs
The open source code is self-explanatory.