[Scilab-users] ?==?utf-8?q? Exporting graphic figure and its calcs
Alexis Cros
Alexis.Cros at promes.cnrs.fr
Wed May 31 14:54:00 CEST 2017
Hi,
nice trick. May be interesting to transcode it to other OSs and to
integrate into the Scilab built-in functions.
Thank you for the tip
A.
Le 31/05/2017 à 10:47, Antoine Monmayrant a écrit :
> Hello again,
>
> To add more details to my previous answer, here is the function I hastily hacked together to workaround the bug that prevent exporting uicontrols:
>
>
> function exportHack()
> // Export figure with uicontrols to png using X server & import (imagemagick)
> // Horrible hack that should only work on my machine (linux 64bits)
> // get around bug http://bugzilla.scilab.org/show_bug.cgi?id=14836 https://bugzilla.scilab.org/show_bug.cgi?id=14502
> h=gcbo;
> //current figure name
> figname=h.parent.parent.figure_name;
> //getting X server id for current window
> ret=unix_g("xwininfo -int -name " +""""+figname+"""");
> //hackish, depends directly on the syntax of xwininfo outputs
> tok=tokens(ret(2),':');
> tok=tokens(tok(3)," ")
> winid=tok(1);//X server windows id, as a string
>
> // File save dialog parameters
> file_mask=["*.png"];
> boxTitle="Export";
> //If previous filename is present, use it to start in the corresponding directory
> if h.userdata~="" then
> dir=h.userdata;
> else
> dir=pwd();
> end
> dir
> PathFileName=uiputfile(file_mask,dir,boxTitle);
> // LD_LIBRARY_PATH required to get around bug: http://bugzilla.scilab.org/show_bug.cgi?id=14143
> unix_s("LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH ; import -window "+winid +" "+PathFileName)
> // keep savec filename for future reference.
> h.userdata=PathFileName;
> endfunction
>
> It only works on a linux system with X server and imagemagick.
> It will not run out of the box on your system, but it might inspire you to find your own workaround.
>
> Hope it helps,
>
> Antoine
>
>
>
> Le Mardi, Mai 30, 2017 15:58 CEST, Alexis Cros <Alexis.Cros at promes.cnrs.fr> a écrit:
>
>> Hello,
>>
>> I have created a graphic figure which contains several things :
>>
>> - uicontrol frames which contain axes (polarplot, plot2d...)
>>
>> - uicontrol texts
>>
>> gui_sumup = figure(55, 'Position', [0 0 my_screen_size(1)-H_BORDERS_THICK my_screen_size(2)-START_BAR_THICK],.. // Position x, y and size x, y
>> 'BackgroundColor', BLUE,..
>> 'Figure_name', 'Emissivity compute utility')
>>
>> I would like to export the full figure containing all entities. When I
>> execute the folowing instruction, only the background figure is exported :
>>
>> xs2png(gui_sumup, computed_folder_path + '\Graphs\SUM_UP-' + csv_main_header_edit.String + '.png')
>>
>> or
>>
>> xs2png(55 , computed_folder_path + '\Graphs\SUM_UP-' + csv_main_header_edit.String + '.png')
>>
>> Is there a way to encapsulate all entities into the general figure (like
>> merging?) to export it ?
>>
>> Thanks
>>
>> Alexis
>>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
More information about the users
mailing list