Using the plot from the Wikipedia Patch antenna page as an example, how is the 9dBi value obtained? It looks like the radiation is barely higher than 0dBi at the strongest location.
dBi means "Decibels referred to an isotropic radiator," in the same way that dBm means "Decibels referred to 1 milliwatt." In other words, an antenna that radiates a power of 0 dBi in a particular direction is radiating the same power as a perfectly isotropic radiator in that direction. However, when we talk about antennas, a gain of X dBi means that the power radiated in the direction of maximum radiation is "X dB referenced to an isotropic radiator".
The picture you linked from Wikipedia can't be used to directly derive the gain of the antenna with respect to an isotropic antenna. It just shows the antenna's radiation pattern, scaled by an arbitrary amount. It does not show the radiation pattern of an isotropic antenna. There is no such thing as an isotropic antenna, but if there was, it's radiation pattern would be a circle centered at the origin of the plot, with a radius of -9 dB.
Why -9 dB? Because the antenna under discussion apparently has a gain in the forward direction of 9 dBi, and the author arbitrarily (though conventionally) chose to call the maximum radiation of this antenna 0 dB. He could have chosen to call the maximum 9 dB, in which case the radius of the isotropic antenna would be 0 dB.
How could you derive the gain? An isotropic antenna radiates equally in all directions (that's the definition of an isotropic antenna), so the average power per unit solid angle (steradian) is the same as the "instantaneous" power per unit solid angle. The gain of an antenna is just the amount of power in the direction of maximum radiation divided by the average power (so it is unitless). If the radiation pattern has cylindrical symmetry about the axis of maximum radiation, you can integrate it to get the total power (in picture Decibels). You could then compute the average power (total power divided by 4 pi). In this case you would get -9 dB for the average power per steradian.
The point about symmetry is important. Many antennas are not symmetric in this way (for example a Yaggi), which means that you really need a mathematical formula for radiation as a function two angles in order to integrate correctly.