How to overlay a plot onto a scatter plot?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
MOLE
el 19 de Oct. de 2019
Comentada: MOLE
el 19 de Oct. de 2019
clc; clear all;
load('../data/points2D_Set1'); % gives variables x and
% y and x range is [0,1] and it's loading correctly
xtrue=[0:1e-4:1];
ytrue=1.5*x+2.5;
plot(xtrue,ytrue);
hold on;
scatter(x,y);
my aim is to overlay the plot on the scatter plot but when I run this I'm getting an empty plot
2 comentarios
Daniel M
el 19 de Oct. de 2019
I can't seem to reproduce your issue. Can you upload the data? The only thing I can think of is x or y are all the same value, or are NaN.
Respuesta aceptada
Daniel M
el 19 de Oct. de 2019
You cannot plot vectors of different size.
whos x y xtrue ytrue
You'll see that x and y are 300x1, xtrue is 1x10001, and ytrue is 300x1. Perhaps you mean to write
ytrue=1.5*xtrue+2.5;
Más respuestas (0)
Ver también
Categorías
Más información sobre Scatter Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!