There are four points Blue (4,1), Purple (6,3), Red (9,3) and Green (4,5) plotted on a 1 cm Cartesian grid. I want to rotate the diagram about the Blue point anticlockwise (2nd layout) and clockwise (3rd layout) by 45 degrees and compute the coordinates for the rest of the points.
I've tried to compute the coordinates using the following equations (in this link) and it doesn't give me the correct coordinates. I'm not sure what is the problem here. Also I would like to know how to specify the angle for a clockwise transformation.


X and Y are not swapped. +ve Y axis should be in the anticlockwise direction of +ve X axis, which is here. You have just rotated the graph; axes are not swapped. Here we need to consider first a translation (to (4,1) ) then rotation (45 degrees). So after translation new coordinates will be
Blue(4,1) to Blue(0,0)
Purple (6,3), to Purple (2,2) etc.
Now applying rotation new location of Purple point will be
$x^{'} =2*\dfrac{1}{\sqrt2} - 2*\dfrac{1}{\sqrt2}=0\\$
$y^{'} =2*\dfrac{1}{\sqrt2} + 2*\dfrac{1}{\sqrt2}=2{\sqrt2}$
Now wrt. to original origin this point will be
$x = 0 +4=4$ and
$y = 1+2{\sqrt2}$
So new location for purple point will be $(4, 1+2{\sqrt2})$ not $(4,4)$