How do i make a plot over a picture

Hi Scilab Team,

how can i plot a polyline by plot(x,y) over a picture plotted by uicontrol.

is it the order of the code, first plot than picture or is there some layer function?

M.f.G. Pascal

Hello,

There is no way to plot over an uicontrol image. However, this is possible if the image is displayed by using Matplot, but the image has to be read by using imread, which implies that you must have IPCV or Scicv toolbox. For example:

clf
http_get("https://www.fileformat.info/format/jpeg/sample/0c047d42fdfb419e86c594f0f7ad3ce1/SPACE.JPG","space.jpg",follow=%t);
x=imread("space.jpg");
Matplot1(x,[0 0 10 2]).data=x;
t=0:0.01:10;
plot(t,1+sin(2*t),'r',"thickness",2)

the recursive assignment above (Matplot1 call) is necessary because there is a bug in Matplot1 implementation.

1 Like

ok, i hoped that there was something without using an Atom-package.

thank for the quick reply. :slight_smile:

M.f.g. Pascal

Well,
as mentioned above: Using an Image Prcessing toolbox is the easy way.
But: If you strictly want to avoid that you may try this:

f = figure();
x = linspace(0,20,200);
plot(x,sin(x))
e = gce();
c = e.children;
h = xstring(0,-1,"$\scalebox{1}{\includegraphics{path-to-your-image}}$");
c.data(:,3) = 0.1; // <<<==== HERE, use the "z" value > 0, to put the plot "on top" of the image
c.thickness = 2;

Found this workaround here:

BR
Philipp

1 Like

does it also works with uicontrol than xstring?

works :slight_smile: like you propose.