p = [3,3]
plot(p, 'x')
This weirdly generates this:
I’d like it to be a point at x=3/y=3 on the plot. How?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
@mathematician1975 is right, but I feel like this requires a bit more explanation:
Like the official documentation states:
so in fact this is not weird at all that
plot(p, 'x')plots each value inpagainst its index, i.e. the points (1, 3) and (2, 3).This is actually handy in some cases (when you want the x-coordiantes to be a running index), but not in yours. To plot point
pcorrectly, use the syntaxplot(X, Y), that is:(here I assumed that the y-coordinate is the first in
p, but if it’s the x-coordinates you can just swap the places of the input arguments).In the general case, if
pis a matrix with two columns (say, the first contains all y-coordinates and the second all x-coordinates), you can plot all points like so: