[Scilab-users] ?==?utf-8?q? Put an image as the background of an axis
Antoine Monmayrant
amonmayr at laas.fr
Wed Feb 10 09:19:26 CET 2016
Le Mardi 9 Février 2016 22:54 CET, Jan Åge Langeland <j-lan at online.no> a écrit:
>
>
> On 09.02.2016 20:27, Samuel Gougeon wrote:
> >
> > You may use the z coordinate of your flat curves to manage overlays,
> > as in:
> > clf
> > x = linspace(0,20,200);
> > plot(x,sin(x))
> > e = gce();
> > c = e.children;
> > // Example with a local image. The image is from
> > https://atoms.scilab.org/atoms.png
> > //xstring(0,-1,"$\scalebox{1}{\includegraphics{atoms.png}}$")
> > // Example with a remote image under http:// (http*s*: not accepted)
> > xstring(0,-1,"$\scalebox{1}{\includegraphics{http://www.cnrs.fr/fr/z-tools/newune/themes/CNRSTheme/images/logocnrs.png}}$")
> > c.data(:,3) = 0.1; // <<<==== HERE
> > c.thickness = 2;You may then tune the scalebox factor. Actually, like with an
> > uicontrol(style="image"), the imported image is inlaid and is not
> > resized accordingly with the embedding graphical figure. HTH Samuel
> > Gougeon
> Samuel
>
> Thank you for sharing these very good methods. It opens a lot of new
> possibilities.
>
> The way I want to use images in figure I find it better to modify your
> script with newaxis() before plotting. This makes the picture stay
> while zooming for instance:
>
> clf
> xstring(0,0,"$\scalebox{.3}{\includegraphics{http://photos.marinetraffic.com/ais/showphoto.aspx?photoid=445734}}$");
> g=get("current_figure"); g.figure_size=[345,575]; b=newaxes(); b.filled
> = "off"; x = linspace(0,20,200);
> plot(x,sin(x))
>
> By the way it would have been interesting to see an example with
> uicontrol(style="image") that you mention. I could never get that right.
Here we go:
//Image inside a figure with exactly the right size
f = gcf();
imageWidth = 181;
imageHeight = 144;
f.axes_size=[imageWidth,imageHeight];
//here image parent can be set to something else than the figure f (like a frame, ...)
h = uicontrol("Parent", f, ..
"Style", "image", ..
"Position", [0 0 imageWidth imageHeight], ..
"String", SCI + "/modules/demo_tools/images/logo_scilab.png");
>
> Brgds
> Jan Å
>
>
More information about the users
mailing list