# Is there a way to scale a graph from the command Periodogram?

Does anyone know if there is a way to scale a graph from the command Periodogram? More specifically in terms of the y axis. I am wondering if there is a way that I can make the highest value on the y axis of these graphs to be "1" while still keeping the ratio in comparison to the highest value of all the other values that pop up on the graph.

I wish I could show a picture of the graph to show more of what I mean, but I am quite new to this site and I don't know how work everything.

More Info: I am getting these graphs of the Periodogram from either .wav or .aif files. Both seem to work for what I need to do.

## 2 Answers

You can post-process the output of Periodogram to rescale the Lines:

ClearAll[postProcessF]
postProcessF[d__, o1 : OptionsPattern[]][scale_: {0, 1}, imgsize_: 300, style_: Blue] :=
Graphics[Periodogram[d, o1][[1]] /.
Line[x_] :> {style, Line[Transpose[{x[[All, 1]],
Rescale[x[[All, 2]], {Min@x[[All, 2]], Max@x[[All, 2]]},  scale]}]]},
AspectRatio -> 1/GoldenRatio, Axes -> True, ImageSize -> imgsize]


Examples:

SeedRandom[1]
data = Table[2 Sin[0.2 \[Pi] n] + Sin[0.5 \[Pi] n] + RandomReal[{-1, 1}], {n, 0, 127}];

Row[{Periodogram[data, ImageSize -> 300],
postProcessF[data][],
postProcessF[data][{-1, 1}, 300, Red]}]


Row[{Periodogram[data, 64, ImageSize -> 300],
postProcessF[data, 64][],
postProcessF[data, 64][{-1, 1}, 300, Red]}]


If you are doing Periodogram[list], then dividing list by Max[Abs[Fourier[list]] should do the trick, I should think.