Jupyter notebook : Problem with figure() function

Hello guys,
I’m trying to plot 3 elements in a for a loop: 2 on the same plot and one on another one. The problem is that when I use the function figure() , some strange things appear on the screen : there’s a symbolic representation of my graphs with +,$ symbols . I don’t understand why it is acting that way, if you could help me, that would be amazing !

Thanks :slight_smile:

ps: I cannot put any embedded pictures since I am a new member…

Sorry for the inconvenience, I changed that setting to allow up to three pictures for a new user (previously it was one).

Witout more info, it is hard to diagnose your issue. Can you answer the following questions:

  • What is the OS?
  • How did you install Octave and what version?
  • How did you install Python and Jupyter?
  • How do you launch Jupiter?
  • What code exactly did you try to run in Jupiter?

What you describe looks like the dumy gnuplot terminal (ascii art) which would be used if you had no display.

Interested to learn if this was resolved. Is it possible to launch an Octave figure from Jupyter notebook? Can users use X11 to connect to this figure if Jupyter server is running in cloud?

The compatibility between Octave and Jupyter currently is kinda weird in the plotting department, this post at the kernel issue thread:

shows that the when using the current Octave 6.x.x versions unless you explicitly run the command:

graphics_toolkit("gnuplot")

before launching a plot, the graphics will not work despite gnuplot being the default graphics toolkit in theory, they have analyzed the problem and concluded that Octave 6 somehow reverts to fltk graphics toolkit and because the fltk. toolkit can’t pass the figures to jupyter for the inline plotting it sends that error.

I’m currently using a previous version to 6 to run this code pertaining the original question:

clear
close all
clc

x=linspace(-5,5,100);

y1 = x;
y2 = x.^2;
y3 = x.^3;
y4 = x.^3 / 2;

ys = {y1, y2, y3, y4};

for i = 1:2
  
  figure()
  plot(x,ys{i})
  hold on
  plot(x,ys{i+1})
  grid on
  
  figure()
  plot(x,ys{i+2})
  grid on
  
end  

so the result is that it generates using a for loop 4 figures, two of them containing plots on the same figure and the other two individual plots in another figure, I only show two because of the size of the screencapture:

if the thing is about having the plots not being inline with the notebook, I don’t remember if it is requirement, but I have gnuplot installed as an external aplication.

then by running the comand

%plot gnuplot

and then the same code as before the plots are drawn in external figures/windows to the notebook.