Evenly spaced Tick marks for Primes
As people on the comments pointed out this may be a problematic in various ways, but if all y-values of your points are primes, this can be accomplished with ScalingFunctions
option. PrimePi
is an inverse of the Prime
function, and you list both to guide ListPlot
:
maxPrimeIndex = 25;
maxPrime = Prime[maxPrimeIndex];
Flatten[(Partition[
Riffle[Flatten[FactorInteger[#]][[;; ;; 2]], #, {1, -2, 2}], 2]
) & /@ Range[2, maxPrime], 1];
ListPlot[%,
Ticks -> {Automatic, Prime[Range[1, maxPrimeIndex]]},
PlotRange -> {{0, maxPrime}, {0, maxPrime}},
ScalingFunctions -> {PrimePi, Prime}]
You can also map PrimePi
on the second column of input data and change the vertical axis tick labels using custom ticks:
maxPrimeIndex = 25;
maxPrime = Prime[maxPrimeIndex];
data = Flatten[
Partition[Riffle[Flatten[FactorInteger[#]][[;; ;; 2]], #, {1, -2, 2}], 2] & /@
Range[2, maxPrime], 1];
ListPlot[MapAt[PrimePi, data, {All, -1}],
Ticks -> {Automatic,
Thread[{Range @ maxPrimeIndex, Prime @ Range @ maxPrimeIndex}]},
PlotRange -> {{0, maxPrime}, {0, maxPrimeIndex}}]