[Solved] rqt_graph Skipped loading plugin with error & Format: “dot“ not recognized

rqt_graph run error:

[ERROR] [1637910144.803564743]: Skipped loading plugin with error: XML Document '/opt/ros/melodic/share/rqt_virtual_joy/plugin.xml' has no Root Element. This likely means the XML is malformed or missing..
RosPluginProvider._parse_plugin_xml() plugin file "/opt/ros/melodic/share/rqt_virtual_joy/plugin.xml" in package "rqt_virtual_joy" not found
RosPluginProvider._parse_plugin_xml() plugin file "/opt/ros/melodic/share/rqt_virtual_joy/plugin.xml" in package "rqt_virtual_joy" not found
['dot', '-Tdot', '/tmp/tmpVMQLCN'] return code: 1
stdout, stderr:

Format: "dot" not recognized. Use one of:
Traceback (most recent call last):
File "/opt/ros/melodic/lib/python2.7/dist-packages/rqt_graph/ros_graph.py", line 289, in _refresh_rosgraph
self._update_graph_view(self._generate_dotcode())
File "/opt/ros/melodic/lib/python2.7/dist-packages/rqt_graph/ros_graph.py", line 324, in _generate_dotcode
hide_dynamic_reconfigure=hide_dynamic_reconfigure)
File "/opt/ros/melodic/lib/python2.7/dist-packages/rqt_graph/dotcode.py", line 914, in generate_dotcode
dotcode = dotcode_factory.create_dot(dotgraph)
File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_dotgraph/pydotfactory.py", line 175, in create_dot
dot = graph.create_dot()
File "/usr/lib/python2.7/dist-packages/pydot.py", line 1681, in <lambda>
self.create(format=f, prog=prog))
File "/usr/lib/python2.7/dist-packages/pydot.py", line 1900, in create
assert p.returncode == 0, p.returncode
AssertionError: 1
[1]    22100 abort (core dumped)  rqt_graph

The above message contains two errors.
One is that the plugin file is missing. Solution.
Create a new file plugin.xml in the /opt/ros/melodic/share/rqt_virtual_joy/ path and write the contents of the file.

<library path="src">
  <class name="My Plugin" type="rqt_virtual_joy.virtual_joy_module.MyPlugin" base_class_type="rqt_gui_py::Plugin">
    <description>
      An example Python GUI plugin to create a great user interface.
    </description>
    <qtgui>

      <group>
        <label>Robot Tools</label>
      </group>
      <!-- <group>
        <label>Subgroup</label>
      </group> -->

      <label>Virtual Joystick</label>
      <icon type="file">resource/input-gaming.png</icon>
      <statustip>Great user interface to provide real value.</statustip>
    </qtgui>
  </class>
</library>

Save and exit to fix problem 1;

The second problem is dot format recognition. Execute the command:

sudo dot -c

Read More: