Plot is not working properly

Hi,
I am using octave 5.2 in lubuntu 20.04. Octave is working but when I try to generate a solid line graph it becomes dotted and so blure to understand. Now can anybody help me to get rid of this problem?
The code is:

x=-10:.1:10;
y=sin(x);
figure;
plot(x,y,’-’);

That might be the result of smoothing gone wrong.

Try to update your graphics drivers.
Or for work-arounds, you might want to read this thread:

Actually I have no problem with color. I have problem with solid line.
Moreover when I add the line set (gcf,"graphicssmoothing", "off"); It shows a dassed line but no solid line.

Could you please attach screenshots of the plot with and without graphics smoothing?

oh! sure.Here’s it is.
screenshot:

code:
With graphics smoothing:

x=-10:.1:10;
y=sin(x);
figure;
plot(x,y,’-’);
title(“with graphics smoothing”);


Without graphics smoothing:

x=-10:.1:10;
y=sin(x);
figure;
set(gcf,“graphicssmoothing”, “off”);
plot(x,y,’-’);
title(“without graphics smoothing”);

This still looks like an issue with the graphics drivers and/or window manager.
Which driver are you using? Do you use dpi scaling?

As a workaround to have better looking lines on-screen, you could try if setting a bigger linewidth helps:

x=-10:.1:10;
y=sin(x);
figure;
plot(x,y,’-’, "linewidth", 1);
title(“with graphics smoothing”);

If it does, you could change the default line width in one of the startup files by

set(groot, "defaultlinelinewidth", 1);

Provided you are not using Nvidia proprietary driver, you can try setting LIBGL_ALWAYS_SOFTWARE=1 before starting octave.

Dmitri.

That doesn’t works. Now it seems like a bug to me. Because there is no problem with the code of dassed line, dotted dassed line and any other things,even with graphics smoothing, except solid line. When I try to use solid line it becomes dassed and blur. However set( gcf,"graphicssmoothing", "off"); can make the line clear but it cannot solve the dassed line issue.

Could you please provide information to these questions?

Here’s the reply of lspci | grep VGA:

00:02.0 VGA compatible controller: Intel Corporation 82945G/GZ Integrated Graphics Controller (rev 02)

Here’s the reply of glxinfo | grep OpenGL:

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel® 945G
OpenGL version string: 1.4 Mesa 20.0.8
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 20.0.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16
OpenGL ES profile extensions:

that should provide the information of my graphics driver. And I am not using Nvidia proprietary driver.

I don’t know what is dpi scaling. and don’t know how to set LIBGL_ALWAYS_SOFTWARE=1

Intel graphics is buggy.

On your terminal start octave as:
LIBGL_ALWAYS_SOFTWARE=1 octave --gui

Alternatively, you can add the line to .octaverc file (in your home directory):

putenv (“LIBGL_ALWAYS_SOFTWARE”, “1”)

Dmitri.

1 Like

It worked! But there is no .octaverc file in home directory. I created a new file named .octaverc but that didn’t worked.

I do not know how to disable discord to mungle the code, but
In the line:
putenv (“LIBGL_ALWAYS_SOFTWARE”, “1”)

there should be normal double quotes, not the nonsense they got replaced with.
Also you need to restart octave after you made the change to .octaverc.

Dmitri.

@dasergatskov: You could surround the commands with single grave accents “`” to activate the code markup (which shouldn’t mess with quote characters). Three grave accents “```” mark sections that are displayed as code.