Hello Heinz, Le 25/02/2023 à 00:13, Heinz Nabielek a écrit : Colleagues:
can I program a table like below into a Scilab generated diagram? Sending some HTML-ized code to xstring() would have been the more versatile and tunable way to proceed, to get a styled table, with colored backgrounds, etc. Unfortunately, unlike for the GUI, xstring() does not interpret HTML and renders it as is. The first actual way might be to use an editable uitable (uicontrol style="table") in a figure. Then you will need gui2bitmap<https://atoms.scilab.org/toolboxes/gui2bitmap> to export the figure as an image, including the uitable, and cells won't be filled with individual background colors. The second way might be to use a LaTeX table, that can be prepared with prettyprint<https://help.scilab.org/docs/6.1.1/en_US/prettyprint.html>(), then be a bit customized, and finally be sent to xstring(): mytab = ["Turbine Power" "Turbine hub height" "Turbine radius"; "7 MW" "100 m" "82 m"; "12 MW" "150 m" "110 m"; "2 MW" "70 m" "40 m"]; Lat = prettyprint(mytab,,""); // "" is to remove overall parentheses Lat = strsubst(Lat, "${", "$\large{"); clf, xstring(0.1, 0.1, Lat) [cid:part1.SxVGIIDw.TF4Le16q@free.fr] You can tune the size of the text rendered in the table by changing \large into \Large or \LARGE etc. You can add some row and column frames by switching to a {tabular} object instead of a {matrix} one: mytab = ["Turbine Power" "Turbine hub height" "Turbine radius" "7 MW" "100 m" "82 m" "12 MW" "150 m" "110 m" "2 MW" "70 m" "40 m"]; Lat = prettyprint(mytab,,""); // "" is to remove overall parentheses Lat = strsubst(Lat, "${", "$\large{"); Lat = strsubst(Lat, "begin{matrix}", "begin{tabular}{|c|c|c|}\hline"); Lat = strsubst(Lat, "end{matrix}", "end{tabular}"); Lat = strsubst(Lat, "\cr", "\cr\hline"); I have not found any trivial direct way to split titles on 2 rows in cells: since strsubst() does not handle groups replacement<https://gitlab.com/scilab/scilab/-/issues/9123>, the Lat string can be processed by hand: In it, you may replace "Turbine Power" with "\substack{Turbine\\Power}", etc. Then you get a string rendered as [cid:part2.0OpHeCHn.5rotaSG1@free.fr] ... that you can pass to xstring(). Regards Samuel PS : Since in the figure you get the displayed legend is quite tall, it might be worth to try the mc_legends() macro<https://fileexchange.scilab.org//toolboxes/274000> available in the FileExchange, to get a 2-column legend. PS2: IMHO, prettyprint() would deserve getting more LaTeX-related options, to output a matrix through the {tabular} environment instead of the {matrix} one, to pass some {|c|l|c...} justification and border options, \hline options, process in-cell line breaks, etc. This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged. If you are not one of the named recipients or have received this email in error, (i) you should not read, disclose, or copy it, (ii) please notify sender of your receipt by reply email and delete this email and all attachments, (iii) Dassault Systèmes does not accept or assume any liability or responsibility for any use of or reliance on this email. Please be informed that your personal data are processed according to our data privacy policy as described on our website. Should you have any questions related to personal data protection, please contact 3DS Data Protection Officer https://www.3ds.com/privacy-policy/contact/
_______________________________________________ users mailing list - users@lists.scilab.org Click here to unsubscribe: <mailto:users-unsubscr...@lists.scilab.org> https://lists.scilab.org/mailman/listinfo/users