I am trying to understand what is happening between points 1-2 because
I thought that because of max isothermal efficiency the gradient of
the line shouldn't be more than the constant entropy line between the
two points.
Short Answer
Some cooling took place in the compression step between points $1$ and $2$ that isn't shown because lines are easier for a program to draw.
Longer Answer
I think the graph as shown suffers from the fact that the cycle is drawn with straight lines from point-to-point instead of curves that would reflect rational design.
That's not to say that the curve shown is impossible. Any movement on a P-H diagram is possible so long as your machine has a cold sink to dump its waste heat and the machine has energy to perform work. However, in refrigeration examples, practicality means you are limited in your movement on a P-H diagram such that you shouldn't cross to lower temperature isotherms below that of your cold sink's temperature unless you are in an evaporation step. Otherwise you're wasting energy in some way or another. For example, the isotherm barrier you can't cross until the evaporation step is the outlet temperature of your condenser. In the drawing that temperature appears to be $36^{\circ}\text{C}$-ish.
I think you're right to be suspicious of the $1\rightarrow2$ step because if you interpret its path literally, its initial course shows a decrease in entropy (it's P-H path is steeper than the isentropic line) while near $20^{\circ}\text{C}$. In other words, it is initially decreasing in entropy while below the isotherm of the cold sink, $36^{\circ}\text{C}$. In order to decrease in entropy during compression, heat transfer from gas to the environment must simultaneously occur for each incremental increase in pressure during the compression (as mentioned by Phil Sweet). The initial path of the $1\rightarrow2$ line only makes sense if there is a $20^{\circ}\text{C}$ cold sink available to the refrigeration machine which clearly isn't the case. If this were true, then the $2\rightarrow3$ line would ride the $20^{\circ}\text{C}$ isotherm, instead of the $36^{\circ}\text{C}$ isotherm.
That said, it is possible to shift the compression line to the left while never falling in temperature below the $36^{\circ}\text{C}$ isotherm. For example, the ideal refrigeration cycle, a portion of a Carnot cycle, starting from point $1$ would follow an isentropic line (somewhere between the $1.8$ and $1.9$ blue isentropic lines) up until it intersects the cold sink isotherm (isentropic compression), $36^{\circ}\text{C}$. Then, it would ride this isotherm (somewhere between the red $20^{\circ}\text{C}$ and $40^{\circ}\text{C}$ isotherm lines ) up to the black dew point line (note: isothermal compression = compression + cooling) at a point to the left of point $2$. I drew in magenta what this ideal portion of a carnot cycle would look like:

Real world compressor equipment probably would not be able to follow this ideal curve since it is cheaper to simply have one single-stage compressor instead of many compression stages interlaced with many heat exchangers. Also, riding close to the dew point line is dangerous since formation of incompressible fluids damage most compressor types.
My guess for why the $1\rightarrow2$ line is so wrong is because the software generating point $2$ assumed that some cooling took place during or after the compression step and simply connected point $1$ with point $2$ with a straight line because it's simpler to program drawing a straight line.
Also I am not sure how to explain the dip between points 5-1.
The drop in pressure for the $5\rightarrow1$ step is probably due to friction in the piping between the evaporator and the compressor suction inlet. The rise in enthalpy is probably due to imperfect insulation of said piping (the environment warming the cold refrigerant vapor).