Plot shows markers, but no lines, no matter what is being plotted
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Title says it all. Even for extremely simple plots copied from the official documentation, such as
x = linspace(0,10,100);
y = exp(x/10).*sin(4*x);
plot(x,y,'-o')
I get a plot which has markers but just a few whispy segments of line (see attached). I'm using 2023a in browser at https://matlab.mathworks.com/.
Edit for clarity: According to official documentation, the code above should produce a plot with lines connecting the markers. The problem is that, when I run this code, is does not do so. It has only markers, for reasons mysterious to me.
Edit for clarity: I am running this in-browser at https://matlab.mathworks.com/, using all default settings and after clearing local variables.
0 comentarios
Respuestas (2)
Sulaymon Eshkabilov
el 16 de Mzo. de 2023
Here is the corrected code:
x = linspace(0,10,100);
y = exp(x/10).*sin(4*x);
scatter(x,y)
% In case, you want with lines:
x = linspace(0,10,100);
y = exp(x/10).*sin(4*x);
figure
plot(x,y, 'bo-', 'linewidth', 2)
1 comentario
Star Strider
el 17 de Mzo. de 2023
The code is also being run in R2023a, since that just released. If you are using the pre-release version, consider downloading the official release (you’ll want to do that anyway), and see if the problem persists.
Otherwise, you could be encountering a graphics rendering problem. See Resolving Low-Level Graphics Issues for details. Specifically, be sure that you’re using the latest graphics drivers.
2 comentarios
Star Strider
el 17 de Mzo. de 2023
O.K., so you are doing this on your personal computer however using MATLAB Online.
Running your code here (I didn’t separately test it in MATLAB Online) —
x = linspace(0,10,100);
y = exp(x/10).*sin(4*x);
plot(x,y,'-o')
On my computer,. everything appears to be working correctly and all the llines and markers appear. That you are getting a different result implies to me that this could still be a graphics driver problem on your computer, since your computer has to render the plot. Alternatively, it could possibly be a browser problem, so it could be worthwhile to run your code with a different browser to see if there’s a difference. That could also help differentiate between a browser problem and a graphics driver problem.
I’m just formulating hypotheses here that you can test to see if it’s possible to identify the problem. That’s essentially all that I can do.
.
Ver también
Categorías
Más información sobre Annotations 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!