My question is, if the ratio changed, would they form other kind of "fractal" shapes? Does this happen between other planets? What would be the condition for the ratio so that the relative motion forms a symmetrical shape like the Cardioid in the case of Venus and Earth?
It boils down to simple remainder mathematics.
If two planets have a 13:8 resonance, then, for every 1 outer planet orbit, the inner planet moves 1 and 5/8ths times around the sun. Because both planets move in the same direction, that means the inner planet moves ahead 5/8ths of 1 orbit for every outer planet year.
5/8ths in 1 year, means the inner planet passes the outer planet every 8/5ths year, or every 1.6 years. That's the catch-up time. The formula is pretty simple: 8/(13-8) or small/(large-small).
That period is known as the synodic period of Venus viewed from Earth.
Throwing out the 13:8, because it's close but not quite right, Venus orbit is 224.701 days and Earth's orbit 365.256 days (sidereal orbits).
224.701/(365.256 - 224.701) or, 224.701 / 140.555 = 1.59867 Earth years, or 583.92 Earth days.
Venus' synodic period is listed here as 584 days - close enough.
All you need for a repeating pattern is a synodic period that's very close to a divisor of an integer and you always get that when the planets are in resonance. 1.59867 is close enough to 1.6 that 5 Venus synodic years comes very close to 8 earth years. That's what causes the pattern to repeat. 1.59867 times 5 is very close to 8. I think it misses by maybe 2.6 degrees every 8 years, but it's still close enough to have gotten the attention and admiration of the ancients.
Venus and Earth aren't really in resonance, just close. They don't have sufficient tidal forces on each other to maintain a true resonance.
The flower petal you get in your 2nd link, the 5 intersection points or meeting points, those happen in in that Spirograph like image when Earth and Venus are on opposite sides of the sun. They also happen on a 1.6 earth years and move forward 225 degrees every Earth year. It looks neat, but like a Spirograph it's a cool design based on nothing more than simple fractions.
As far as fractal, flowers are sometimes used as examples of fractal patterns, so I can see how, looking at the flower pattern, one might think it might be fractal. It's really not. Fractals are non-repeating. Kepler Orbits are repeating.
Some of Earth's Milankovich cycles may be fractal in their variation. That's another topic though.
using your 7:4
4/(7-4) = 1.333 years to catch up, so that corresponds to 3 passes every 4 years, or, as you said, a triangle.
For resonances and the number of points in the star-pattern, it seems to be a simple matter of subtraction as you said, because the denominator in your example is 7-4, or 3. Divide by 3, you then need 3 cycles to get back to an integer.
There is a sequence of orbital resonances between the moons of Jupiter, so tracing the motion of moons relative to one another gives a range of nice patterns
In this image, the camera follows Ganymede, stationary in the centre of the image. Since the camera moves to follow Ganymede, Jupiter moves relative to the camera, producing the pink circle. Io and Europa have resonant orbits, orange and white, Io has a three petalled "flower", and Europa has the cardiod. Calisto orbits outside of Ganymede, and has the pattern of four lobes.
Image generated by "gravity simulator"