Describing functions with number of intersections Main question

The graph of a continuous function $f: \mathbb{R} \to \mathbb{R}$ intersects a line $k$ times if and only if the same line intersects the graph of $y=x^{n}$ also $k$ times. Is $f(x)$ necessarily $x^n$? If not, for which $n$ is $f(x)$ necessarily $x^n$?

Further research
I look forward to generalizing $x^n$ to an arbitrary polynomial, or even an arbitrary continuous function (i.e., determining if the number of intersections of all line with a the graph of a function uniquely describes that function).
My current approach
So far, I have been trying to gain more intuition through the following perspective.
We describe a function $f$ with a partition of a plane $P_f$: if the number of intersection of a line $y= ax + b$ with $f$ is $k$, we mark the point $(a,b)$ on $P_f$ with $k$. This way, $P_f$ is partitioned into regions marked $0, 1, 2, \dots$, i.e., of $0, 1, 2, \dots$ intersections.
Note that this leaves out vertical lines. However, as we only consider partitions corresponding to continuous functions, with which vertical lines intersects exactly once, I believe it does not matter.
So, the question translates to

Does $P_f = P_{x^n}$ imply $f = x^n$?

More generally,

Is the map $f \to P_f$ injective?

I also wonder if an arbitrary partition $P^*$ has a corresponding continuous function. Perhaps finding a counterexample to this is simpler than the questions above.
As an example, I solved for partitions $P_{x^{2n}}$ and $P_{x^{2n + 1}}$ for $n \geq 1$. Denote the number the point $(a,b) \in P_f$ is marked with by $\gamma$. Then we get the following forms:

My next steps will be to get more insights on these partitions and learn if there are characteristic features for polynomials in them.
 A: For the case of $y=x^{2n}$, the answer is yes, we can confirm that $f = x^{2n}$. Here's why.
The graph of $y=x^{2n}$ splits the plane into 3 parts: itself $(0)$, the region above it $\text{(I)}$, and the region below it $\text{(II)}$. We denote the graph of $f$ by $\mathcal{C}$.
Suppose a point in $\mathcal{C} \cap \text{(II)}$ exists. We can draw a line through it which does not intersect $(0)$. This yields a contradition: the line cuts $\mathcal{C}$ at least once but never meets $(0)$. Hence all points in $\mathcal{C}$ must be either in $(0)$ or $\text{(I)}$.
Now draw the tangent $l$ of $(0)$ at $(x_0, x_0^{2n})$. There must be a point $(x_1, y_1) \in \mathcal{C} \cap l$. But we know that $(x_1, y_1) \in (0)\cup \text{(I)}$ and $l \cap \text{(I)} = \emptyset$. So $(x_1, y_1)$ must be on $(0)$. The only intersection of $(0)$ and $l$ is $(x_0, x_0^{2n})$; therefore, this point must be $(x_1, y_1)$.
As such, we have proved that every point on $(0)$ must also be on $\mathcal{C}$. Consequently, $f$ must be $x^{2n}$.
