MySql pivot table for scatter chart
Eventually I figured this out with help from this stack overflow post.

    SELECT CONCAT(
      'SELECT `mytable`.Name', GROUP_CONCAT(CONCAT('
         ,    `t_', REPLACE(Y, '`', '``'), '`.X
             AS `', REPLACE(Y, '`', '``'), '`'
       ) SEPARATOR ''),
     ' FROM `mytable` ', GROUP_CONCAT(CONCAT('
         LEFT JOIN `mytable`   AS `t_', REPLACE(Y, '`', '``'), '`
                ON `mytable`.Name = `t_', REPLACE(Y, '`', '``'), '`.Name
               AND `t_', REPLACE(Recall, '`', '``'), '`.Y= ', QUOTE(Recall)
       ) SEPARATOR ''),
     ' GROUP BY `mytable`.Name'
    ) INTO @qry FROM (SELECT Recall FROM `mytable` WHERE ... ) t;
    PREPARE stmt FROM @qry;
    EXECUTE stmt;


Initially this was not working because the datatype of columns X and Y was FLOAT which I suspect was messing up the conversion to string. I changed the type to be DECIMAL(10,9) (i.e. a single digit, followed by up to nine decimal points), which made the code work.