Octave – Grafici – XII – 76

rr2

Copio qui continuando da qui.

Uso della proprietà interpreter
All text objects—such as titles, labels, legends, and text—include the property "interpreter" that determines the manner in which special control sequences in the text are rendered.
The interpreter property can take three values: "none", "tex", "latex". If the interpreter is set to "none" then no special rendering occurs—the displayed text is a verbatim copy of the specified text. Currently, the "latex" interpreter is not implemented and is equivalent to "none".
The "tex" option implements a subset of TeX functionality when rendering text. This allows the insertion of special glyphs such as Greek characters or mathematical symbols. Special characters are inserted by using a backslash (\) character followed by a code, as shown in Table 15.1 [qui, non la copio].

Note that for on-screen display the interpreter property is honored by all graphics toolkits. However for printing, only the "gnuplot" toolkit renders TeX instructions.
Besides special glyphs, the formatting of the text can be changed within the string by using the codes

  • \bf Bold font
  • \it Italic font
  • \sl Oblique Font
  • \rm Normal font

These codes may be used in conjunction with the { and } characters to limit the change to a part of the string. For example, xlabel ('{\bf H} = a {\bf V}') where the character ‘a‘ will not appear in bold font. Note that to avoid having Octave interpret the backslash character in the strings, the strings themselves should be in single quotes.
It is also possible to change the fontname and size within the text

  • \fontname{fontname} Specify the font to use
  • \fontsize{size} Specify the size of the font to use

The color of the text may also be changed inline using either a string (e.g., "red") or numerically with a Red-Green-Blue (RGB) specification (.e.g., [1 0 0], also red).

  • \color{color} Specify the color as a string
  • \color[rgb]{R G B} Specify the color numerically

Finally, superscripting and subscripting can be controlled with the ‘^‘ and ‘_‘ characters. If the ‘^‘ or ‘_‘ is followed by a { character, then all of the block surrounded by the { } pair is superscripted or subscripted. Without the { } pair, only the character immediately following the ‘^‘ or ‘_‘ is changed.
E qui viene la famosa Tabella che non riporto, è qui.

A complete example showing the capabilities of the extended text

x = 0:0.01:3;
plot (x, erf (x));
hold on;
plot (x,x,"r");
axis ([0, 3, 0, 1]);
text (0.65, 0.6175, strcat ('\leftarrow x = {2/\surd\pi',
' {\fontsize{16}\int_{\fontsize{8}0}^{\fontsize{8}x}}',
' e^{-t^2} dt} = 0.6175'))

o388

Continuo, passo qui.

Stampare e salvare grafici
The print command allows you to send plots to you printer and to save plots in a variety of formats. For example, print -dpsc prints the current figure to a color PostScript printer. And, print -deps foo.eps saves the current figure to an encapsulated PostScript file called foo.eps.

o389

Nonostante il warning il file foo.eps viene prodotto (13.4 MB), questo

o390

Viene prodotto anche con estensione sbagliata, ovvamente sempre postscript. Per ottenere il .png il comando è print -dpng foo.png (572 kB).

The different graphic toolkits have different print capabilities. In particular, the OpenGL based toolkits such as fltk do not support the "interpreter" property of text objects. This means special symbols drawn with the "tex" interpreter will appear correctly on-screen but will be rendered with interpreter "none" when printing. Switch graphics toolkits for printing if this is a concern.

Function File: print ()
Function File: print (options)
Function File: print (filename, options)
Function File: print (h, filename, options)

Print a plot, or save it to a file.
Both output formatted for printing (PDF and PostScript), and many bitmapped and vector image formats are supported.
filename defines the name of the output file. If the file name has no suffix, one is inferred from the specified device and appended to the file name. If no filename is specified, the output is sent to the printer.
h specifies the handle of the figure to print. If no handle is specified the current figure is used.
For output to a printer, PostScript file, or PDF file, the paper size is specified by the figure’s papersize property. The location and size of the image on the page are specified by the figure’s paperposition property. The orientation of the page is specified by the figure’s paperorientation property.
The width and height of images are specified by the figure’s paperpositon(3:4) property values.

The print command supports many options (segue tbella kilometrica che non riporto).

Esempi

Print to a file using the pdf device.
figure (1);
clf ();
surf (peaks);
print figure1.pdf

Print to a file using jpg device.
clf ();
surf (peaks);
print -djpg figure2.jpg

Print to a file using png device.
clf ();
surf (peaks);
print -dpng ping.png

Print to printer named PS_printer using ps format.
clf ();
surf (peaks);
print -dpswrite -PPS_printer
Ovviamente PS_printer deve esistere; io ottengo questo:

o391

Function File: saveas (h, filename)
Function File: saveas (h, filename, fmt)

Save graphic object h to the file filename in graphic format fmt.
fmt should be one of the following formats: ps, eps, ipg, png, emf, pdf.
All device formats specified in print may also be used. If fmt is omitted it is extracted from the extension of filename. The default format is "pdf".

Function File: orient (orientation)
Function File: orient (hfig, orientation)
Function File: orientation = orient ()
Function File: orientation = orient (hfig)

Query or set the print orientation for figure hfig.
Valid values for orientation are "portrait", "landscape", and "tall".
The "landscape" option changes the orientation so the plot width is larger than the plot height. The "paperposition" is also modified so that the plot fills the page, while leaving a 0.25 inch border.
The "tall" option sets the orientation to "portrait" and fills the page with the plot, while leaving a 0.25 inch border.
The "portrait" option (default) changes the orientation so the plot height is larger than the plot width. It also restores the default "paperposition" property.
When called with no arguments, return the current print orientation.
If the argument hfig is omitted, then operate on the current figure returned by gcf.

clf ();
h = surf (peaks);
saveas (h, "p-ls.png", "png")

o392

clf ();
orient ("landscape")
h = surf (peaks);
saveas (h, "ls.png", "png")

o393

clf ();
orient ("portrait")
h = surf (peaks);
saveas (h, "po.png", "png")

o394

Sì, a me sembrano invertiti, ma è così (pare) 😳

print and saveas are used when work on a plot has finished and the output must be in a publication-ready format. During intermediate stages it is often better to save the graphics object and all of its associated information so that changes—to colors, axis limits, marker styles, etc.—can be made easily from within Octave. The hgsave/hgload commands can be used to save and re-create a graphics object.
Qui dissento, ma forse sono solo io…

Function File: hgsave (filename)
Function File: hgsave (h, filename)
Function File: hgsave (h, filename, fmt)

Save the graphics handle h to the file filename in the format fmt.
If unspecified, h is the current figure as returned by gcf.
When filename does not have an extension the default filename extension .ofig will be appended.
If present, fmt should be one of the following:

  • -binary, -float-binary
  • -hdf5, -float-hdf5
  • -V7, -v7, -7, -mat7-binary
  • -V6, -v6, -6, -mat6-binary
  • -text
  • -zip, -z

Function File: h = hgload (filename)
Load the graphics object in filename into the graphics handle h.
If filename has no extension, Octave will try to find the file with and without the standard extension of .ofig.

o395

e poi

o396

:mrgreen:

Posta un commento o usa questo indirizzo per il trackback.

Trackback

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

Questo sito utilizza Akismet per ridurre lo spam. Scopri come vengono elaborati i dati derivati dai commenti.

%d blogger hanno fatto clic su Mi Piace per questo: