Improve graphical figures exports to png or pdf

Hi all,
for some publications is needed to provide export of scilab figures containing about 15 x 120000 double float values (timeseries plot). While saving the figure as *.scg for future analysis is working fine, exporting as .pdf through xs2pdf() is failing with memory issue that advises to reduce the size of the figure, and exporting as image like with xs2png() doesn’t allow to set the resolution of the exported image, leading to poor quality image that is not suitable for future analysis or publication : is there any way to upgrade the size limitation of xs2pdf() or upgrade the resolution of the image of xs2png() ? Maybe is the same underlying issue with memory limitation of some routines or graphics libraries ?

thank you for your help,
David

Hello,

did you try to increase the Java heap size (in the Preferences window) ? With Scilab 2023.1.0 (macOS) I can export to pdf (a 20.4 MB file) the following plot:

t=linspace(0,1,120000);
plot(t,sin([1:15]'*10*t))

with default Java heap size (512 MB).

S.

Hi Stephane,
thank you for your suggestion, I doubled the default java heap size and I managed to get the pdf export for the dummy data on SCI 2023.1.0 WIN10.

David

2 Likes

In addition, don’t you think that such pieces of advice, to look at the java heap in the preferences, might be inserted in the help pages, around graphic and xs2pdf xs2… functions ? Also with some clues, tips to estimate the requirements in java heap size regarding the size of the figure to export ?

Thanks,

David

The default Java heap size has been increased from 256 to 512MB in 6.1.1 release and I don’t think it is a good idea to increase it again as many users run Scilab on no-up-to-date hardware. However, as you suggested it, adding a notice about Java heap size in relevant documentation pages could be an improvement. This could be a nice contribution from you to Scilab. You can even do this online if you known a bit of XML (documentation pages use a specific dialect of Docbook XML). The links to the pages are:
https://gitlab.com/scilab/scilab/-/blob/main/scilab/modules/graphic_export/help/en_US/xs2emf.xml
https://gitlab.com/scilab/scilab/-/blob/main/scilab/modules/graphic_export/help/en_US/xs2eps.xml
https://gitlab.com/scilab/scilab/-/blob/main/scilab/modules/graphic_export/help/en_US/xs2ps.xml
https://gitlab.com/scilab/scilab/-/blob/main/scilab/modules/graphic_export/help/en_US/xs2svg.xml
https://gitlab.com/scilab/scilab/-/blob/main/scilab/modules/graphic_export/help/en_US/xs2pdf.xml

Hi Stephane,
I just give a try last week to perform the update of the pointed out help pages under scilab.gitlab but was not successful in committing the changes : Update 4 files
Especially I tried to explain the difficulties I met in this comment.
Maybe I was not given the role allowing to request a commit on the main branch ?
In any case I have modified the help files in my fork of the main scilab branch basically adding in each this :

<note> In case <function>xs2ps</function> is issuing an error message
complaining about not enough memory, you may manage this situation
by iteratively : reducing the number of graphical elements visible in
the figure (zoom level adjust) and increasing the java heap size (java
heap size limit is set by default to 512 Mo under Scilab console Menu
Edit > Preferences > Generalities. NB: restart Scilab is required
to apply the new heap size), until you reach the correct zoom level and
successul export file in vectorized format.
</note>

You have to create a merge request (MR) of your branch containing the modification : https://gitlab.com/scilab/scilab/-/merge_requests/new into the main Scilab branch.