How can you flip the axis values in ListLinePlot?

John Baez has requested a labeled plot of the first fifty primes on his Mathodon blog.
The code:

ListLinePlot[Labeled[#, #] & /@ Table[Prime[n], {n, 46}], 
PlotStyle -> PointSize[Medium]]

is close to what is desired with two exceptions:

  • The values displayed on the x and y axis should be switched. The x-axis should run from 1 to 200 and the y-axis from 1 to 50.
  • Each point should be labeled.

Baez plot of the primes to be replicated with the points labeled.

I noticed I had the entire graph inverted, so the answer was just to use

ListLinePlot[Table[{Prime[n], n}, {n, 46}], 
 PlotStyle -> PointSize[Medium]]

Daniel,

just a remark - you can achieve the same by simply plotting the PrimePi-function:

Plot[PrimePi[x], {x, 0, 200}]

If you do it your way you probably might consider the option InterpolationOrder:

ListLinePlot[Table[{Prime[n], n}, {n, 46}], 
 PlotStyle -> PointSize[Medium], InterpolationOrder -> 0]