Plot function never works on Ubuntu

24 views (last 30 days)
Özgür
Özgür on 18 Oct 2024
Answered: Sandeep Mishra on 26 Nov 2024
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
Özgür
Özgür on 18 Oct 2024
Yes. I am using Ubuntu 20.04.3 LTS.
Steven Lord
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
f =
Figure (1) with properties: Number: 1 Name: '' Color: [1 1 1] Position: [1628 1512 583 437] Units: 'pixels' Use GET to show all properties
Also please show the output of this command.
f.XDisplay
ans = ':1'
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
ax =
Axes with properties: XLim: [0 1] YLim: [0 1] XScale: 'linear' YScale: 'linear' GridLineStyle: '-' Position: [0.1300 0.1100 0.7750 0.8150] Units: 'normalized' Use GET to show all properties
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)
h =
Line with properties: Color: [0 0.4470 0.7410] LineStyle: '-' LineWidth: 0.5000 Marker: 'none' MarkerSize: 6 MarkerFaceColor: 'none' XData: [1 2 3 4 5 6 7 8 9 10] YData: [1 2 3 4 5 6 7 8 9 10] ZData: [1x0 double] Use GET to show all properties
The output of these commands may also be useful.
info = rendererinfo
info = struct with fields:
GraphicsRenderer: 'OpenGL Software' Vendor: 'Brian Paul' Version: '2.1 Mesa 17.1.3' RendererDevice: 'Mesa X11' Details: [1x1 struct]
info.Details
ans = struct with fields:
HardwareSupportLevel: 'None' SupportsDepthPeelTransparency: 1 SupportsAlignVertexCenters: 0 SupportsGraphicsSmoothing: 0 MaxTextureSize: 16384 MaxFrameBufferSize: 16384

Sign in to comment.

Answers (1)

Sandeep Mishra
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!

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Tags

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!