Set the number of pixels corresponding to the actual distance of the scatter plot

As the title
I have recorded a rosbag, there are a lot of PointCloud points in the bag.And every points has (x,y,z),the unit is meter in reality.
What I want is to set the number of pixels corresponding one meter in reality.
e.x: I set 10 pixels per meter in width,and 5 pixels per meter in hight. My rosbag was recorded in a room 5 meters long and 5 meters width.So the result of my final plot should be a png with a width of 50 and with a hight of 25.
Do you have any experience or method?

The size of the figure is specified in inches. The size of the figure in pixels is given by its size times its DPI (dots per inch). To make a figure with a specific size in pixels, choose a suitable combination of figure size and DPI, e.g., 50x25 pixels could be figsize=(0.5, 0.25), dpi=100.

Just adding an equivalent option that I use (convenient if you don’t want to manually specify dpi):
fig.set_size_inches(50 / fig.dpi, 25 / fig.dpi)