I've read that long axes and hammers were preferred as swords were miserable against well made plate armor, but we often see the sword in medieval fiction and even historical tapestries as a long, one or two handed weapon wielded en mass. Is this realistic or fantasy?
Swords were definitely used as a primary close-combat armament by medieval soldiers, into the later Middle Ages. They weren't necessarily the most common or preferred primary weapon, and their primary purpose was often as versatile secondary weapons, but there were soldiers on medieval and early modern battlefields whose primary weapon was a sword.
First, some men at arms (fully armoured soldiers who were knights, or fought like them) used two-handed swords in the Later Middle Ages. As I mentioned in a Previous Answer:
the specialized two-handed sword is fairly rare. Though many people characterize them as 16th century weapons, there are a number of examples that survive from earlier, so we can say with certainty that two-handed swords were used in the Middle Ages. There are illustrations of very large swords in some 13th century manuscripts, while some surviving 13th century ‘Great Swords of War’ are nearly 40 inches in length - which is approaching the length of a true two-handed sword. Froissart records one such two-handed sword being use by the canon de Robesart in a battle in 1358: "He held a sword of two hands, with which he dealt blows so great that none dared to face them." Some exceptionally large 14th century swords survive, including one with an overall length of 6ft 8 1/4 inches hung over the tomb of Edward III in St George’s Chapel, Westminster Abbey. This is likely a ceremonial ‘bearing’ sword - its weight and length would make it unwieldy on the battlefield. By the 15th century, however, we have a number of surviving 2-handed swords including some particular swords with English and Danish associations. This Sword at the Wallace collection is from around 1450. It has a hollow-ground blade of roughly diamond section. With a blade over 46 inches long, this is a true two-handed sword. At 6 lbs, it is heavy but manageable. Its pommel and guard are characteristic of English swords found in the Thames and near the 1453 Chastillon battlefield, and similar swords are depicted on English Funerary effigies. There are also a number of Scandanavian two-handed swords, which feature a distinctive, very long partially wire-bound grip and a blade of between 36" and a little over 40". Some of these have a ricasso, an unsharpened base of the blade, effectively making the grip even longer. You can call these either short two-handed swords or very long-gripped 'hand and a half' swords.
True two-handed swords are too large to be secondary weapons, since they are so long they are hard to carry while using another weapon. So men at arms using these would presumably use them as their primary armament - and their are accounts of them doing so (though they are outnumbered by accounts of soldiers using pollaxes, shortened lances and other weapons).
Secondly, many English archers were armed with swords, and used them to fight in close combat when armies had closed. Though swords would not be 'primary', they would be the main close combat weapon for many archers, and close combat was very important in the decisive use of archers by they English at Agincourt and elsewhere. Archers made up the majority of the English army at Agincourt, and an even larger percentage in later battles (as near as we can tell). They didn't just sit back and shoot, they fought as light infantry, fighting with a wide variety of weapons. Some of them fought with swords. The Italian traveller Dominic Mancini (who visited England in 1482-1483) describes English archers armed with 'heavy and thick' swords and iron bucklers, which he describes Englishman as training with. Though the swords are described as 'heavy and thick' this might be a trope by Mancini, who makes a great to-do of the strength and size of the English archers - being used with bucklers, these would have been single-handed swords - he describes them as being about as long as the arrows, so 30ish inches. At Agincourt the English archers are noted as attacking the French with swords, axes and other weapons.
Finally, in the later middle ages and early modern periods there were soldiers armed with swords and shields that were used as light infantry, by the Spanish and other European powers. The most famous of these shields is the round shield or in Italian 'Rotella' (referred to in the popular 16th century song 'Scaramella') but in the later 15th and 16th centuries you also see rectangular shields that look like small pavises, like these illustrated in Burgkmair's Triumphal Procession of Maximilian I (from the 1510's). I am tagging u/itsallrightwithme to discuss the tactical deployment of these troops.
So, were swords the main battlefield weapons of later medieval and early modern Europe? Generally not. Were they used as the primary close combat weapon by some soldiers? Yes.
Sources:
Oakshott, Ewart - The Archaelology of Weapons - Accounts of swords used as lances
Capwell, Tobias - Masterpieces of European Armour at the Wallace Collection - Notes on the English 15th century two handed sword
Strickland and Hardy - The Great Warbow - Much of my discussion of English archers use of swords is taken from this source