Are there functions that can be defined on $\mathbb{R}^2$, are metrics on the whole x-axis (i.e, the set of all points whose second coordinates are $0$), but not metrics on $\mathbb{R}^2$ as a whole? I am especially wondering about the existence of the ones that break the triangle inequality.
More generally, are there functions that can be defined on $\mathbb{R}^2$, but are metrics only on a few straight lines or some other subsets of $\mathbb{R}^2$, but not on $\mathbb{R}^2$ as a whole?
Thanks!
Edit:
I guess some piecewise functions may fit the description. For example, we let $ d = |x - y| $ only on $[-1, 1] \times [-1, 1]$, but let $ d = (x - y) ^ 2 $ elsewhere on $\mathbb{R}^2$. However, I was looking for "non-piecewise" functions.