Plot function never works on Ubuntu
24 views (last 30 days)
Show older comments
I am trying to run a plot function to get some figures but eventhough it does show up, it isn' t showing anything.
For example the below doesn't give me a figure.
x = 0:pi/100:2*pi;
y = sin(x);
plot(x,y)
3 Comments
Steven Lord
on 18 Oct 2024
When you say "doesn't give me a figure", can you clarify exactly what you mean?
Do you mean that no figure window opens up? If the answer is yes, does this open up a figure window? Can you show us what this command displays in the Command Window? Yes, leave off the semicolon because I want to see what's in the variable f.
f = figure
Also please show the output of this command.
f.XDisplay
Do you mean that a figure window opens up, but no axes appears in the figure? If yes, what does this command display?
ax = axes
Do you mean that a figure opens up with an axes on it, but nothing appears on the axes? If yes, show the output of this command.
h = line(1:10, 1:10)
The output of these commands may also be useful.
info = rendererinfo
info.Details
Answers (1)
Sandeep Mishra
on 26 Nov 2024
Hi Özgür, I understand that you are experiencing issue while using the 'plot' function to generate a 'figure' in MATLAB 2024b on Ubuntu OS.
To resolve the issue, you can refer any of the following work arounds:
1. Create a file named ‘java.opts’ in the directory where MATLAB is executed (e.g., /usr/local/MATLAB/R2024b/bin/glnxa64) and include the following line:
-Djogl.disable.openglarbcontext=1
2. Run MATLAB using the following command in the terminal to override the graphics driver:
export MESA_LOADER_DRIVER_OVERRIDE=i965; matlab
3. Launch MATLAB with software OpenGL by using the following command:
matlab -softwareopengl
4. Turn off anti-aliasing for figures by setting the 'GraphicsSmoothing' property of the figure to 'off':
set(gcf, 'GraphicsSmoothing', 'off');
You can also refer to the following MATLAB Answer to learn more about the workarounds:
For more information, refer to the following MathWorks Documentation to learn about ‘Resolving Low-Level Graphics Issues’: https://www.mathworks.com/help/releases/R2024b/matlab/creating_plots/resolving-low-level-graphics-issues.html
I hope this helps you in resolving the issue!
0 Comments
See Also
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!