On a MEGA it is possible that the table is outside the first 64k of FLASH/PROGMEM. If that is the case you have to use 'far' (32-bit) addresses:
uint16_t j = pgm_read_word_far(&XYTable[i]);
Try that and see if it fixes your pattern.
On a MEGA it is possible that the table is outside the first 64k of FLASH/PROGMEM. If that is the case you have to use 'far' (32-bit) addresses:
uint16_t j = pgm_read_word_far(&XYTable[i]);
Try that and see if it fixes your pattern.