Changes

Jump to navigation Jump to search

Debug plotting issues

2,643 bytes added, 07:41, 19 August 2014
update of debuggin tips
== Basics ==
* '''Octave version:''' Execute 'ver' in Octave and copy the first 5 lines "GNU Octave Version" and "Operating System" verbatim. If you are on Windows please mention which build (MinGW, Cygwin, MXE, Visual Studio see http://wiki.octave.org/Octave_for_Microsoft_Windows) and where you got it (download from http://sourceforge.net/, http://mxeoctave.osuv.de/ ) or have you build it yourself?). This is important because some packages includes whole build environment while other just provide binaries even for octave-forge packages.
* '''Operating system:'''
* If you get a warning on startup, for example "warning: function xyz.m shadows a built-in function" please copy it verbatim
* '''If you get an error message, please, please, please copy the message verbatim'''
== I can't plot or print or the output doesn't look as expected ==
* Sometimes the figure on the screen visually differs from the file generated with "print". If this is the case please mention this and consider adding a screenshot of the figure window together with the generated print.
* Which toolkit are you using? Execute 'graphics_toolkit' in octave to query it. Common toolkits are 'fltk' (which is default now) or 'gnuplot'. Consider switching to another available toolkit (see available_graphics_toolkits) and try it there. You have to execute (for example switch to gnuplot) 'graphics_toolkit gnuplot' before any plotting command.
* Which Ghostscript versiondo you use? Is it a 32 or 64bit build? Please add URL to download. If 64bit under Windows see http://wiki.octave.org/Octave_for_Microsoft_Windows#Printing_.28installing_Ghostscript.29
=== Debug printing with gnuplot ===
Try
and attach the generated octave-print-commands.log, debug message and testplot.eps.
=== Debug printing with fltk ===
A common problem The output of commands described here were created with a GNU/Linux system.Windows or MacOS builds may differ. Please update the article if you findany differences. The class opengl_renderer is used to render a graphics_objectto an OpenGL context. If you use the "print" command with graphics_toolkit fltk,gl2ps is used to capture these OpenGL drawing commands and translates themto Encapsulated PostScript (EPS). If you have requested a different outputformat than EPS, the EPS output of gl2ps is that printing then piped to ghostscript (gs) whichdoes the conversion to PDF, PNG, JPG ... You can see the pipleline to ghostscript by adding "-debug" to the "print" command: {{Code|print with "-debug"|<syntaxhighlight lang="octave" style="font-size:13px">octave:1> sombrerooctave:2> print("-dpng", "out.png", "-debug")Ghostscript command: '/usr/bin/gs -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r150x150 -dEPSCrop -sOutputFile="out.png" -'fltk only works -pipeline: '/usr/bin/gs -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r150x150 -dEPSCrop -sOutputFile="out.png" -'</syntaxhighlight>}} For debugging purposes it may be desired to have the direct output of gl2pswithout piping them through ghostscript. This can simply be done with print -depsc out.epsor if you prefer a black/white output: print -deps out.eps If you want to wiretap the output of gl2ps, which is meant to goto ghostscript if printing a PNG, JPG etc. it's a little bit more complicatedbecause the existence of the ghostscript binary is checked first.Therefore simply replacing the figure ghostscript binary print -dpng "-Gcat > debug.eps" out.eps won't work. A hack is visibleto create a shell script(myredirect.sh in my case ) which does the redirection:   #!/bin/bash rm debug.eps while read x ; do echo $x >> debug.eps ; done Which can then be used with print -dpng "-G./myredirect.sh" out.eps Another way is to directly use the opengl_renderer to draw to gl2ps.paperposition, papersize and so on are ignored in this case. This uses [http://geuz.org/gl2ps/| GL2PS_BSP_SORT], see [http://savannahen.gnuwikipedia.org/bugswiki/?33180Binary_space_partitioning| BSP on wikipedia] drawnow ("eps", "cat > out.eps") For 2D plots a simpler algorithm(GL2PS_SIMPLE_SORT) is choosen but you can force this also for 3D plots: drawnow ("epsis2d", "cat > out.eps")
== some Windows issues ==
* A user had problems printing with fltk in windows. After he updated the graphic drivers the problem was gone. http://octave.1599824.n4.nabble.com/Problem-with-Print-under-Octave-3-8-1-under-windows-tp4664755.html
== known bugs == Please see also the [[FAQ]] * A common problem is that printing with fltk only works if the figure is visible, see [http://savannah.gnu.org/bugs/?33180] == Test script scripts ==
{{Code|FLTK printing test script|<syntaxhighlight lang="octave" style="font-size:13px">
title ('Please describe what we should see')
print -depsc junk2.eps
 </syntaxhighlight>}}
217

edits

Navigation menu