Class: Tioga::FigureMaker

Inherits:
Object
  • Object
show all
Extended by:
HashArguments
Includes:
Dobjects, Flate, FigureConstants, HashArguments
Defined in:
lib/Tioga/Doc.rb,
lib/Tioga/FigMkr.rb,
lib/Tioga/TexPreamble.rb,
ext/Tioga/FigureMaker/figures.c

Constant Summary collapse

SVN_URL =

This URL will contain tioga-(…) when it is exported from the SVN repository. This is where we’ll look for version information.

'$HeadURL$'
TIOGA_VERSION =

TIOGA_VERSION = if SVN_URL =~ /tags/tioga/Tioga%20(+)/

   $1
 else
   "SVN version"
end
"1.19.1"
Required =
'!required!'.to_sym
Save_legend_info_args =
{
  'text' => nil,
  'dy' => :legend_text_dy,
  'line_color' => :line_color,
  'line_width' => :line_width,
  'line_cap' => :line_cap,
  'line_type' => :line_type,
  'stroke_color' => nil,
  'stroke_width' => nil,
  'marker' => nil,
  'marker_dict' => nil, # use again #prepare_argument_hash ?
  'marker_color' => nil,
  'marker_scale' => nil,
}
TEX_PREAMBLE =
<<'End_of_preamble'
\makeatletter
% Here are some command to ease the use of pictures produced by Tioga
% within a LaTeX document.


% \tiogafigurefullpage[minwhitespace]{figurename}
%
% \tiogafigurefullpage shows a version of the picture scaled to fit the 
% paper size minus the minwhitespace.  The minwhitespace is the sum of 
% the margins on both sides, top and bottom or left and right. 
% The minwhitespace defaults to 2 inches.
%
\newcommand{\tiogafigurefullpage}[2][2in]{
  \tiogafigurescaledtofit{#2}{\paperwidth - (#1)}{\paperheight - (#1)}}


% \tiogafigurescaledtofit{figurename}{maxwidth}{maxheight}
%
% \tiogafigurescaledtofit shows a version of the picture scaled to fit the
% given width and height while preserving the aspect ratio.
% The 1st arg is the base name for the pdf and txt files.
% The 2nd arg determines the maximum figure width.
% The 3rd arg determines the maximum figure height.
\newcommand{\tiogafigurescaledtofit}[3]{
  \setkeys{Gin}{keepaspectratio=true}
  \resizebox{#2}{#3}{\tiogafigureshow{#1}}}


% \tiogafigurescaled{figurename}{scalefactor}
%
% \tiogafigurescaled shows a scaled version of the picture
% The 1st arg is the base name for the pdf and txt files.
% The 2nd arg determines the scale.
\newcommand{\tiogafigurescaled}[2]{
  \scalebox{#2}{\tiogafigureshow{#1}}}


% \tiogafigurescaledxy{figurename}{xscalefactor}{yscalefactor}
%
% \tiogafigurescaledxy shows a scaled version of the picture where you
% can use different scaling factors in the horizontal and vertical directions.
% The 1st arg is the base name for the pdf and txt files.
% The 2nd arg determines the horizontal scale.
% The 3rd arg determines the vertical scale.
\newcommand{\tiogafigurescaledxy}[3]{
  \scalebox{#2}[#3]{\tiogafigureshow{#1}}}


% \tiogafiguresized{figurename}{figurewidth}{figureheight}
%
% \tiogafiguresized shows a scaled version of the picture, where you
% can specify the actual size you want.  If either length is
% given as !, the one scale factor is used in both directions.
% The 1st arg is the base name for the pdf and txt files.
% The 2nd arg determines the figure width.
% The 3rd arg determines the figure height.
\newcommand{\tiogafiguresized}[3]{
  \resizebox{#2}{#3}{\tiogafigureshow{#1}}}


% \tiogaprefix can be used to set a path for the figure pdf and txt files.
%
\newcommand{\tiogaprefix}{}
% The prefix is initialized to an empty string.  
% To change it, use \renewcommand as in the following example:
% \renewcommand{\tiogaprefix}{plot_out/}


% \tiogafigurecentered{figurename}{targetwidth}{targetheight}
%
% \tiogafigurecentered displays an unscaled figure centered within
% a box of targetwidth *targetheight.
\newcommand{\tiogafigurecentered}[3]{
\vbox to #3{%
\vspace*{\fill}%
\hbox to #2{\hfill%
\tiogafigureshow{#1}%
\hspace*{\fill}}%
\vspace*{\fill}%
}}

% \tiogafigurecentereddebug{figurename}{targetwidth}{targetheight}
%
% \tiogafigurecentereddebug has the same effect as \tiogafigurecentered
% except that the figure is included in a \fbox, which makes it easier
% to track problems.
\newcommand{\tiogafigurecentereddebug}[3]{
\vbox to #3{%
\vspace*{\fill}%
\hbox to #2{\hfill%
\fbox{\tiogafigureshow{#1}}
\hspace*{\fill}}%
\vspace*{\fill}%
}}


% \tiogafigureshow{figurename}
%
% \tiogafigureshow shows the figure and the accompanying text.
% Inside a box, it first creates a picture that includes the pdf
% file with the graphics for the figure, then it includes the text.
% The \tiogaprefix is added at the start of the file names for both.
\newcommand{\tiogafigureshow}[1]{%
  \mbox{\begin{picture}(0,0)(0,0)%
      \put(0,0){\includegraphics{\tiogaprefix#1_figure.pdf}}%
    \end{picture}%
    \input{\tiogaprefix#1_figure.txt}}}

% Commands for text properties:
% Font size (two parameters)
% {sz}{line_sp}, 1st is size of font in points,
% 2nd is line spacing (not used by Tioga)
\newcommand\tiog@fontsize{{10.0}{10pt}}
\newcommand\settiogafontsize[2][10pt]{\renewcommand\tiog@fontsize{{#2}{#1}}}

% Font family
% \rmdefault, \sfdefault, \ttdefault  -- roman, sans serif, typewriter
\newcommand\tiog@fontfamily{\rmdefault}
\newcommand\settiogafontfamily[1]{\renewcommand\tiog@fontfamily{#1}}

% Font series
% \mddefault, \bfdefault -- medium, bold 
\newcommand\tiog@fontseries{\mddefault}
\newcommand\settiogafontseries[1]{\renewcommand\tiog@fontseries{#1}}

% Font shape
% \updefault, \itdefault, \sldefault, \scdefault -- upright, italic, slant, small caps
\newcommand\tiog@fontshape{\updefault}
\newcommand\settiogafontshape[1]{\renewcommand\tiog@fontshape{#1}}

% \SetTiogaFontInfo is called from within the figure.txt file with the TeX
% for the text of the figure. Do not modify this function directly, it
% is way better to use the previous settiogafont* commands.
\newcommand\SetTiogaFontInfo{%
\expandafter\fontsize\tiog@fontsize%
\fontfamily{\tiog@fontfamily}% 
\fontseries{\tiog@fontseries}%
\fontshape{\tiog@fontshape}%
}

% This command is used inside the _figure.txt files. You can use it directly
% as well, if you really want to make sure you get the same fonts. But I
% personnaly doubt it would really come in useful ;-)...
\newcommand\tiogasetfont{\reset@font\SetTiogaFontInfo%
\selectfont}%


% This commands typesets its second argument while sending to the
% standard output successively the width, height and depth of the
% box produced.
%
% These informations are collected when Tioga runs pdflatex.
\newlength{\tiogatempdim}
\newcommand{\tiogameasure}[2]{%
\settowidth{\tiogatempdim}{#2}\typeout{#1[0]=\the\tiogatempdim}%
\settoheight{\tiogatempdim}{#2}\typeout{#1[1]=\the\tiogatempdim}%
\settodepth{\tiogatempdim}{#2}\typeout{#1[2]=\the\tiogatempdim}%
{#2}}

\makeatother
End_of_preamble
COLOR_PREAMBLE =
<<'End_of_preamble'
% Color constants, generated from ColorConstants.rb
\definecolor{PaleTurquoise}{rgb}{0.688,0.932,0.932}
\definecolor{GreenYellow}{rgb}{0.680,1.000,0.185}
\definecolor{SpringGreen}{rgb}{0.000,1.000,0.498}
\definecolor{LightTurquoise}{rgb}{0.200,1.000,0.800}
\definecolor{DarkGrey}{rgb}{0.664,0.664,0.664}
\definecolor{DarkSlateGray}{rgb}{0.185,0.310,0.310}
\definecolor{RedBrown}{rgb}{0.800,0.400,0.200}
\definecolor{LightBrightGreen}{rgb}{0.000,0.800,0.200}
\definecolor{BlueViolet}{rgb}{0.540,0.170,0.888}
\definecolor{MediumOrchid}{rgb}{0.730,0.332,0.828}
\definecolor{Navy}{rgb}{0.000,0.000,0.500}
\definecolor{Gainsboro}{rgb}{0.864,0.864,0.864}
\definecolor{Sienna}{rgb}{0.628,0.320,0.176}
\definecolor{LightRose}{rgb}{1.000,0.600,0.800}
\definecolor{Cornsilk}{rgb}{1.000,0.972,0.864}
\definecolor{Peru}{rgb}{0.804,0.520,0.248}
\definecolor{Indigo}{rgb}{0.294,0.000,0.510}
\definecolor{Aquamarine}{rgb}{0.498,1.000,0.830}
\definecolor{Tomato}{rgb}{1.000,0.390,0.280}
\definecolor{LimeGreen}{rgb}{0.196,0.804,0.196}
\definecolor{DarkOrange}{rgb}{1.000,0.550,0.000}
\definecolor{RoyalPurple}{rgb}{0.400,0.000,0.600}
\definecolor{LightGold}{rgb}{0.800,0.800,0.400}
\definecolor{Burgundy}{rgb}{0.600,0.000,0.200}
\definecolor{MediumTurquoise}{rgb}{0.284,0.820,0.800}
\definecolor{DeepPink}{rgb}{1.000,0.080,0.576}
\definecolor{GrassGreen}{rgb}{0.200,0.600,0.000}
\definecolor{SlateGrey}{rgb}{0.440,0.500,0.565}
\definecolor{LightSkyBlue}{rgb}{0.530,0.808,0.980}
\definecolor{DarkCyan}{rgb}{0.000,0.545,0.545}
\definecolor{OrangeRed}{rgb}{1.000,0.270,0.000}
\definecolor{Purple}{rgb}{0.500,0.000,0.500}
\definecolor{LavenderBlush}{rgb}{1.000,0.940,0.960}
\definecolor{Black}{rgb}{0.000,0.000,0.000}
\definecolor{White}{rgb}{1.000,1.000,1.000}
\definecolor{MediumAquamarine}{rgb}{0.400,0.804,0.668}
\definecolor{DarkRoyalBlue}{rgb}{0.000,0.200,0.800}
\definecolor{SalmonRed}{rgb}{1.000,0.400,0.400}
\definecolor{LightMustard}{rgb}{1.000,0.800,0.400}
\definecolor{Chiffon}{rgb}{0.980,0.980,0.824}
\definecolor{MistyRose}{rgb}{1.000,0.894,0.884}
\definecolor{FireBrick}{rgb}{0.698,0.132,0.132}
\definecolor{SteelBlue}{rgb}{0.275,0.510,0.705}
\definecolor{LightYellow}{rgb}{1.000,1.000,0.880}
\definecolor{DarkKhaki}{rgb}{0.740,0.716,0.420}
\definecolor{PaleVioletRed}{rgb}{0.860,0.440,0.576}
\definecolor{Grey}{rgb}{0.500,0.500,0.500}
\definecolor{LightCoral}{rgb}{0.940,0.500,0.500}
\definecolor{BrickRed}{rgb}{0.645,0.000,0.129}
\definecolor{MediumPurple}{rgb}{0.576,0.440,0.860}
\definecolor{DarkSlateGrey}{rgb}{0.185,0.310,0.310}
\definecolor{RedOrange}{rgb}{0.800,0.200,0.000}
\definecolor{Silver}{rgb}{0.752,0.752,0.752}
\definecolor{LightSalmon}{rgb}{1.000,0.628,0.480}
\definecolor{Crimson}{rgb}{0.800,0.000,0.200}
\definecolor{OldLace}{rgb}{0.992,0.960,0.900}
\definecolor{GhostWhite}{rgb}{0.972,0.972,1.000}
\definecolor{Avocado}{rgb}{0.600,0.600,0.000}
\definecolor{Turquoise}{rgb}{0.250,0.880,0.815}
\definecolor{Linen}{rgb}{0.980,0.940,0.900}
\definecolor{DarkOrchid}{rgb}{0.600,0.196,0.800}
\definecolor{Pink}{rgb}{1.000,0.752,0.796}
\definecolor{Ivory}{rgb}{1.000,1.000,0.940}
\definecolor{BurlyWood}{rgb}{0.870,0.720,0.530}
\definecolor{MediumVioletRed}{rgb}{0.780,0.084,0.520}
\definecolor{DeepSkyBlue}{rgb}{0.000,0.750,1.000}
\definecolor{SaddleBrown}{rgb}{0.545,0.270,0.075}
\definecolor{LightGrassGreen}{rgb}{0.400,1.000,0.400}
\definecolor{LightSlateGray}{rgb}{0.468,0.532,0.600}
\definecolor{DarkGoldenrod}{rgb}{0.720,0.525,0.044}
\definecolor{Orchid}{rgb}{0.855,0.440,0.840}
\definecolor{Gray}{rgb}{0.500,0.500,0.500}
\definecolor{Smoke}{rgb}{0.950,0.950,0.950}
\definecolor{WhiteSmoke}{rgb}{0.970,0.970,0.970}
\definecolor{MediumBlue}{rgb}{0.000,0.000,0.804}
\definecolor{DarkSalmon}{rgb}{0.912,0.590,0.480}
\definecolor{PurpleBlue}{rgb}{0.400,0.200,0.800}
\definecolor{LawnGreen}{rgb}{0.488,0.990,0.000}
\definecolor{BlanchedAlmond}{rgb}{1.000,0.920,0.804}
\definecolor{Chocolate}{rgb}{0.824,0.410,0.116}
\definecolor{Moccasin}{rgb}{1.000,0.894,0.710}
\definecolor{FloralWhite}{rgb}{1.000,0.980,0.940}
\definecolor{SandyBrown}{rgb}{0.956,0.644,0.376}
\definecolor{LightOliveGreen}{rgb}{0.600,0.800,0.600}
\definecolor{DarkLavender}{rgb}{0.400,0.200,0.600}
\definecolor{PapayaWhip}{rgb}{1.000,0.936,0.835}
\definecolor{Honeydew}{rgb}{0.940,1.000,0.940}
\definecolor{AliceBlue}{rgb}{0.940,0.972,1.000}
\definecolor{Tan}{rgb}{0.824,0.705,0.550}
\definecolor{LightYellowGreen}{rgb}{0.800,0.800,0.200}
\definecolor{MediumSeaGreen}{rgb}{0.235,0.700,0.444}
\definecolor{DarkSmoke}{rgb}{0.920,0.920,0.920}
\definecolor{Rose}{rgb}{1.000,0.400,0.600}
\definecolor{LightCrimson}{rgb}{0.864,0.080,0.235}
\definecolor{BrightBlue}{rgb}{0.000,0.400,1.000}
\definecolor{Olive}{rgb}{0.500,0.500,0.000}
\definecolor{Gold}{rgb}{1.000,0.844,0.000}
\definecolor{SkyBlue}{rgb}{0.530,0.808,0.920}
\definecolor{LightSandyBrown}{rgb}{1.000,0.800,0.600}
\definecolor{Cyan}{rgb}{0.000,1.000,1.000}
\definecolor{DarkPeriwinkle}{rgb}{0.400,0.400,1.000}
\definecolor{Plum}{rgb}{0.868,0.628,0.868}
\definecolor{Khaki}{rgb}{0.940,0.900,0.550}
\definecolor{Azure}{rgb}{0.940,1.000,1.000}
\definecolor{Violet}{rgb}{0.932,0.510,0.932}
\definecolor{Magenta}{rgb}{1.000,0.000,1.000}
\definecolor{DimGray}{rgb}{0.410,0.410,0.410}
\definecolor{LightChartreuse}{rgb}{0.800,1.000,0.400}
\definecolor{LightGray}{rgb}{0.828,0.828,0.828}
\definecolor{CadetBlue}{rgb}{0.372,0.620,0.628}
\definecolor{YellowGreen}{rgb}{0.800,0.800,0.000}
\definecolor{DarkGray}{rgb}{0.664,0.664,0.664}
\definecolor{LightSlateGrey}{rgb}{0.468,0.532,0.600}
\definecolor{PaleGoldenrod}{rgb}{0.932,0.910,0.668}
\definecolor{GrayBlue}{rgb}{0.000,0.400,0.600}
\definecolor{Snow}{rgb}{1.000,0.980,0.980}
\definecolor{DarkSeaGreen}{rgb}{0.560,0.736,0.560}
\definecolor{Blue}{rgb}{0.000,0.000,1.000}
\definecolor{LemonChiffon}{rgb}{1.000,0.980,0.804}
\definecolor{MediumGreen}{rgb}{0.000,0.600,0.000}
\definecolor{PurpleGray}{rgb}{0.600,0.600,0.800}
\definecolor{Yellow}{rgb}{1.000,1.000,0.000}
\definecolor{Coral}{rgb}{1.000,0.498,0.312}
\definecolor{LightOrchid}{rgb}{0.600,0.400,0.800}
\definecolor{ForestGreen}{rgb}{0.132,0.545,0.132}
\definecolor{MustardSeed}{rgb}{0.800,0.600,0.000}
\definecolor{SeaGreen}{rgb}{0.180,0.545,0.340}
\definecolor{DarkMagenta}{rgb}{0.545,0.000,0.545}
\definecolor{AntiqueWhite}{rgb}{0.980,0.920,0.844}
\definecolor{HotPink}{rgb}{1.000,0.410,0.705}
\definecolor{Lilac}{rgb}{0.800,0.600,1.000}
\definecolor{PeachPuff}{rgb}{1.000,0.855,0.725}
\definecolor{Teal}{rgb}{0.000,0.500,0.500}
\definecolor{DarkTurquoise}{rgb}{0.000,0.808,0.820}
\definecolor{BrightPink}{rgb}{1.000,0.400,0.800}
\definecolor{LightCyan}{rgb}{0.880,1.000,1.000}
\definecolor{MediumSlateBlue}{rgb}{0.484,0.408,0.932}
\definecolor{RosyBrown}{rgb}{0.736,0.560,0.560}
\definecolor{GoldenBrown}{rgb}{0.600,0.400,0.000}
\definecolor{DarkBlue}{rgb}{0.000,0.000,0.545}
\definecolor{LightSeaGreen}{rgb}{0.125,0.698,0.668}
\definecolor{OliveDrab}{rgb}{0.420,0.556,0.136}
\definecolor{SlateBlue}{rgb}{0.415,0.352,0.804}
\definecolor{DarkPurpleBlue}{rgb}{0.400,0.000,0.800}
\definecolor{Beige}{rgb}{0.960,0.960,0.864}
\definecolor{Lavender}{rgb}{0.900,0.900,0.980}
\definecolor{Maroon}{rgb}{0.500,0.000,0.000}
\definecolor{PowderBlue}{rgb}{0.690,0.880,0.900}
\definecolor{WarmGray}{rgb}{0.678,0.660,0.562}
\definecolor{DimGrey}{rgb}{0.410,0.410,0.410}
\definecolor{Cement}{rgb}{0.800,0.800,0.600}
\definecolor{LightGreen}{rgb}{0.565,0.932,0.565}
\definecolor{MidnightBlue}{rgb}{0.098,0.098,0.440}
\definecolor{Saffron}{rgb}{1.000,0.800,0.000}
\definecolor{Green}{rgb}{0.000,0.500,0.000}
\definecolor{DarkGreen}{rgb}{0.000,0.392,0.000}
\definecolor{LightSteelBlue}{rgb}{0.690,0.770,0.870}
\definecolor{PaleGreen}{rgb}{0.596,0.985,0.596}
\definecolor{SoftYellow}{rgb}{1.000,1.000,0.400}
\definecolor{LightBlue}{rgb}{0.680,0.848,0.900}
\definecolor{DarkSlateBlue}{rgb}{0.284,0.240,0.545}
\definecolor{BlueGreen}{rgb}{0.000,0.600,0.400}
\definecolor{MediumOrange}{rgb}{1.000,0.400,0.000}
\definecolor{Red}{rgb}{1.000,0.000,0.000}
\definecolor{Fuchsia}{rgb}{1.000,0.000,1.000}
\definecolor{CornflowerBlue}{rgb}{0.392,0.585,0.930}
\definecolor{LightPlum}{rgb}{0.800,0.600,0.800}
\definecolor{NavajoWhite}{rgb}{1.000,0.870,0.680}
\definecolor{Seashell}{rgb}{1.000,0.960,0.932}
\definecolor{Aqua}{rgb}{0.000,1.000,1.000}
\definecolor{IndianRed}{rgb}{0.804,0.360,0.360}
\definecolor{DarkOliveGreen}{rgb}{0.332,0.420,0.185}
\definecolor{Lime}{rgb}{0.000,1.000,0.000}
\definecolor{Periwinkle}{rgb}{0.600,0.000,1.000}
\definecolor{Thistle}{rgb}{0.848,0.750,0.848}
\definecolor{Brown}{rgb}{0.648,0.165,0.165}
\definecolor{LightDullGreen}{rgb}{0.400,1.000,0.600}
\definecolor{DarkViolet}{rgb}{0.580,0.000,0.828}
\definecolor{MediumSpringGreen}{rgb}{0.000,0.980,0.604}
\definecolor{RoyalBlue}{rgb}{0.255,0.410,0.884}
\definecolor{LightSienna}{rgb}{0.800,0.400,0.000}
\definecolor{Goldenrod}{rgb}{0.855,0.648,0.125}
\definecolor{DarkChocolate}{rgb}{0.400,0.200,0.000}
\definecolor{Orange}{rgb}{1.000,0.648,0.000}
\definecolor{SlateGray}{rgb}{0.440,0.500,0.565}
\definecolor{Bisque}{rgb}{1.000,0.894,0.770}
\definecolor{LavenderBlue}{rgb}{0.400,0.200,1.000}
\definecolor{DarkRed}{rgb}{0.545,0.000,0.000}
\definecolor{Mauve}{rgb}{0.800,0.200,0.400}
\definecolor{Pumpkin}{rgb}{1.000,0.600,0.200}
\definecolor{Wheat}{rgb}{0.960,0.870,0.700}
\definecolor{Chartreuse}{rgb}{0.498,1.000,0.000}
\definecolor{LightGrey}{rgb}{0.828,0.828,0.828}
\definecolor{DodgerBlue}{rgb}{0.116,0.565,1.000}
\definecolor{MintCream}{rgb}{0.960,1.000,0.980}
\definecolor{Salmon}{rgb}{0.980,0.500,0.448}

End_of_preamble
@@default_figure_maker =
nil
@@which_pdflatex =
nil
@@initialized =

set true by the C code when first make a figure

false
@@keys_for_save_legend_info =
FigureMaker.make_name_lookup_hash(['text', 'dy',
'line_color', 'stroke_color', 'line_width', 'stroke_width', 
'line_cap', 'line_type', 'marker', 'marker_color', 'marker_scale', 'marker_dict' ])
@@keys_for_set_subframe =
FigureMaker.make_name_lookup_hash(['margins',
'left_margin', 'right_margin', 'top_margin', 'bottom_margin',
'left', 'right', 'plot_left_margin', 'top', 'bottom' ])
@@keys_for_set_bounds =
FigureMaker.make_name_lookup_hash([
'bounds_left', 'bounds_right', 'bounds_top', 'bounds_bottom',
'left_boundary', 'right_boundary', 'top_boundary', 'bottom_boundary', 'boundaries' ])
@@keys_for_column_margins =
FigureMaker.make_name_lookup_hash([
'left_margin', 'right_margin', 'column_margin', 'column',
'first_column', 'last_column', 'num_columns' ])
@@keys_for_row_margins =
FigureMaker.make_name_lookup_hash([
'top_margin', 'bottom_margin', 'row_margin', 'row',
'first_row', 'last_row', 'num_rows' ])
@@keys_for_show_grid =
%w[
  stroke_color line_type rescale_lines line_width stroke_opacity stroke_transparency
]
@@keys_for_show_plot_with_legend =
FigureMaker.make_name_lookup_hash([
'legend_top_margin', 'legend_bottom_margin', 'legend_left_margin', 'legend_right_margin',
'plot_top_margin', 'plot_bottom_margin', 'plot_left_margin', 'plot_right_margin',
'plot_scale', 'legend_scale', 'legend_background_function' ])
@@keys_for_make_contour =
FigureMaker.make_name_lookup_hash([
'dest_xs', 'dest_ys', 'z_level', 'z', 'level', 'xs', 'ys', 'gaps', 'zs', 'data', 'legit', 'method'])
@@keys_for_make_steps =
FigureMaker.make_name_lookup_hash([
'xfirst', 'x_first', 'yfirst', 'y_first', 'xlast', 'x_last', 'ylast', 'y_last',
'xs', 'ys', 'dest_xs', 'dest_ys'])
@@keys_for_make_curves =
FigureMaker.make_name_lookup_hash([
'start_slope', 'end_slope', 'xs', 'ys', 'sample_xs', 'result_ys'])
@@keys_for_make_interpolant =
FigureMaker.make_name_lookup_hash([
'start_slope', 'end_slope', 'xs', 'ys'])
@@keys_for_show_error_bars =
FigureMaker.make_name_lookup_hash(['x', 'y', 'dx', 'dy',
'dx_plus', 'dx_minus', 'dy_plus', 'dy_minus', 'color', 'end_cap', 'line_width'])
@@keys_for_show_arrow =
FigureMaker.make_name_lookup_hash([
'x_head', 'y_head', 'x_tail', 'y_tail', 'head', 'tail',
'color', 'head_color', 'tail_color', 'line_color', 
'line_style', 
'head_marker', 'tail_marker', 'line_width', 
'head_angle', 'head_just', 'tail_just', 'tail_angle',   
'head_scale', 'tail_scale'])
@@keys_for_axial_shading =
FigureMaker.make_name_lookup_hash(['extend_start', 'extend_end',
'x_start', 'y_start', 'start', 'start_point', 'x_end', 'y_end', 'end', 'end_point', 'colormap', 'color_map'])
@@keys_for_radial_shading =
FigureMaker.make_name_lookup_hash(['extend_start', 'extend_end',
'x_start', 'y_start', 'radius_start', 'start_radius', 'start', 'start_circle',
'x_end', 'y_end', 'radius_start', 'end_radius', 'end', 'end_circle',
'colormap', 'color_map', 'x_hat', 'y_hat', 'xhat', 'yhat'])
@@keys_for_show_image =
FigureMaker.make_name_lookup_hash([
'll', 'lr', 'ul', 'w', 'width', 'height', 'h', 'ref',
'opacity_mask', 'stencil_mask', 'bits', 'pdf_filters',
'jpg', 'JPG', 'jpeg', 'JPEG', 'interpolate', 'data', 'value_mask',
'color_space', 'color_map', 'colormap'])
@@keys_for_create_colormap =
FigureMaker.make_name_lookup_hash(['length', 'points', 'Rs', 'Gs', 'Bs', 'Hs', 'Ls', 'Ss'])
@@keys_for_create_gradient_colormap =
FigureMaker.make_name_lookup_hash([
'hue', 'starting_H', 'ending_H',
'lightness', 'starting_L', 'ending_L', 'saturation', 'starting_S', 'ending_S'])
@@keys_for_create_image_data =
FigureMaker.make_name_lookup_hash([
'first_row', 'last_row', 'first_column', 'last_column',
'min_value', 'max_value', 'max_code', 'if_below_range', 'if_above_range', 'masking'])
@@keys_for_create_monochrome_image_data =
FigureMaker.make_name_lookup_hash([
'first_row', 'last_row', 'first_column', 'last_column', 'boundary', 'reverse'])
@@keys_for_show_marker =
FigureMaker.make_name_lookup_hash([
'marker', 'x', 'y', 'at', 'point', 'Xs', 'Ys', 'xs', 'ys', 'mode', 'rendering_mode', 'legend',
'angle', 'scale', 'font', 'string', 'text', 'color', 'fill_color', 'stroke_color', 'stroke_width',
'horizontal_scale', 'vertical_scale', 'italic_angle', 'ascent_angle', 'alignment', 'justification'])
@@keys_for_show_text =
FigureMaker.make_name_lookup_hash([
'text', 'side', 'loc', 'position', 'pos', 'x', 'y',
'shift', 'scale', 'color', 'angle', 'alignment', 'justification', 'at', 'point', 'measure'])

Constants included from FigureConstants

Tioga::FigureConstants::ALIGNED_AT_BASELINE, Tioga::FigureConstants::ALIGNED_AT_BOTTOM, Tioga::FigureConstants::ALIGNED_AT_MIDHEIGHT, Tioga::FigureConstants::ALIGNED_AT_TOP, Tioga::FigureConstants::AT_X_ORIGIN, Tioga::FigureConstants::AT_Y_ORIGIN, Tioga::FigureConstants::AXIS_HIDDEN, Tioga::FigureConstants::AXIS_LINE_ONLY, Tioga::FigureConstants::AXIS_WITH_MAJOR_TICKS_AND_NUMERIC_LABELS, Tioga::FigureConstants::AXIS_WITH_MAJOR_TICKS_ONLY, Tioga::FigureConstants::AXIS_WITH_TICKS_AND_NUMERIC_LABELS, Tioga::FigureConstants::AXIS_WITH_TICKS_ONLY, Tioga::FigureConstants::BOTTOM, Tioga::FigureConstants::CENTERED, Tioga::FigureConstants::CLIP, Tioga::FigureConstants::DEGREES_PER_RADIAN, Tioga::FigureConstants::DISCARD, Tioga::FigureConstants::EDGE_HIDDEN, Tioga::FigureConstants::EDGE_LINE_ONLY, Tioga::FigureConstants::EDGE_WITH_MAJOR_TICKS_ONLY, Tioga::FigureConstants::EDGE_WITH_TICKS, Tioga::FigureConstants::FILL, Tioga::FigureConstants::FILL_AND_CLIP, Tioga::FigureConstants::FILL_AND_STROKE, Tioga::FigureConstants::FILL_STROKE_AND_CLIP, Tioga::FigureConstants::LEFT, Tioga::FigureConstants::LEFT_JUSTIFIED, Tioga::FigureConstants::LINE_CAP_BUTT, Tioga::FigureConstants::LINE_CAP_ROUND, Tioga::FigureConstants::LINE_CAP_SQUARE, Tioga::FigureConstants::LINE_JOIN_BEVEL, Tioga::FigureConstants::LINE_JOIN_MITER, Tioga::FigureConstants::LINE_JOIN_ROUND, Tioga::FigureConstants::LINE_TYPE_DASH, Tioga::FigureConstants::LINE_TYPE_DASHES, Tioga::FigureConstants::LINE_TYPE_DOT, Tioga::FigureConstants::LINE_TYPE_DOTS, Tioga::FigureConstants::LINE_TYPE_DOT_DASH, Tioga::FigureConstants::LINE_TYPE_DOT_LONG_DASH, Tioga::FigureConstants::LINE_TYPE_DOT_SHORT_DASH, Tioga::FigureConstants::LINE_TYPE_LONG_DASH, Tioga::FigureConstants::LINE_TYPE_LONG_DASHES, Tioga::FigureConstants::LINE_TYPE_SHORT_DASH, Tioga::FigureConstants::LINE_TYPE_SHORT_DASHES, Tioga::FigureConstants::LINE_TYPE_SHORT_DASH_LONG_DASH, Tioga::FigureConstants::LINE_TYPE_SOLID, Tioga::FigureConstants::Line_Type_Dash, Tioga::FigureConstants::Line_Type_Dashes, Tioga::FigureConstants::Line_Type_Dot, Tioga::FigureConstants::Line_Type_Dot_Dash, Tioga::FigureConstants::Line_Type_Dot_Long_Dash, Tioga::FigureConstants::Line_Type_Dot_Short_Dash, Tioga::FigureConstants::Line_Type_Dots, Tioga::FigureConstants::Line_Type_Long_Dash, Tioga::FigureConstants::Line_Type_Long_Dashes, Tioga::FigureConstants::Line_Type_Short_Dash, Tioga::FigureConstants::Line_Type_Short_Dash_Long_Dash, Tioga::FigureConstants::Line_Type_Short_Dashes, Tioga::FigureConstants::Line_Type_Solid, Tioga::FigureConstants::RADIANS_PER_DEGREE, Tioga::FigureConstants::RIGHT, Tioga::FigureConstants::RIGHT_JUSTIFIED, Tioga::FigureConstants::STROKE, Tioga::FigureConstants::STROKE_AND_CLIP, Tioga::FigureConstants::TOP

Constants included from ColorConstants

ColorConstants::AliceBlue, ColorConstants::AntiqueWhite, ColorConstants::Aqua, ColorConstants::Aquamarine, ColorConstants::Avocado, ColorConstants::Azure, ColorConstants::Beige, ColorConstants::Bisque, ColorConstants::Black, ColorConstants::BlanchedAlmond, ColorConstants::Blue, ColorConstants::BlueGreen, ColorConstants::BlueViolet, ColorConstants::BrickRed, ColorConstants::BrightBlue, ColorConstants::BrightPink, ColorConstants::Brown, ColorConstants::Burgundy, ColorConstants::BurlyWood, ColorConstants::CadetBlue, ColorConstants::Cement, ColorConstants::Chartreuse, ColorConstants::Chiffon, ColorConstants::Chocolate, ColorConstants::Coral, ColorConstants::CornflowerBlue, ColorConstants::Cornsilk, ColorConstants::Crimson, ColorConstants::Cyan, ColorConstants::DarkBlue, ColorConstants::DarkChocolate, ColorConstants::DarkCyan, ColorConstants::DarkGoldenrod, ColorConstants::DarkGray, ColorConstants::DarkGreen, ColorConstants::DarkGrey, ColorConstants::DarkKhaki, ColorConstants::DarkLavender, ColorConstants::DarkMagenta, ColorConstants::DarkOliveGreen, ColorConstants::DarkOrange, ColorConstants::DarkOrchid, ColorConstants::DarkPeriwinkle, ColorConstants::DarkPurpleBlue, ColorConstants::DarkRed, ColorConstants::DarkRoyalBlue, ColorConstants::DarkSalmon, ColorConstants::DarkSeaGreen, ColorConstants::DarkSlateBlue, ColorConstants::DarkSlateGray, ColorConstants::DarkSlateGrey, ColorConstants::DarkSmoke, ColorConstants::DarkTurquoise, ColorConstants::DarkViolet, ColorConstants::DeepPink, ColorConstants::DeepSkyBlue, ColorConstants::DimGray, ColorConstants::DimGrey, ColorConstants::DodgerBlue, ColorConstants::FireBrick, ColorConstants::FloralWhite, ColorConstants::ForestGreen, ColorConstants::Fuchsia, ColorConstants::Gainsboro, ColorConstants::GhostWhite, ColorConstants::Gold, ColorConstants::GoldenBrown, ColorConstants::Goldenrod, ColorConstants::GrassGreen, ColorConstants::Gray, ColorConstants::GrayBlue, ColorConstants::Green, ColorConstants::GreenYellow, ColorConstants::Grey, ColorConstants::Honeydew, ColorConstants::HotPink, ColorConstants::IndianRed, ColorConstants::Indigo, ColorConstants::Ivory, ColorConstants::Khaki, ColorConstants::Lavender, ColorConstants::LavenderBlue, ColorConstants::LavenderBlush, ColorConstants::LawnGreen, ColorConstants::LemonChiffon, ColorConstants::LightBlue, ColorConstants::LightBrightGreen, ColorConstants::LightChartreuse, ColorConstants::LightCoral, ColorConstants::LightCrimson, ColorConstants::LightCyan, ColorConstants::LightDullGreen, ColorConstants::LightGold, ColorConstants::LightGrassGreen, ColorConstants::LightGray, ColorConstants::LightGreen, ColorConstants::LightGrey, ColorConstants::LightMustard, ColorConstants::LightOliveGreen, ColorConstants::LightOrchid, ColorConstants::LightPlum, ColorConstants::LightRose, ColorConstants::LightSalmon, ColorConstants::LightSandyBrown, ColorConstants::LightSeaGreen, ColorConstants::LightSienna, ColorConstants::LightSkyBlue, ColorConstants::LightSlateGray, ColorConstants::LightSlateGrey, ColorConstants::LightSteelBlue, ColorConstants::LightTurquoise, ColorConstants::LightYellow, ColorConstants::LightYellowGreen, ColorConstants::Lilac, ColorConstants::Lime, ColorConstants::LimeGreen, ColorConstants::Linen, ColorConstants::Magenta, ColorConstants::Maroon, ColorConstants::Mauve, ColorConstants::MediumAquamarine, ColorConstants::MediumBlue, ColorConstants::MediumGreen, ColorConstants::MediumOrange, ColorConstants::MediumOrchid, ColorConstants::MediumPurple, ColorConstants::MediumSeaGreen, ColorConstants::MediumSlateBlue, ColorConstants::MediumSpringGreen, ColorConstants::MediumTurquoise, ColorConstants::MediumVioletRed, ColorConstants::MidnightBlue, ColorConstants::MintCream, ColorConstants::MistyRose, ColorConstants::Moccasin, ColorConstants::MustardSeed, ColorConstants::NavajoWhite, ColorConstants::Navy, ColorConstants::OldLace, ColorConstants::Olive, ColorConstants::OliveDrab, ColorConstants::Orange, ColorConstants::OrangeRed, ColorConstants::Orchid, ColorConstants::PaleGoldenrod, ColorConstants::PaleGreen, ColorConstants::PaleTurquoise, ColorConstants::PaleVioletRed, ColorConstants::PapayaWhip, ColorConstants::PeachPuff, ColorConstants::Periwinkle, ColorConstants::Peru, ColorConstants::Pink, ColorConstants::Plum, ColorConstants::PowderBlue, ColorConstants::Pumpkin, ColorConstants::Purple, ColorConstants::PurpleBlue, ColorConstants::PurpleGray, ColorConstants::Red, ColorConstants::RedBrown, ColorConstants::RedOrange, ColorConstants::Rose, ColorConstants::RosyBrown, ColorConstants::RoyalBlue, ColorConstants::RoyalPurple, ColorConstants::SaddleBrown, ColorConstants::Saffron, ColorConstants::Salmon, ColorConstants::SalmonRed, ColorConstants::SandyBrown, ColorConstants::SeaGreen, ColorConstants::Seashell, ColorConstants::Sienna, ColorConstants::Silver, ColorConstants::SkyBlue, ColorConstants::SlateBlue, ColorConstants::SlateGray, ColorConstants::SlateGrey, ColorConstants::Smoke, ColorConstants::Snow, ColorConstants::SoftYellow, ColorConstants::SpringGreen, ColorConstants::SteelBlue, ColorConstants::Tan, ColorConstants::Teal, ColorConstants::Thistle, ColorConstants::Tomato, ColorConstants::Turquoise, ColorConstants::Violet, ColorConstants::WarmGray, ColorConstants::Wheat, ColorConstants::White, ColorConstants::WhiteSmoke, ColorConstants::Yellow, ColorConstants::YellowGreen

Constants included from MarkerConstants

MarkerConstants::Arrow, MarkerConstants::ArrowOpen, MarkerConstants::Arrowhead, MarkerConstants::ArrowheadOpen, MarkerConstants::Asterisk, MarkerConstants::AsteriskOpen, MarkerConstants::Bar, MarkerConstants::BarOpen, MarkerConstants::BarThick, MarkerConstants::BarThickOpen, MarkerConstants::BarThin, MarkerConstants::BarThinOpen, MarkerConstants::Box, MarkerConstants::BoxOpen, MarkerConstants::Bullet, MarkerConstants::BulletOpen, MarkerConstants::Check, MarkerConstants::CheckOpen, MarkerConstants::Circle, MarkerConstants::CircleOpen, MarkerConstants::Circled1, MarkerConstants::Circled10, MarkerConstants::Circled2, MarkerConstants::Circled3, MarkerConstants::Circled4, MarkerConstants::Circled5, MarkerConstants::Circled6, MarkerConstants::Circled7, MarkerConstants::Circled8, MarkerConstants::Circled9, MarkerConstants::Club, MarkerConstants::ClubOpen, MarkerConstants::Courier, MarkerConstants::Courier_Bold, MarkerConstants::Courier_BoldOblique, MarkerConstants::Courier_Oblique, MarkerConstants::Cross, MarkerConstants::Diamond, MarkerConstants::DiamondOpen, MarkerConstants::Hand, MarkerConstants::Heart, MarkerConstants::HeartOpen, MarkerConstants::HeartWide, MarkerConstants::HeartWideOpen, MarkerConstants::Helvetica, MarkerConstants::Helvetica_Bold, MarkerConstants::Helvetica_BoldOblique, MarkerConstants::Helvetica_Oblique, MarkerConstants::OtherHand, MarkerConstants::Plus, MarkerConstants::PlusOpen, MarkerConstants::Semicircle, MarkerConstants::SemicircleOpen, MarkerConstants::SolidBall1, MarkerConstants::SolidBall10, MarkerConstants::SolidBall2, MarkerConstants::SolidBall3, MarkerConstants::SolidBall4, MarkerConstants::SolidBall5, MarkerConstants::SolidBall6, MarkerConstants::SolidBall7, MarkerConstants::SolidBall8, MarkerConstants::SolidBall9, MarkerConstants::Spade, MarkerConstants::SpadeOpen, MarkerConstants::Square, MarkerConstants::SquareOpen, MarkerConstants::Star, MarkerConstants::StarOpen, MarkerConstants::Symbol, MarkerConstants::Times, MarkerConstants::TimesOpen, MarkerConstants::Times_Bold, MarkerConstants::Times_BoldItalic, MarkerConstants::Times_Italic, MarkerConstants::Times_Roman, MarkerConstants::TriangleDown, MarkerConstants::TriangleDownOpen, MarkerConstants::TriangleUp, MarkerConstants::TriangleUpOpen, MarkerConstants::ZapfDingbats

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HashArguments

alt_names, check_dict, check_pair, complain_if_missing_numeric_arg, get_dvec, get_if_given_else_default, get_if_given_else_use_default_dict, set_if_given

Methods included from Flate

compress, expand

Constructor Details

#initialize(scaling = 10.0) ⇒ FigureMaker

Returns a new instance of FigureMaker.



354
355
356
357
# File 'lib/Tioga/FigMkr.rb', line 354

def initialize(scaling = 10.0)
    @fm_data = Dvector.new(@@fm_data_size)
    reset_figures(scaling)
end

Instance Attribute Details

#add_model_numberObject

Returns the value of attribute add_model_number.



189
190
191
# File 'lib/Tioga/FigMkr.rb', line 189

def add_model_number
  @add_model_number
end

#auto_refresh_filenameObject

Returns the value of attribute auto_refresh_filename.



191
192
193
# File 'lib/Tioga/FigMkr.rb', line 191

def auto_refresh_filename
  @auto_refresh_filename
end

#autocleanupObject

Whether or not do do automatic cleanup of the files



164
165
166
# File 'lib/Tioga/FigMkr.rb', line 164

def autocleanup
  @autocleanup
end

#create_save_dirObject

Whether or not to create save_dir if it doesn’t exist



161
162
163
# File 'lib/Tioga/FigMkr.rb', line 161

def create_save_dir
  @create_save_dir
end

#current_pdflatex_callObject (readonly)

Returns the value of attribute current_pdflatex_call.



176
177
178
# File 'lib/Tioga/FigMkr.rb', line 176

def current_pdflatex_call
  @current_pdflatex_call
end

#default_frame_bottomObject

Returns the value of attribute default_frame_bottom.



156
157
158
# File 'lib/Tioga/FigMkr.rb', line 156

def default_frame_bottom
  @default_frame_bottom
end

#default_frame_leftObject

Returns the value of attribute default_frame_left.



153
154
155
# File 'lib/Tioga/FigMkr.rb', line 153

def default_frame_left
  @default_frame_left
end

#default_frame_rightObject

Returns the value of attribute default_frame_right.



154
155
156
# File 'lib/Tioga/FigMkr.rb', line 154

def default_frame_right
  @default_frame_right
end

#default_frame_topObject

Returns the value of attribute default_frame_top.



155
156
157
# File 'lib/Tioga/FigMkr.rb', line 155

def default_frame_top
  @default_frame_top
end

#default_page_heightObject

Returns the value of attribute default_page_height.



152
153
154
# File 'lib/Tioga/FigMkr.rb', line 152

def default_page_height
  @default_page_height
end

#default_page_widthObject

Returns the value of attribute default_page_width.



151
152
153
# File 'lib/Tioga/FigMkr.rb', line 151

def default_page_width
  @default_page_width
end

#figure_namesObject (readonly)

Returns the value of attribute figure_names.



127
128
129
# File 'lib/Tioga/FigMkr.rb', line 127

def figure_names
  @figure_names
end

#figure_pdfsObject (readonly)

Returns the value of attribute figure_pdfs.



129
130
131
# File 'lib/Tioga/FigMkr.rb', line 129

def figure_pdfs
  @figure_pdfs
end

#legend_defaultsObject

Returns the value of attribute legend_defaults.



137
138
139
# File 'lib/Tioga/FigMkr.rb', line 137

def legend_defaults
  @legend_defaults
end

#legend_infoObject

Returns the value of attribute legend_info.



121
122
123
# File 'lib/Tioga/FigMkr.rb', line 121

def legend_info
  @legend_info
end

#line_typeObject

Returns the value of attribute line_type.



123
124
125
# File 'lib/Tioga/FigMkr.rb', line 123

def line_type
  @line_type
end

#marker_defaultsObject

Returns the value of attribute marker_defaults.



139
140
141
# File 'lib/Tioga/FigMkr.rb', line 139

def marker_defaults
  @marker_defaults
end

#max_nested_pdflatex_callsObject

Maximum number of pdflatex calls. If nil, then unlimited, but that could be a very bad idea.



175
176
177
# File 'lib/Tioga/FigMkr.rb', line 175

def max_nested_pdflatex_calls
  @max_nested_pdflatex_calls
end

#measure_legendsObject

If we want to use #legend_bounding_box. It is off by default as it causes a systematic second run of pdflatex.



181
182
183
# File 'lib/Tioga/FigMkr.rb', line 181

def measure_legends
  @measure_legends
end

#measures_infoObject

An accessor for @measures_info:



170
171
172
# File 'lib/Tioga/FigMkr.rb', line 170

def measures_info
  @measures_info
end

#model_numberObject

old preview attributes – to be removed later



188
189
190
# File 'lib/Tioga/FigMkr.rb', line 188

def model_number
  @model_number
end

#multithreads_okay_for_tiogaObject

Whether or not do do multithreading for parallel pdflatex calls



167
168
169
# File 'lib/Tioga/FigMkr.rb', line 167

def multithreads_okay_for_tioga
  @multithreads_okay_for_tioga
end

#need_to_reload_dataObject

Returns the value of attribute need_to_reload_data.



190
191
192
# File 'lib/Tioga/FigMkr.rb', line 190

def need_to_reload_data
  @need_to_reload_data
end

#num_error_linesObject

Returns the value of attribute num_error_lines.



158
159
160
# File 'lib/Tioga/FigMkr.rb', line 158

def num_error_lines
  @num_error_lines
end

#num_figuresObject (readonly)

Returns the value of attribute num_figures.



125
126
127
# File 'lib/Tioga/FigMkr.rb', line 125

def num_figures
  @num_figures
end

#pdflatex_errorsObject

Stores the errors recorded in the last run of pdflatex.



184
185
186
# File 'lib/Tioga/FigMkr.rb', line 184

def pdflatex_errors
  @pdflatex_errors
end

#quiet_modeObject

Returns the value of attribute quiet_mode.



135
136
137
# File 'lib/Tioga/FigMkr.rb', line 135

def quiet_mode
  @quiet_mode
end

#run_dirObject (readonly)

Returns the value of attribute run_dir.



131
132
133
# File 'lib/Tioga/FigMkr.rb', line 131

def run_dir
  @run_dir
end

#save_dirObject

Returns the value of attribute save_dir.



133
134
135
# File 'lib/Tioga/FigMkr.rb', line 133

def save_dir
  @save_dir
end

#style_filenameObject

Returns the value of attribute style_filename.



119
120
121
# File 'lib/Tioga/FigMkr.rb', line 119

def style_filename
  @style_filename
end

#tex_fontfamilyObject

Returns the value of attribute tex_fontfamily.



147
148
149
# File 'lib/Tioga/FigMkr.rb', line 147

def tex_fontfamily
  @tex_fontfamily
end

#tex_fontseriesObject

Returns the value of attribute tex_fontseries.



148
149
150
# File 'lib/Tioga/FigMkr.rb', line 148

def tex_fontseries
  @tex_fontseries
end

#tex_fontshapeObject

Returns the value of attribute tex_fontshape.



149
150
151
# File 'lib/Tioga/FigMkr.rb', line 149

def tex_fontshape
  @tex_fontshape
end

#tex_fontsizeObject

Returns the value of attribute tex_fontsize.



146
147
148
# File 'lib/Tioga/FigMkr.rb', line 146

def tex_fontsize
  @tex_fontsize
end

#tex_preambleObject

Returns the value of attribute tex_preamble.



141
142
143
# File 'lib/Tioga/FigMkr.rb', line 141

def tex_preamble
  @tex_preamble
end

#tex_xoffsetObject

attr_accessor :tex_preview_documentclass

attr_accessor :tex_preview_pagestyle attr_accessor :tex_preview_tiogafigure_command



196
197
198
# File 'lib/Tioga/FigMkr.rb', line 196

def tex_xoffset
  @tex_xoffset
end

#tex_yoffsetObject

Returns the value of attribute tex_yoffset.



197
198
199
# File 'lib/Tioga/FigMkr.rb', line 197

def tex_yoffset
  @tex_yoffset
end

#titleObject

Returns the value of attribute title.



107
108
109
# File 'lib/Tioga/FigMkr.rb', line 107

def title
  @title
end

#xaxis_locations_for_major_ticksObject

Returns the value of attribute xaxis_locations_for_major_ticks.



111
112
113
# File 'lib/Tioga/FigMkr.rb', line 111

def xaxis_locations_for_major_ticks
  @xaxis_locations_for_major_ticks
end

#xaxis_locations_for_minor_ticksObject

Returns the value of attribute xaxis_locations_for_minor_ticks.



112
113
114
# File 'lib/Tioga/FigMkr.rb', line 112

def xaxis_locations_for_minor_ticks
  @xaxis_locations_for_minor_ticks
end

#xaxis_numeric_label_texObject

Returns the value of attribute xaxis_numeric_label_tex.



143
144
145
# File 'lib/Tioga/FigMkr.rb', line 143

def xaxis_numeric_label_tex
  @xaxis_numeric_label_tex
end

#xaxis_tick_labelsObject

Returns the value of attribute xaxis_tick_labels.



113
114
115
# File 'lib/Tioga/FigMkr.rb', line 113

def xaxis_tick_labels
  @xaxis_tick_labels
end

#xlabelObject

Returns the value of attribute xlabel.



108
109
110
# File 'lib/Tioga/FigMkr.rb', line 108

def xlabel
  @xlabel
end

#yaxis_locations_for_major_ticksObject

Returns the value of attribute yaxis_locations_for_major_ticks.



115
116
117
# File 'lib/Tioga/FigMkr.rb', line 115

def yaxis_locations_for_major_ticks
  @yaxis_locations_for_major_ticks
end

#yaxis_locations_for_minor_ticksObject

Returns the value of attribute yaxis_locations_for_minor_ticks.



116
117
118
# File 'lib/Tioga/FigMkr.rb', line 116

def yaxis_locations_for_minor_ticks
  @yaxis_locations_for_minor_ticks
end

#yaxis_numeric_label_texObject

Returns the value of attribute yaxis_numeric_label_tex.



144
145
146
# File 'lib/Tioga/FigMkr.rb', line 144

def yaxis_numeric_label_tex
  @yaxis_numeric_label_tex
end

#yaxis_tick_labelsObject

Returns the value of attribute yaxis_tick_labels.



117
118
119
# File 'lib/Tioga/FigMkr.rb', line 117

def yaxis_tick_labels
  @yaxis_tick_labels
end

#ylabelObject

Returns the value of attribute ylabel.



109
110
111
# File 'lib/Tioga/FigMkr.rb', line 109

def ylabel
  @ylabel
end

Class Method Details

.def_enter_page_function(&cmd) ⇒ Object

:call-seq:

FigureMaker.def_enter_page_function do |t| ... end

Defines the block to be the enter_page_function for FigureMaker.default.



99
100
# File 'lib/Tioga/Doc.rb', line 99

def FigureMaker.def_enter_page_function(&cmd)
end

.defaultObject

:call-seq:

FigureMaker.default                         
FigureMaker.default = a_FigureMaker

The default FigureMaker is typically the one to use. Most tioga figure class definitions begin their initialization by storing this in an instance variable for easy access in the figure methods.



74
75
# File 'lib/Tioga/Doc.rb', line 74

def FigureMaker.default
end

.default=(fm) ⇒ Object



77
78
# File 'lib/Tioga/Doc.rb', line 77

def FigureMaker.default=(fm)
end

.exec(&cmd) ⇒ Object

:call-seq:

FigureMaker.exec do |t| ... end

Executes the block with FigureMaker.default as argument.



84
85
# File 'lib/Tioga/Doc.rb', line 84

def FigureMaker.exec(&cmd)
end

.hls_to_rgbObject

We define them as class methods too, as they do not depend on a

FigureMaker instance

.make_contour(dict) ⇒ Object



1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
# File 'lib/Tioga/FigMkr.rb', line 1331

def self.make_contour(dict)
    check_dict(dict, @@keys_for_make_contour, 'make_contour')
    z_level = dict['z_level']
    if z_level == nil
        z_level = complain_if_missing_numeric_arg(dict, 'z', 'level', 'make_contour')
    end
    dest_xs = dict['dest_xs']
    dest_ys = dict['dest_ys']
    xs = get_dvec(dict, 'xs', 'make_contour')
    ys = get_dvec(dict, 'ys', 'make_contour')
    gaps = dict['gaps']
    if (!(gaps.kind_of? Array))
        raise "Sorry: 'gaps' for 'make_contour' must be an Array"
    end
    zs = alt_names(dict, 'zs', 'data')
    if (!(zs.kind_of? Dtable))
        raise "Sorry: 'zs' for 'make_contour' must be a Dtable"
    end
    dest_xs.clear unless dest_xs == nil
    dest_ys.clear unless dest_ys == nil
    gaps.clear
    
    legit = dict['legit']
    if legit == nil
      legit = Dtable.new(xs.length,ys.length).set(1.0)
    elsif (!(legit.kind_of? Dtable))
        raise "Sorry: 'legit' for 'make_contour' must be a Dtable -- nonzero means legitimate value in corresponding entry in zs"
    end
    
    method = dict['method']
    use_conrec = (method == 'conrec' or method == 'CONREC')? 1 : 0
    pts_array = FigureMaker.private_make_contour(gaps, xs, ys, zs, z_level, legit, use_conrec)
        
    unless dest_xs == nil
        dest_xs.resize(pts_array[0].size)
        dest_xs.replace(pts_array[0])
    end
    unless dest_ys == nil
        dest_ys.resize(pts_array[1].size)
        dest_ys.replace(pts_array[1])
    end
    return pts_array

end

.make_name_lookup_hash(ary) ⇒ Object



84
85
86
87
88
# File 'lib/Tioga/FigMkr.rb', line 84

def FigureMaker.make_name_lookup_hash(ary)
    dict = Hash.new
    ary.each { |name| dict[name] = true }
    return dict
end

.make_pdf(name = 'immediate', &block) ⇒ Object

:call-seq:

FigureMaker.make_pdf(name) do |t| ... end

Executes the block to create a pdf with the given name. The argument for the block is FigureMaker.default.



92
93
# File 'lib/Tioga/Doc.rb', line 92

def FigureMaker.make_pdf(name,&cmd)
end

.page_style(&cmd) ⇒ Object

:call-seq:

FigureMaker.page_style do |t| ... end

Alias for FigureMaker.def_enter_page_function. Defines the block to be the enter_page_function for FigureMaker.default.



107
108
# File 'lib/Tioga/Doc.rb', line 107

def FigureMaker.page_style(&cmd)
end

.pdflatexObject



69
70
71
72
73
74
75
76
77
78
# File 'lib/Tioga/FigMkr.rb', line 69

def FigureMaker.pdflatex
  if ! @@which_pdflatex
    @@which_pdflatex = if ENV.key? 'TIOGA_PDFLATEX'
                         ENV['TIOGA_PDFLATEX']
                       else
                         "pdflatex"
                       end
  end
  return @@which_pdflatex
end

.pdflatex=(s) ⇒ Object



80
81
82
# File 'lib/Tioga/FigMkr.rb', line 80

def FigureMaker.pdflatex=(s)
  @@which_pdflatex = s
end

.private_make_contourObject

makers

.rgb_to_hlsObject

.string_hls_to_rgb!Object

.string_rgb_to_hls!Object

.versionObject

:call-seq:

FigureMaker.version

Returns a string defining the current tioga version.



114
115
# File 'lib/Tioga/Doc.rb', line 114

def FigureMaker.version
end

Instance Method Details

#append_arc_to_pathObject

#append_circle_to_pathObject

#append_curve_to_pathObject

#append_frame_to_pathObject

#append_interpolant_to_path(interp) ⇒ Object



1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
# File 'lib/Tioga/FigMkr.rb', line 1431

def append_interpolant_to_path(interp)
    x_s = interp[0]; y_s = interp[1]; a_s = interp[2]; b_s = interp[3]; c_s = interp[4]
    ctrl = Dvector.new
    move_to_point(x_s[0], y_s[0]);
    (x_s.size - 1).times do |i|
        x0 = x_s[i]; delta_x = x_s[i+1] - x0
        ctrl.make_bezier_control_points_for_cubic_in_x(x0, y_s[i], delta_x, a_s[i], b_s[i], c_s[i])
        append_curve_to_path(ctrl[0], ctrl[1], ctrl[2], ctrl[3], ctrl[4], ctrl[5])
    end
end

#append_oval_to_pathObject

#append_point_to_pathObject

#append_points_to_pathObject

#append_points_with_gaps_to_path(xs, ys, gaps, close_subpaths = false) ⇒ Object



1302
1303
1304
# File 'lib/Tioga/FigMkr.rb', line 1302

def append_points_with_gaps_to_path(xs, ys, gaps, close_subpaths = false)
    private_append_points_with_gaps_to_path(xs, ys, gaps, close_subpaths)
end

#append_rect_to_pathObject

#append_rounded_rect_to_pathObject

#argument_value(spec, dict, key) ⇒ Object

Returns the value associated with the given key. Default value is returned in case the key is missing from the dict hash. See



631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
# File 'lib/Tioga/FigMkr.rb', line 631

def argument_value(spec, dict, key)
  return dict[key] if dict.key?(key)
  raise "Unknown key asked for" unless spec.key?(key)
  default = spec[key]
  return default unless default.is_a?(::Symbol)
  if default.to_s =~ /^->(.*)/ # Special symbol:
    # return the value of the pointed key
    return argument_value(spec, dict, $1)
  elsif default == Required
    raise "Required key #{key} is missing from #{dict.inspect}"
  end 
  begin
    return self.send(default)
  rescue NoMethodError 
    return default
  end
end

#axial_shading(dict) ⇒ Object



1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
# File 'lib/Tioga/FigMkr.rb', line 1604

def axial_shading(dict)
    check_dict(dict, @@keys_for_axial_shading, 'axial_shading')
    x_start = y_start = nil
    start = alt_names(dict, 'start', 'start_point')
    if check_pair(start, 'start', 'axial_shading')
        x_start = start[0]; y_start = start[1];
    end
    x_start = dict['x_start'] if x_start == nil
    y_start = dict['y_start'] if y_start == nil
    if (x_start == nil || y_start == nil)
        raise "Sorry: Must give both 'x_start' and 'y_start' for axial_shading."
    end
    x_end = y_end = nil
    endpt = alt_names(dict, 'end', 'end_point')
    if check_pair(endpt, 'end', 'axial_shading')
        x_end = endpt[0]; y_end= endpt[1];
    end
    x_end = dict['x_end'] if x_end == nil
    y_end = dict['y_end'] if y_end == nil
    if (x_end == nil || y_end == nil)
        raise "Sorry: Must give both 'x_end' and 'y_end' for axial_shading."
    end
    colormap = alt_names(dict, 'colormap', 'color_map')
    extend_start = dict['extend_start']
    extend_end = dict['extend_end']
    private_axial_shading(x_start, y_start, x_end, y_end, colormap, extend_start, extend_end)
end

#axis_informationObject

#bbox_bottomObject

#bbox_leftObject

#bbox_rightObject

#bbox_topObject

#bezier_control_pointsObject

#bottom_edge_visible=(bool) ⇒ Object



591
592
593
594
595
596
# File 'lib/Tioga/FigMkr.rb', line 591

def bottom_edge_visible=(bool)
    if bool != false
        raise "Sorry: can only set 'bottom_edge_visible' to false."
    end
    self.no_bottom_edge
end

#check_label_clipObject

#clipObject

#clip_circleObject

#clip_ovalObject

#clip_rectObject

#clip_to_frameObject

#close_and_strokeObject

#close_eofill_and_strokeObject

#close_fill_and_strokeObject

#close_pathObject

#column_margins(dict) ⇒ Object



1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
# File 'lib/Tioga/FigMkr.rb', line 1013

def column_margins(dict)
    check_dict(dict, @@keys_for_column_margins, 'column_margins')
    left_margin = get_if_given_else_default(dict, 'left_margin', 0)
    right_margin = get_if_given_else_default(dict, 'right_margin', 0)
    num_columns = dict['num_columns']
    first_column = dict['first_column']
    last_column = dict['last_column']
    column_margin = dict['column_margin']
    column = dict['column']
    if column != nil
        first_column = last_column = column
    end
    first_column = 1 if first_column == nil
    last_column = first_column if last_column == nil
    first_column -= 1; last_column -= 1 # switch to 0 for left column instead of 1
    num_columns = last_column + 1 if num_columns == nil
    column_margin = 0 if column_margin == nil
    columns_after = num_columns - last_column - 1
    columns_before = first_column
    column_width = (1.0 - (left_margin + right_margin + column_margin * (num_columns-1))) / num_columns
    left_margin = left_margin + columns_before * (column_width + column_margin)
    right_margin = right_margin + columns_after * (column_width + column_margin)
    return { 'left_margin' => left_margin, 'right_margin' => right_margin }
end

#context(&cmd) ⇒ Object



1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
# File 'lib/Tioga/FigMkr.rb', line 1067

def context(&cmd)
    trace_cmd_no_arg(@enter_context_function, @exit_context_function) {       
       save_title = self.title
       save_xlabel = self.xlabel
       save_ylabel = self.ylabel
       save_line_type = self.line_type
       save_xaxis_locations_for_major_ticks = self.xaxis_locations_for_major_ticks
       save_xaxis_locations_for_minor_ticks = self.xaxis_locations_for_minor_ticks
       save_xaxis_tick_labels = self.xaxis_tick_labels
       save_yaxis_locations_for_major_ticks = self.yaxis_locations_for_major_ticks
       save_yaxis_locations_for_minor_ticks = self.yaxis_locations_for_minor_ticks
       save_yaxis_tick_labels = self.yaxis_tick_labels
       save_fm_data = Dvector.new(@@fm_data_size).replace(@fm_data)
       pdf_gsave
       begin
           cmd.call(self)       
       ensure
           pdf_grestore
           self.title = save_title
           self.xlabel = save_xlabel
           self.ylabel = save_ylabel
           self.line_type = save_line_type
           self.xaxis_locations_for_major_ticks = save_xaxis_locations_for_major_ticks
           self.xaxis_locations_for_minor_ticks = save_xaxis_locations_for_minor_ticks
           self.xaxis_tick_labels = save_xaxis_tick_labels
           self.yaxis_locations_for_major_ticks = save_yaxis_locations_for_major_ticks
           self.yaxis_locations_for_minor_ticks = save_yaxis_locations_for_minor_ticks
           self.yaxis_tick_labels = save_yaxis_tick_labels
           @fm_data.replace(save_fm_data)            
       end            
    }      
end

#convert_figure_to_frame_dxObject

#convert_figure_to_frame_dyObject

#convert_figure_to_frame_xObject

#convert_figure_to_frame_yObject

#convert_figure_to_output_dxObject

#convert_figure_to_output_dyObject

#convert_figure_to_output_xObject

#convert_figure_to_output_yObject

#convert_frame_to_figure_dxObject

#convert_frame_to_figure_dyObject

#convert_frame_to_figure_xObject

#convert_frame_to_figure_yObject

#convert_frame_to_page_dxObject

#convert_frame_to_page_dyObject

#convert_frame_to_page_xObject

#convert_frame_to_page_yObject

#convert_inches_to_outputObject

coordinate system conversions

#convert_mm_to_outputObject

#convert_output_to_figure_dxObject

#convert_output_to_figure_dyObject

#convert_output_to_figure_xObject

#convert_output_to_figure_yObject

#convert_output_to_inchesObject

#convert_output_to_mmObject

#convert_output_to_page_dxObject

#convert_output_to_page_dyObject

#convert_output_to_page_xObject

#convert_output_to_page_yObject

#convert_page_to_frame_dxObject

#convert_page_to_frame_dyObject

#convert_page_to_frame_xObject

#convert_page_to_frame_yObject

#convert_page_to_output_dxObject

#convert_page_to_output_dyObject

#convert_page_to_output_xObject

#convert_page_to_output_yObject

#convert_to_colormapObject

#convert_to_degreesObject

#create_colormap(dict) ⇒ Object



1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
# File 'lib/Tioga/FigMkr.rb', line 1760

def create_colormap(dict)
    check_dict(dict, @@keys_for_create_colormap, 'create_colormap')
    length = dict['length']
    length = 256 if length == nil
    if !(length >= 2 && length <= 256)
        raise "Sorry: dictionary for create color map must have 'length' between 2 and 256"
    end
    points = dict['points']
    if points == nil
        raise "Sorry: dictionary for create color map must have 'points' set to a vector of increasing locations from 0.0 to 1.0"
    end
    c1s = dict['Rs']
    c2s = dict['Gs']
    c3s = dict['Bs']
    if c1s != nil && c2s != nil && c3s != nil
        rgb_flag = true
    else
        c1s = dict['Hs']
        c2s = dict['Ls']
        c3s = dict['Ss']
        if c1s == nil || c2s == nil || c3s == nil
            raise "Sorry: dictionary for create color map must have 'Rs', 'Gs', and 'Bs', or 'Hs', 'Ls', and 'Ss'."
        end
        rgb_flag = false
    end
    private_create_colormap(rgb_flag, length, points, c1s, c2s, c3s)
end

#create_figure_temp_files(name) ⇒ Object

returns true if successful, false if failed.



2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
# File 'lib/Tioga/FigMkr.rb', line 2323

def create_figure_temp_files(name) # returns true if successful, false if failed.
    if name.kind_of?(Integer)
        num = name
        name = @figure_names[num]
    else
        num = @figure_names.index(name)
    end
    return false if num == nil
    cmd = @figure_commands[num]
    return false unless cmd.kind_of?(Proc)
    begin
        reset_plot_attrs(self.scaling_factor)
        reset_legend_info
        private_make(name, cmd)
        return true
    rescue Exception => er
        report_error(er, "ERROR while executing command: #{cmd}")
    end
    return false
end

#create_gradient_colormap(dict) ⇒ Object



1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
# File 'lib/Tioga/FigMkr.rb', line 1828

def create_gradient_colormap(dict)
    check_dict(dict, @@keys_for_create_gradient_colormap, 'create_gradient_colormap')
    hue = get_if_given_else_default(dict, 'hue', 0)
    starting_H = get_if_given_else_default(dict, 'starting_H', hue)
    ending_H = get_if_given_else_default(dict, 'ending_H', hue)
    lightness = get_if_given_else_default(dict, 'lightness', 0.5)
    starting_L = get_if_given_else_default(dict, 'starting_L', lightness)
    ending_L = get_if_given_else_default(dict, 'ending_L', lightness)
    saturation = get_if_given_else_default(dict, 'saturation', 0.5)
    starting_S = get_if_given_else_default(dict, 'starting_S', saturation)
    ending_S = get_if_given_else_default(dict, 'ending_S', saturation)
    create_colormap(
            'points' => [0.00, 1.00],
            'Hs' =>     [starting_H, ending_H],
            'Ls' =>     [starting_L, ending_L],
            'Ss' =>     [starting_S, ending_S]
            )  
end

#create_image_data(data, dict) ⇒ Object



1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
# File 'lib/Tioga/FigMkr.rb', line 1850

def create_image_data(data, dict)
    check_dict(dict, @@keys_for_create_image_data, 'create_image_data')
    first_row = dict['first_row']
    last_row = dict['last_row']
    first_column = dict['first_column']
    last_column = dict['last_column']
    min_value = dict['min_value']
    max_value = dict['max_value']
    max_code = dict['max_code']
    if_below_range = dict['if_below_range']
    if_above_range = dict['if_above_range']
    first_row = 0 if first_row == nil
    last_row = -1 if last_row == nil
    first_column = 0 if first_column == nil
    last_column = -1 if last_column == nil
    min_value = data.min if min_value == nil
    max_value = data.max if max_value == nil
    max_code = 255 if max_code == nil
    if_below_range = 0 if if_below_range == nil
    if_above_range = max_code if if_above_range == nil
    if dict['masking'] == true
        max_code = 254; if_below_range = if_above_range = 255
    end
    return private_create_image_data(data, first_row, last_row, first_column, last_column,
        min_value, max_value, max_code, if_below_range, if_above_range);
end

#create_monochrome_image_data(data, dict) ⇒ Object



1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
# File 'lib/Tioga/FigMkr.rb', line 1879

def create_monochrome_image_data(data, dict)
    check_dict(dict, @@keys_for_create_monochrome_image_data, 'create_monochrome_image_data')
    first_row = dict['first_row']
    last_row = dict['last_row']
    first_column = dict['first_column']
    last_column = dict['last_column']
    boundary = dict['boundary']
    reverse = dict['reverse']
    first_row = 0 if first_row == nil
    last_row = -1 if last_row == nil
    first_column = 0 if first_column == nil
    last_column = -1 if last_column == nil
    boundary = 0 if boundary == nil
    reverse = false if reverse == nil
    return private_create_monochrome_image_data(data, first_row, last_row, first_column, last_column,
        boundary, reverse);
end

#def_enter_context_function(&cmd) ⇒ Object



2172
2173
2174
2175
2176
2177
# File 'lib/Tioga/FigMkr.rb', line 2172

def def_enter_context_function(&cmd)
    if cmd == nil
        raise "Sorry: must provide a command block for def_enter_context_function"
    end
    @enter_context_function = cmd
end

#def_enter_page_function(&cmd) ⇒ Object



2078
2079
2080
2081
2082
2083
# File 'lib/Tioga/FigMkr.rb', line 2078

def def_enter_page_function(&cmd)
    if cmd == nil
        raise "Sorry: must provide a command block for def_enter_page_function"
    end
    @enter_page_function = cmd
end

#def_enter_show_plot_function(&cmd) ⇒ Object



2102
2103
2104
2105
2106
2107
# File 'lib/Tioga/FigMkr.rb', line 2102

def def_enter_show_plot_function(&cmd)
    if cmd == nil
        raise "Sorry: must provide a command block for def_enter_show_plot_function"
    end
    @enter_show_plot_function = cmd
end

#def_enter_subfigure_function(&cmd) ⇒ Object



2126
2127
2128
2129
2130
2131
# File 'lib/Tioga/FigMkr.rb', line 2126

def def_enter_subfigure_function(&cmd)
    if cmd == nil
        raise "Sorry: must provide a command block for def_enter_subfigure_function"
    end
    @enter_subfigure_function = cmd
end

#def_enter_subplot_function(&cmd) ⇒ Object



2149
2150
2151
2152
2153
2154
# File 'lib/Tioga/FigMkr.rb', line 2149

def def_enter_subplot_function(&cmd)
    if cmd == nil
        raise "Sorry: must provide a command block for def_enter_subplot_function"
    end
    @enter_subplot_function = cmd
end

#def_eval_function(&cmd) ⇒ Object



2070
2071
2072
2073
2074
2075
# File 'lib/Tioga/FigMkr.rb', line 2070

def def_eval_function(&cmd)
    if cmd == nil
        raise "Sorry: must provide a command block for def_eval"
    end
    @eval_command = cmd
end

#def_exit_context_function(&cmd) ⇒ Object



2183
2184
2185
2186
2187
2188
# File 'lib/Tioga/FigMkr.rb', line 2183

def def_exit_context_function(&cmd)
    if cmd == nil
        raise "Sorry: must provide a command block for def_exit_context_function"
    end
    @exit_context_function = cmd
end

#def_exit_page_function(&cmd) ⇒ Object



2089
2090
2091
2092
2093
2094
# File 'lib/Tioga/FigMkr.rb', line 2089

def def_exit_page_function(&cmd)
    if cmd == nil
        raise "Sorry: must provide a command block for def_exit_page_function"
    end
    @exit_page_function = cmd
end

#def_exit_show_plot_function(&cmd) ⇒ Object



2113
2114
2115
2116
2117
2118
# File 'lib/Tioga/FigMkr.rb', line 2113

def def_exit_show_plot_function(&cmd)
    if cmd == nil
        raise "Sorry: must provide a command block for def_exit_show_plot_function"
    end
    @exit_show_plot_function = cmd
end

#def_exit_subfigure_function(&cmd) ⇒ Object



2137
2138
2139
2140
2141
2142
# File 'lib/Tioga/FigMkr.rb', line 2137

def def_exit_subfigure_function(&cmd)
    if cmd == nil
        raise "Sorry: must provide a command block for def_exit_subfigure_function"
    end
    @exit_subfigure_function = cmd
end

#def_exit_subplot_function(&cmd) ⇒ Object



2160
2161
2162
2163
2164
2165
# File 'lib/Tioga/FigMkr.rb', line 2160

def def_exit_subplot_function(&cmd)
    if cmd == nil
        raise "Sorry: must provide a command block for def_exit_subplot_function"
    end
    @exit_subplot_function = cmd
end

#def_figure(name, &cmd) ⇒ Object



2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
# File 'lib/Tioga/FigMkr.rb', line 2213

def def_figure(name, &cmd)
    name = name.split(' ').join('_') # replace blanks by underscores since names must be okay for shell
    if cmd == nil
        raise "Sorry: must provide a command block for def_figure"
    end
    if (num = @figure_names.index(name)) == nil
        @figure_names << name
        num = @figure_names.index(name)
        @num_figures = @figure_names.length
    end
    @figure_commands[num] = cmd
    return cmd
end

#default_enter_page_functionObject



407
408
409
410
411
# File 'lib/Tioga/FigMkr.rb', line 407

def default_enter_page_function
    page_setup(self.default_page_width,self.default_page_height)
    set_frame_sides(self.default_frame_left,self.default_frame_right,
                  self.default_frame_top,self.default_frame_bottom)
end

#default_line_scale=(s) ⇒ Object



403
404
405
# File 'lib/Tioga/FigMkr.rb', line 403

def default_line_scale=(s)
  self.rescale_lines(s)
end

#discard_pathObject

#do_box_labels(title, xlabel, ylabel) ⇒ Object



813
814
815
816
817
818
819
820
821
822
823
# File 'lib/Tioga/FigMkr.rb', line 813

def do_box_labels(title, xlabel, ylabel)
    if title != nil
        show_title(title); no_title
    end
    if xlabel != nil
        show_xlabel(xlabel); no_xlabel
    end
    if ylabel != nil
        show_ylabel(ylabel); no_ylabel
    end
end

#doing_subfigureObject

#doing_subplotObject

#eoclipObject

#eofillObject

#eofill_and_strokeObject

#eval_function(string) ⇒ Object



2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
# File 'lib/Tioga/FigMkr.rb', line 2195

def eval_function(string)
    result = string
    if @eval_command == nil
        begin
            result = eval(string)
        rescue Exception => er
            report_error(er, nil)
        end
    else
        begin
            result = @eval_command.call(string)
        rescue Exception => er
            report_error(er, nil)
        end
    end
    return result
end

#figure_index(name) ⇒ Object



2227
2228
2229
# File 'lib/Tioga/FigMkr.rb', line 2227

def figure_index(name)
    return @figure_names.index(name)
end

#figure_name(num) ⇒ Object



449
450
451
# File 'lib/Tioga/FigMkr.rb', line 449

def figure_name(num)
    @figure_names[num]
end

#figure_pdf(name) ⇒ Object



453
454
455
456
457
458
459
460
461
# File 'lib/Tioga/FigMkr.rb', line 453

def figure_pdf(name)
    if name.kind_of?(Integer)
        num = name
    else
        num = @figure_names.index(name)
    end
    return nil if num == nil
    @figure_pdfs[num]
end

#fillObject

#fill_and_strokeObject

#fill_and_stroke_circleObject

#fill_and_stroke_frameObject

#fill_and_stroke_ovalObject

#fill_and_stroke_rectObject

#fill_and_stroke_rounded_rectObject

#fill_circleObject

#fill_frameObject

#fill_ovalObject

#fill_rectObject

#fill_rounded_rectObject

#fill_transparencyObject



518
519
520
# File 'lib/Tioga/FigMkr.rb', line 518

def fill_transparency
    self.transparency_for_fill
end

#fill_transparency=(frac) ⇒ Object



522
523
524
# File 'lib/Tioga/FigMkr.rb', line 522

def fill_transparency=(frac)
    self.transparency_for_fill = frac
end

#get_color_from_colormapObject

#get_save_filenameObject

#get_text_size(name, default = 1.0) ⇒ Object

Returns informations about the size of the named element. Returns a hash:

  • ‘width’ : the width of the box in figure coordinates

  • ‘height’: the height of the box in figure coordinates

  • ‘just’ : the justification used

  • ‘align’ : the vertical alignment used

  • ‘angle’ : the angle used

  • ‘scale’ : the total scale used.

If the measurement did not take place yet, the width, height, and other attributes will be missing. Look for those.



371
372
373
374
375
376
377
# File 'lib/Tioga/FigMkr.rb', line 371

def get_text_size(name, default = 1.0)
  if self.measures_info.key? name
    return self.measures_info[name]
  else
    return {}               # Empty hash
  end
end

#hls_to_rgbObject

colors

#in_subfigureObject



998
999
1000
# File 'lib/Tioga/FigMkr.rb', line 998

def in_subfigure
    return ! self.root_figure
end

#intense_colormapObject



1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
# File 'lib/Tioga/FigMkr.rb', line 1788

def intense_colormap
    if @intense_colormap == nil
        @intense_colormap = create_colormap(
            'points' => [0.0, 0.44, 0.50, 0.50, 0.56, 1.0],
            'Hs' =>     [240,  240,  240,    0,    0,   0],
            'Ls' =>     [0.5, 0.90, 0.99, 0.99, 0.90, 0.5],
            'Ss' =>     [1.0,  1.0,  1.0,  1.0,  1.0, 1.0]
            )
    end
    @intense_colormap
end

#jpg_infoObject

#landscapeObject



849
850
851
# File 'lib/Tioga/FigMkr.rb', line 849

def landscape
    set_landscape
end

#left_edge_visible=(bool) ⇒ Object



570
571
572
573
574
575
# File 'lib/Tioga/FigMkr.rb', line 570

def left_edge_visible=(bool)
    if bool != false
        raise "Sorry: can only set 'left_edge_visible' to false."
    end
    self.no_left_edge
end

#legend_heightObject



799
800
801
802
803
# File 'lib/Tioga/FigMkr.rb', line 799

def legend_height
    height = 0.0
    @legend_info.each { |dict| height += dict['dy'] }
    return height
end

#legend_text_widthObject

Returns the exact length of the text width in output coordinates



787
788
789
790
791
792
793
794
795
796
797
# File 'lib/Tioga/FigMkr.rb', line 787

def legend_text_width
  index = 0
  width = 0.0
  while h = get_text_size("legend-#{index}") and h.key?('width')
    if width < h['width'] 
      width = h['width'] 
    end
    index += 1
  end
  return scaling_factor * width
end

#line_colorObject



463
464
465
# File 'lib/Tioga/FigMkr.rb', line 463

def line_color
    self.stroke_color
end

#line_color=(color) ⇒ Object



467
468
469
# File 'lib/Tioga/FigMkr.rb', line 467

def line_color=(color)
    self.stroke_color=(color)
end

#line_type_setObject

graphics attribute accessors

#load_png(file) ⇒ Object



1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
# File 'lib/Tioga/FigMkr.rb', line 1680

def load_png(file)
  if File.readable?(file)
    Dir::mktmpdir do |dir|
      FileUtils::cp(file, "#{dir}/image.png")
      Dir::chdir(dir) do
        open("read.tex", "w") do |f|
          f.puts <<'EOD'
\documentclass{article}
\usepackage{graphicx}
\pdfcompresslevel=0
\pdfobjcompresslevel=0
\begin{document}
\includegraphics[width=1cm]{image}
\end{document}
EOD
        end
        pdflatex = "pdflatex"
        syscmd = "#{pdflatex} -interaction nonstopmode read.tex"
        IO::popen(syscmd, "r+") do |f|
          f.close_write      
          for line in f
            # Shall we do something with those ?
          end
        end
        
        # Now, we open the PDF file and have fun with it.
        open("read.pdf", 'rb') do |f|
          
          ret = nil
          cur = nil
          len = nil
          while l = f.gets("\n")
            if ! ret && l =~ /\/Subtype\s*\/Image\s*/
              ret = {}
              cur = ret
            elsif cur && l=~ /\/Width\s*(\d+)\s*/
              cur['width'] = $1.to_i
            elsif cur && l=~ /\/Height\s*(\d+)\s*/
              cur['height'] = $1.to_i
            elsif cur && l =~ /\/Length\s*(\d+)\s*/
              len = $1.to_i
            elsif cur && l =~ /\/(Filter|DecodePar)/ && (!cur['data'])
              cur['pdf_filters'] ||= ''
              cur['pdf_filters'] << l
            elsif cur && l =~ /^\s*\/BitsPerComponent\s*(\d+)\s*/
              cur['bits'] = $1.to_i
            elsif cur && l =~ /\/ColorSpace\s*(\S+)\s*/
              cs = $1
              if cs == "/DeviceGray"
                cs = 'gray'
              elsif cs == "/DeviceRGB"
                cs = "rgb"
              else
                raise "Unsupported colorspace for file #{file}: '#{cs}'"
              end
              cur['color_space'] = cs
            elsif cur && l =~ /\/SMask\s*(\d+)\s*/
              cur['opacity_mask'] = {}
            elsif cur && len && l =~ /stream/
              cur['data'] = f.read(len)
              if cur['opacity_mask']
                cur = cur['opacity_mask']
                len = nil
              else
                return ret
              end
            end
          end
          return ret
        end
        
      end
    end
  else
    raise "File #{file} not readable"
  end
end

#make_all(fignums = nil, report = false) ⇒ Object



2302
2303
2304
# File 'lib/Tioga/FigMkr.rb', line 2302

def make_all(fignums=nil, report=false)
  require_all(fignums, report, true)
end

#make_contour(dict) ⇒ Object



1327
1328
1329
# File 'lib/Tioga/FigMkr.rb', line 1327

def make_contour(dict)
  return FigureMaker.make_contour(dict)
end

#make_figure(num) ⇒ Object



2231
2232
2233
# File 'lib/Tioga/FigMkr.rb', line 2231

def make_figure(num)
    make_pdf(num)
end

#make_interpolant(dict) ⇒ Object



1421
1422
1423
1424
1425
1426
1427
1428
1429
# File 'lib/Tioga/FigMkr.rb', line 1421

def make_interpolant(dict)
    check_dict(dict, @@keys_for_make_interpolant, 'make_smoothed')
    start_slope = dict['start_slope']
    end_slope = dict['end_slope']
    xs = get_dvec(dict, 'xs', 'make_interpolant')
    ys = get_dvec(dict, 'ys', 'make_interpolant')
    return Dvector.create_spline_interpolant(xs, ys,
            (start_slope != nil), start_slope, (end_slope != nil), end_slope)
end

#make_pdf(num, &cmd) ⇒ Object

We wrap the call so that if the keys of @measures did change during the call, we call it again.



2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
# File 'lib/Tioga/FigMkr.rb', line 2243

def make_pdf(num,&cmd) # returns pdf name if successful, false if failed.
    def_figure(num,&cmd) if Kernel.block_given?
    old_measure_keys = @measures.keys
    num = get_num_for_pdf(num)
    result = start_making_pdf(num)
    return unless result

    if ! @current_pdflatex_call
      # Clear the measures at the first call
      @measures.clear
      @current_pdflatex_call = 0
    end
    begin
      @figure_pdfs[num] = finish_making_pdf(@figure_names[num])
    rescue Exception => e
      p e, e.backtrace
    end

    # If the keys have changed, we run that again.
    if @measures.keys != old_measure_keys
      @current_pdflatex_call += 1

      # We limit
      if (!@max_nested_pdflatex_calls || (@current_pdflatex_call < @max_nested_pdflatex_calls))
        # we dont need to pass &cmd since it has now been defined
        make_pdf(num)
      end
    end
    @current_pdflatex_call = nil
    return @figure_pdfs[num]
end

#make_portfolio(name, fignums = nil, report = false) ⇒ Object



2312
2313
2314
2315
2316
# File 'lib/Tioga/FigMkr.rb', line 2312

def make_portfolio(name, fignums=nil, report=false)
    require_all(fignums,report)
    private_make_portfolio(name, fignums, @figure_names)
    finish_making_pdf(name)
end

#make_portfolio_pdf(name, fignums = nil, report = false) ⇒ Object



2307
2308
2309
# File 'lib/Tioga/FigMkr.rb', line 2307

def make_portfolio_pdf(name, fignums=nil, report=false)
    make_portfolio(name,fignums,report)
end

#make_preview_pdf(num) ⇒ Object

old name



2236
2237
2238
# File 'lib/Tioga/FigMkr.rb', line 2236

def make_preview_pdf(num) # old name
    make_pdf(num)
end

#make_spline_interpolated_points(dict) ⇒ Object



1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
# File 'lib/Tioga/FigMkr.rb', line 1403

def make_spline_interpolated_points(dict)
    check_dict(dict, @@keys_for_make_curves, 'make_spline_interpolated_points')
    start_slope = dict['start_slope']
    end_slope = dict['end_slope']
    sample_xs = get_dvec(dict, 'sample_xs', 'make_spline_interpolated_points')
    xs = get_dvec(dict, 'xs', 'make_spline_interpolated_points')
    ys = get_dvec(dict, 'ys', 'make_spline_interpolated_points')
    yvec = private_make_spline_interpolated_points(sample_xs, xs, ys, start_slope, end_slope)
    result_ys = dict['result_ys']
    unless result_ys == nil
        result_ys.resize(yvec.size)
        result_ys.replace(yvec)
    end
    return yvec
end

#make_steps(dict) ⇒ Object



1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
# File 'lib/Tioga/FigMkr.rb', line 1379

def make_steps(dict)
    check_dict(dict, @@keys_for_make_steps, 'make_steps')
    xfirst = complain_if_missing_numeric_arg(dict, 'xfirst', 'x_first', 'make_steps')
    yfirst = complain_if_missing_numeric_arg(dict, 'yfirst', 'y_first', 'make_steps')
    xlast = complain_if_missing_numeric_arg(dict, 'xlast', 'x_last', 'make_steps')
    ylast = complain_if_missing_numeric_arg(dict, 'ylast', 'y_last', 'make_steps')
    dest_xs = dict['dest_xs']
    dest_ys = dict['dest_ys']
    xs = get_dvec(dict, 'xs', 'make_steps')
    ys = get_dvec(dict, 'ys', 'make_steps')
    pts_array = private_make_steps(xs, ys, xfirst, yfirst, xlast, ylast)
    unless dest_xs == nil
        dest_xs.resize(pts_array[0].size)
        dest_xs.replace(pts_array[0])
    end
    unless dest_ys == nil
        dest_ys.resize(pts_array[1].size)
        dest_ys.replace(pts_array[1])
    end
    return pts_array
end

#marker_string_infoObject

#mellow_colormapObject



1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
# File 'lib/Tioga/FigMkr.rb', line 1800

def mellow_colormap 
    if @mellow_colormap == nil
        @mellow_colormap = create_colormap(
            'points' => [0.0, 0.44, 0.50, 0.50, 0.56, 1.0],
            'Hs' =>     [240,  240,  240,    0,    0,   0],
            'Ls' =>     [0.5, 0.90, 0.99, 0.99, 0.90, 0.5],
            'Ss' =>     [0.5,  1.0,  1.0,  1.0,  1.0, 0.5]
            )   
    end
    @mellow_colormap
end

#move_to_pointObject

path construction

#no_bottom_edgeObject

#no_left_edgeObject

#no_right_edgeObject

#no_titleObject

#no_top_edgeObject

#no_xaxisObject

#no_xlabelObject

#no_yaxisObject

#no_ylabelObject

#opacity_for_fillObject



492
493
494
# File 'lib/Tioga/FigMkr.rb', line 492

def opacity_for_fill
    self.fill_opacity
end

#opacity_for_fill=(frac) ⇒ Object



496
497
498
# File 'lib/Tioga/FigMkr.rb', line 496

def opacity_for_fill=(frac)
    self.fill_opacity=(frac)
end

#opacity_for_strokeObject



484
485
486
# File 'lib/Tioga/FigMkr.rb', line 484

def opacity_for_stroke
    self.stroke_opacity
end

#opacity_for_stroke=(frac) ⇒ Object



488
489
490
# File 'lib/Tioga/FigMkr.rb', line 488

def opacity_for_stroke=(frac)
    self.stroke_opacity=(frac)
end

#page_setup(width, height) ⇒ Object

in big-points (1/72 inch)



419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/Tioga/FigMkr.rb', line 419

def page_setup(width,height) # in big-points (1/72 inch)
    set_device_pagesize(width*scaling_factor-1, height*scaling_factor-1)
    @tex_preview_figure_width = width.to_s + 'bp'
    @tex_preview_figure_height = height.to_s + 'bp'
    @tex_preview_paper_height = "#{height}bp"
    @tex_preview_paper_width = "#{width}bp"
    @tex_preview_tiogafigure_command = 'tiogafigureshow'
    @tex_preview_fullpage = false
    @tex_xoffset = 0
    @tex_yoffset = 0
    @tex_preview_hoffset = '0in'
    @tex_preview_voffset = '0in'
    set_frame_sides(0,1,1,0)
    set_bounds(
        'left_boundary' => 0, 'right_boundary' => 1, 
        'top_boundary' => 1, 'bottom_boundary' => 0)
    self.update_bbox(0,0)
    self.update_bbox(0,1)
    self.update_bbox(1,0)
    self.update_bbox(1,1)
end

#pdf_grestoreObject

#pdf_gsaveObject

methods

#portraitObject



857
858
859
# File 'lib/Tioga/FigMkr.rb', line 857

def portrait
    set_portrait
end

#prepare_argument_hash(spec, dict, strict = true) ⇒ Object

A helper function to prepare a default hash for a function, and to check for extraneous or missing arguments. It takes two arguments:

  • dict, the user-provided dictionnary to check and complete

  • specs, a hash representing the valid arguments and their default

value. Symbols in the specs hash have special meanings:

  • a normal symbol means: call self.symbol to get the default value. If this call fails with a MethodMissing error, the symbol is returned.

  • a ‘->stuff’.to_sym symbol means: copy the value from the value associated with the key ‘stuff’.

  • a ‘!required!’ symbol means that if the key is missing from the original, raise an exception. (use the Required consant for that)

You should find a few examples in the constants of this class…

This function modifies dict in place !



616
617
618
619
620
621
622
623
624
625
626
627
# File 'lib/Tioga/FigMkr.rb', line 616

def prepare_argument_hash(spec, dict, strict = true)
  for key in dict.keys
    if (not spec.key?(key)) and strict
      warn "Unkown key #{key} for #{caller.first}, information removed"
      dict.delete(key)
    end
  end
  for key in spec.keys
    dict[key] = argument_value(spec, dict, key)
  end
  return dict
end

#private_append_points_with_gaps_to_pathObject

#private_axial_shadingObject

shading

#private_create_colormapObject

colormaps

#private_create_image_dataObject

#private_create_monochrome_image_dataObject

#private_init_fm_dataObject

#private_makeObject

#private_make_portfolioObject

#private_make_spline_interpolated_pointsObject

#private_make_stepsObject

#private_radial_shadingObject

#private_register_cmyk_imageObject

#private_register_grayscale_imageObject

#private_register_hls_imageObject

#private_register_imageObject

#private_register_jpgObject

images

#private_register_monochrome_imageObject

#private_register_rgb_imageObject

#private_save_measureObject

text measurements

#private_set_boundsObject

#private_set_default_font_sizeObject

text

#private_set_subframeObject

#private_show_image_from_refObject

#private_show_markerObject

#radial_shading(dict) ⇒ Object



1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
# File 'lib/Tioga/FigMkr.rb', line 1636

def radial_shading(dict)
    check_dict(dict, @@keys_for_radial_shading, 'radial_shading')
    start_circle = alt_names(dict, 'start_circle', 'start')
    end_circle = alt_names(dict, 'end_circle', 'end')
    colormap = alt_names(dict, 'colormap', 'color_map')
    x_hat = alt_names(dict, 'x_hat', 'xhat')
    x_hat = [1, 0] if x_hat == nil
    y_hat = alt_names(dict, 'y_hat', 'yhat')
    y_hat = [0, 1] if y_hat == nil
    origin = dict['origin']
    origin = [0, 0] if origin == nil
    extend_start = dict['extend_start']
    extend_end = dict['extend_end']
    private_radial_shading(start_circle[0], start_circle[1], start_circle[2],
        end_circle[0], end_circle[1], end_circle[2], colormap,
        x_hat[0], y_hat[0], x_hat[1], y_hat[1],
        extend_start, extend_end)
end

#rainbow_colormapObject



1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
# File 'lib/Tioga/FigMkr.rb', line 1812

def rainbow_colormap
    if @rainbow_colormap == nil
        @rainbow_colormap = create_colormap(
            'points' => [0.00, 0.27, 0.46, 0.73, 1.00],  # distorted to reduce size of green
  # modified for debugging purposes...
            'Hs' => (Dvector[0.0, 1.0, 2.0, 3.0, 4.0]*90.0 - 20.0)*(340.0/360.0) + 10.0,
            'Ls' =>     [  0.5,    0.5,    0.5,    0.5,    0.5],
            'Ss' =>     [  1.0,    1.0,    1.0,    1.0,    1.0]
            )  
    end
    @rainbow_colormap
end

#register_fontObject

markers

#register_image(dict) ⇒ Object

Only register an image



1676
1677
1678
# File 'lib/Tioga/FigMkr.rb', line 1676

def register_image(dict)
    internal_show_image(dict, true)
end

#require_all(fignums = nil, report = false, always_make = false) ⇒ Object



2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
# File 'lib/Tioga/FigMkr.rb', line 2283

def require_all(fignums=nil, report=false, always_make=false)
  fignums = Array.new(@figure_names.length) {|i| i} if fignums == nil
  nums = []
  fignums.each do |num|
    if always_make || (@figure_pdfs[num] == nil)
      result = start_making_pdf(num)
      if result
        report_number_and_name(num,@figure_names[num]) if report
        nums << num
      else
        puts 'ERROR: Failed to make pdf for ' + @figure_names[num]
      end
    end
  end
  finish_making_pdfs(nums,report)
  return true
end

#require_pdf(num) ⇒ Object



2276
2277
2278
2279
2280
# File 'lib/Tioga/FigMkr.rb', line 2276

def require_pdf(num)
    num = get_num_for_pdf(num)
    make_pdf(num) if @figure_pdfs[num] == nil
    return @figure_pdfs[num]
end

#rescale(factor) ⇒ Object



1101
1102
1103
1104
# File 'lib/Tioga/FigMkr.rb', line 1101

def rescale(factor)
    rescale_text(factor)
    rescale_lines(factor)
end

#rescale_linesObject

path painting

#rescale_textObject

#reset_enter_context_functionObject



2179
2180
2181
# File 'lib/Tioga/FigMkr.rb', line 2179

def reset_enter_context_function
    @enter_subplot_context = nil
end

#reset_enter_page_functionObject



2085
2086
2087
# File 'lib/Tioga/FigMkr.rb', line 2085

def reset_enter_page_function
    @enter_page_function = nil
end

#reset_enter_show_plot_functionObject



2109
2110
2111
# File 'lib/Tioga/FigMkr.rb', line 2109

def reset_enter_show_plot_function
    @enter_show_plot_function = nil
end

#reset_enter_subfigure_functionObject



2133
2134
2135
# File 'lib/Tioga/FigMkr.rb', line 2133

def reset_enter_subfigure_function
    @enter_subfigure_function = nil
end

#reset_enter_subplot_functionObject



2156
2157
2158
# File 'lib/Tioga/FigMkr.rb', line 2156

def reset_enter_subplot_function
    @enter_subplot_function = nil
end

#reset_eval_functionObject



2066
2067
2068
# File 'lib/Tioga/FigMkr.rb', line 2066

def reset_eval_function
    @eval_command = nil
end

#reset_exit_context_functionObject



2190
2191
2192
# File 'lib/Tioga/FigMkr.rb', line 2190

def reset_exit_context_function
    @exit_subplot_context = nil
end

#reset_exit_page_functionObject



2096
2097
2098
# File 'lib/Tioga/FigMkr.rb', line 2096

def reset_exit_page_function
    @exit_page_function = nil
end

#reset_exit_show_plot_functionObject



2120
2121
2122
# File 'lib/Tioga/FigMkr.rb', line 2120

def reset_exit_show_plot_function
    @exit_show_plot_function = nil
end

#reset_exit_subfigure_functionObject



2144
2145
2146
# File 'lib/Tioga/FigMkr.rb', line 2144

def reset_exit_subfigure_function
    @exit_subfigure_function = nil
end

#reset_exit_subplot_functionObject



2167
2168
2169
# File 'lib/Tioga/FigMkr.rb', line 2167

def reset_exit_subplot_function
    @exit_subplot_function = nil
end

#reset_figures(scaling = 10.0) ⇒ Object

attr_accessor :tex_preview_paper_width attr_accessor :tex_preview_paper_height attr_accessor :tex_preview_hoffset attr_accessor :tex_preview_voffset attr_accessor :tex_preview_figure_width attr_accessor :tex_preview_figure_height attr_accessor :tex_preview_minwhitespace attr_accessor :tex_preview_fullpage



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/Tioga/FigMkr.rb', line 208

def reset_figures(scaling = 10.0) # set the state to default values
    @figure_commands = []
    @num_figures = 0
    @create_save_dir = true # creates +save_dir+ by default

    @name = nil
    @auto_refresh_filename = nil
    @figure_names = [ ]
    @figure_pdfs = [ ]
    @legend_info = [ ]
    @run_dir = Dir.getwd
    @save_dir = nil
    @quiet_mode = false
    @model_number = -1
    @need_to_reload_data = true
    @add_model_number = false
    @tex_preview_documentclass = 'article'
    @tex_preamble = '% start of preamble.  
\usepackage[dvipsnames,usenames]{color} % need this for text colors
'
    #     \usepackage[pdftex]{geometry} % need this for setting page size for preview
    # This has been commented out as it's place lie in the texout.c, for
    # it's parameters to be set properly...
    @tex_preview_pagestyle = 'empty'
    @default_page_width = 72*5 # in big-points (1/72 inch)
    @default_page_height = 72*5 # in big-points (1/72 inch)

    @default_frame_left = 0.15 # as fraction of width from left edge
    @default_frame_right = 0.85 # as fraction of width from left edge
    @default_frame_top = 0.85 # as fraction of width from bottom edge
    @default_frame_bottom = 0.15 # as fraction of width from bottom edge
    
    @xaxis_numeric_label_tex = '$#1$'
    @yaxis_numeric_label_tex = '$#1$'
    
    @tex_preview_fullpage = true
    @tex_preview_minwhitespace = nil # use default
    
    @tex_preview_tiogafigure_command = 'tiogafigurescaledtofit'
    @tex_preview_figure_width = '\paperwidth - 2in'
    @tex_preview_figure_height = '\paperheight - 2in'
    
    @num_error_lines = 10
    
    reset_plot_attrs(scaling)
    
    @tex_xoffset = 0
    @tex_yoffset = 0
    
    @tex_preview_hoffset = '1in'
    @tex_preview_voffset = '1in'
    
    @tex_fontsize = '10.0'  
    @tex_fontfamily = 'rmdefault'
    @tex_fontseries = 'mddefault'
    @tex_fontshape = 'updefault'

    @legend_defaults = { 
        'legend_top_margin' => 0.03,
        'legend_bottom_margin' => 0.03,
        'legend_left_margin' => 0.83,
        'legend_right_margin' => 0.0,
        'plot_top_margin' => 0.0,
        'plot_bottom_margin' => 0.0,
        'plot_left_margin' => 0.0,
        'plot_right_margin' => 0.18,
        'plot_scale' => 1,
        'legend_background_function' => false,
        'legend_scale' => 1 }
    
    @marker_defaults = { 
        'fill_color' => Black,
        'stroke_color' => Black,
        'scale' => 1,
        'angle' => 0,
        'justification' => CENTERED,
        'alignment' => ALIGNED_AT_MIDHEIGHT,
        'horizontal_scale' => 1.0,
        'vertical_scale' => 1.0,
        'italic_angle' => 0.0,
        'ascent_angle' => 0.0 }
            
    @eval_command = nil

    @enter_show_plot_function = nil
    @exit_show_plot_function = nil

    @enter_subfigure_function = nil
    @exit_subfigure_function = nil

    @enter_subplot_function = nil
    @exit_subplot_function = nil

    @enter_context_function = nil
    @exit_context_function = nil

    @enter_page_function = lambda  { |t| t.default_enter_page_function }
    @exit_page_function = nil
            
    @tex_preview_paper_width = '297mm'
    @tex_preview_paper_height = '210mm'

    @plot_box_command = lambda { show_plot_box }

    # Automatic cleanup of by default
    @autocleanup = true
    
    # multithreads by default
    @multithreads_okay_for_tioga = true


    # The values of the sizes measured during the pdflatex run
    # we need to keep track of them so we can decide how many times
    # we'll run pdflatex.
    @measures = {}

    # We *must* initialize the measures_info hash.
    @measures_info = {}

    # We don't measure legends by default.
    @measure_legends = false

    # Max number of pdflatex runs
    @max_nested_pdflatex_calls = 3

    # By default, we use Bill's algorithm for major ticks positions
    self.vincent_or_bill = false
    self.log_minor_ticks_limit = 10
end

#reset_legend_infoObject



805
806
807
# File 'lib/Tioga/FigMkr.rb', line 805

def reset_legend_info
    @legend_info = [ ]
end

#reset_plot_attrs(scaling = 10.0) ⇒ Object



339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/Tioga/FigMkr.rb', line 339

def reset_plot_attrs(scaling = 10.0)
    @title = nil
    @xlabel = nil
    @ylabel = nil
    @line_type = nil
    @xaxis_locations_for_major_ticks = nil
    @xaxis_locations_for_minor_ticks = nil
    @xaxis_tick_labels = nil
    @yaxis_locations_for_major_ticks = nil
    @yaxis_locations_for_minor_ticks = nil
    @yaxis_tick_labels = nil
    private_init_fm_data(scaling)
end

#reset_stateObject



380
381
382
# File 'lib/Tioga/FigMkr.rb', line 380

def reset_state        
    reset_figures(self.scaling_factor)
end

#rgb_to_hlsObject

#right_edge_visible=(bool) ⇒ Object



577
578
579
580
581
582
# File 'lib/Tioga/FigMkr.rb', line 577

def right_edge_visible=(bool)
    if bool != false
        raise "Sorry: can only set 'right_edge_visible' to false."
    end
    self.no_right_edge
end

#root_plotObject



994
995
996
# File 'lib/Tioga/FigMkr.rb', line 994

def root_plot
    return ! self.in_subplot
end

#rounded_rect_ovalObject

#row_margins(dict) ⇒ Object



1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
# File 'lib/Tioga/FigMkr.rb', line 1041

def row_margins(dict)
    check_dict(dict, @@keys_for_row_margins, 'row_margins')
    top_margin = get_if_given_else_default(dict, 'top_margin', 0)
    bottom_margin = get_if_given_else_default(dict, 'bottom_margin', 0)
    num_rows = dict['num_rows']
    first_row = dict['first_row']
    last_row = dict['last_row']
    row_margin = dict['row_margin']
    row = dict['row']
    if row != nil
        first_row = last_row = row
    end
    first_row = 1 if first_row == nil
    last_row = first_row if last_row == nil
    first_row -= 1; last_row -= 1 # switch to 0 for top row instead of 1
    num_rows = last_row + 1 if num_rows == nil
    row_margin = 0 if row_margin == nil
    rows_below = num_rows - last_row - 1
    rows_above = first_row
    row_width = (1.0 - (top_margin + bottom_margin + row_margin * (num_rows-1))) / num_rows
    top_margin = top_margin + rows_above * (row_width + row_margin)
    bottom_margin = bottom_margin + rows_below * (row_width + row_margin)
    return { 'top_margin' => top_margin, 'bottom_margin' => bottom_margin }
end

#save_legend_info(arg) ⇒ Object



669
670
671
672
673
674
675
676
677
678
679
680
681
682
# File 'lib/Tioga/FigMkr.rb', line 669

def save_legend_info(arg)
    if arg.kind_of?String
        dict = { 'text' => arg }
    else
      dict = arg
    end
    prepare_argument_hash(Save_legend_info_args, dict)
    if dict['marker_dict'] == nil
        dict['marker'] = false if dict['marker'] == nil
        dict['marker_color'] = self.line_color if dict['marker_color'] == nil
        dict['marker_scale'] = 0.5 if dict['marker_scale'] == nil
    end
    @legend_info << dict
end

#save_legend_separator(dy) ⇒ Object



809
810
811
# File 'lib/Tioga/FigMkr.rb', line 809

def save_legend_separator(dy)
    save_legend_info('dy' => dy, 'line_width' => -1)
end

#set_aspect_ratio(width_to_height) ⇒ Object



841
842
843
# File 'lib/Tioga/FigMkr.rb', line 841

def set_aspect_ratio(width_to_height)
    set_physical_aspect_ratio(width_to_height)
end

#set_aspect_ratio_relative_to_frame(width_to_height) ⇒ Object



825
826
827
828
829
830
831
832
833
# File 'lib/Tioga/FigMkr.rb', line 825

def set_aspect_ratio_relative_to_frame(width_to_height)
    if width_to_height >= 1
        margin = (1 - 1.0/width_to_height) * 0.5
        set_subframe('top_margin' => margin, 'bottom_margin' => margin)
    else
        margin = (1 - width_to_height) * 0.5
        set_subframe('left_margin' => margin, 'right_margin' => margin)
    end
end

#set_bounds(dict = nil) ⇒ Object



895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
# File 'lib/Tioga/FigMkr.rb', line 895

def set_bounds(dict=nil)
    return if dict == nil
    if dict.kind_of?Array and dict.size == 4
        left = dict[0]
        right = dict[1]
        top = dict[2]
        bottom = dict[3]
    else
        check_dict(dict, @@keys_for_set_bounds, 'set_bounds')
        if (boundaries = dict['boundaries']) != nil and boundaries.kind_of?Array and boundaries.size == 4
            left = boundaries[0]
            right = boundaries[1]
            top = boundaries[2]
            bottom = boundaries[3]
        else
            left = complain_if_missing_numeric_arg(dict,'bounds_left','left_boundary','set_bounds')
            right = complain_if_missing_numeric_arg(dict,'bounds_right','right_boundary','set_bounds')
            top = complain_if_missing_numeric_arg(dict,'bounds_top','top_boundary','set_bounds')
            bottom = complain_if_missing_numeric_arg(dict,'bounds_bottom','bottom_boundary','set_bounds')
        end
    end
    private_set_bounds(left, right, top, bottom)
end

#set_default_font_size(size, update_preview_size_string = true) ⇒ Object



413
414
415
416
417
# File 'lib/Tioga/FigMkr.rb', line 413

def set_default_font_size(size, update_preview_size_string = true)
    private_set_default_font_size(size)
    return unless update_preview_size_string == true
    @tex_preview_fontsize = sprintf("%0.2fbp", size)
end

#set_device_pagesizeObject

#set_frame_sidesObject

plots

#set_landscapeObject



845
846
847
# File 'lib/Tioga/FigMkr.rb', line 845

def set_landscape
    set_aspect_ratio(11.0/8.5)
end

#set_physical_aspect_ratio(width_to_height) ⇒ Object



835
836
837
838
839
# File 'lib/Tioga/FigMkr.rb', line 835

def set_physical_aspect_ratio(width_to_height)
    wd = convert_frame_to_page_dx(1)
    ht = convert_frame_to_page_dy(1)
    set_aspect_ratio_relative_to_frame(width_to_height * ht / wd)
end

#set_portraitObject



853
854
855
# File 'lib/Tioga/FigMkr.rb', line 853

def set_portrait
    set_aspect_ratio(8.5/11.0)
end

#set_subframe(dict = nil) ⇒ Object



864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
# File 'lib/Tioga/FigMkr.rb', line 864

def set_subframe(dict=nil)
    return if dict == nil
    if dict.kind_of?Array and dict.size == 4
        left = dict[0]
        right = dict[1]
        top = dict[2]
        bottom = dict[3]
    else
        check_dict(dict, @@keys_for_set_subframe, 'set_subframe')
        if (margins = dict['margins']) != nil and margins.kind_of?Array and margins.size == 4
            left = margins[0]
            right = margins[1]
            top = margins[2]
            bottom = margins[3]
        else
            left = alt_names(dict, 'left_margin', 'left')
            right = alt_names(dict, 'right_margin', 'right')
            top = alt_names(dict, 'top_margin', 'top')
            bottom = alt_names(dict, 'bottom_margin', 'bottom')
        end
    end
    left = 0 if left == nil
    right = 0 if right == nil
    top = 0 if top == nil
    bottom = 0 if bottom == nil
    private_set_subframe(left, right, top, bottom)
end

#show_arrow(dict) ⇒ Object

TODO: add linestyle capacities to arrows.



1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
# File 'lib/Tioga/FigMkr.rb', line 1498

def show_arrow(dict)
    check_dict(dict, @@keys_for_show_arrow, 'show_arrow')
    if check_pair(head = dict['head'], 'head', 'show_arrow')
        x_head = head[0]
        y_head = head[1]
    else
        x_head = dict['x_head']
        y_head = dict['y_head']
    end
    if (x_head == nil || y_head == nil)
        raise "Sorry: Must give both 'x_head' and 'y_head' for show_arrow."
    end
    if check_pair(tail = dict['tail'], 'tail', 'show_arrow')
        x_tail = tail[0]
        y_tail = tail[1]
    else
        x_tail = dict['x_tail']
        y_tail = dict['y_tail']
    end
    if (x_tail == nil || y_tail == nil)
        raise "Sorry: Must give both 'x_tail' and 'y_tail' for show_arrow."
    end
    color = get_if_given_else_default(dict, 'color', Black)
    head_color = get_if_given_else_default(dict, 'head_color', color)
    tail_color = get_if_given_else_default(dict, 'tail_color', color)
    head_angle = get_if_given_else_default(dict, 'head_angle', 0)
    tail_angle = get_if_given_else_default(dict, 'tail_angle', -180)
    line_color = get_if_given_else_default(dict, 'line_color', color)
    head_marker = get_if_given_else_default(dict, 'head_marker', Arrowhead)
    tail_marker = get_if_given_else_default(dict, 'tail_marker', BarThin)
    line_width = get_if_given_else_default(dict, 'line_width', 1)
    head_scale = dict['head_scale']
    head_scale = @marker_defaults['scale'] if head_scale == nil
    tail_scale = dict['tail_scale']

    # Automatic detection of marker justification
    dict['tail_just'] ||= if tail_marker == Arrowhead || tail_marker == ArrowheadOpen
                            RIGHT_JUSTIFIED
                          else
                            CENTERED
                          end

    dict['head_just'] ||= if head_marker == Arrowhead || head_marker == ArrowheadOpen
                            RIGHT_JUSTIFIED
                          else
                            CENTERED
                          end
                            
    prev_line_cap = self.line_cap
    self.line_cap = LINE_CAP_BUTT if prev_line_cap != LINE_CAP_BUTT
    prev_line_width = self.line_width
    self.line_width = line_width if prev_line_width != line_width
    prev_stroke_color = self.stroke_color
    self.stroke_color = line_color if line_color != prev_stroke_color
    prev_line_type = self.line_type
    if dict['line_style']
        self.line_type = dict['line_style']
    end
    dx = x_head - x_tail
    dy = y_head - y_tail
    pg_dx = convert_figure_to_output_dx(dx)
    pg_dy = convert_figure_to_output_dy(dy)
    len = (pg_dx*pg_dx + pg_dy*pg_dy).sqrt
    chsz = convert_figure_to_output_dx(default_text_height_dx) * head_scale
    chsz = -chsz if chsz < 0
    
    tail_frac = if dict['tail_just'] == RIGHT_JUSTIFIED
                  0.5 * chsz/len
                else
                  0.0
                end
    head_frac = if dict['head_just'] == RIGHT_JUSTIFIED
                  (len - 0.5 * chsz)/len
                else
                  1.0
                end
    if head_frac < tail_frac # Pretty uncommon, I guess
      head_frac = tail_frac = 0.5 # We put everything in the middle, then
    end

    # Don't actually stroke the line if line_width is null. Can be used
    # to draw only the markers.
    stroke_line(x_tail + tail_frac*dx, y_tail + tail_frac*dy, 
                x_tail + head_frac*dx, y_tail + head_frac*dy) if line_width > 0
    angle = convert_to_degrees(dx, dy)
    if head_marker != 'None'
        show_marker('marker' => head_marker, 'point' => [x_head, y_head], 'color' => head_color,
            'justification' => dict['head_just'], 'angle'=> (angle + head_angle), 'scale' => head_scale)
    end
    if tail_marker != 'None'
        if tail_marker == Arrowhead || tail_marker == ArrowheadOpen
            just = RIGHT_JUSTIFIED
        else
            just = CENTERED
        end
        show_marker('marker' => tail_marker, 'point' => [x_tail, y_tail], 'color' => tail_color,
            'angle'=> (angle + tail_angle), 'scale' => tail_scale, 'justification' => dict['tail_just'])
    end
    self.line_cap = prev_line_cap if prev_line_cap != LINE_CAP_BUTT
    self.line_width = prev_line_width if prev_line_width != line_width
    self.stroke_color = prev_stroke_color if prev_stroke_color != line_color
    self.line_type = prev_line_type
end

#show_axisObject

#show_bottom_edgeObject



1134
1135
1136
# File 'lib/Tioga/FigMkr.rb', line 1134

def show_bottom_edge
    show_edge(BOTTOM) if self.bottom_edge_visible && self.xaxis_loc != BOTTOM
end

#show_contour(xs, ys, gaps = nil, color = nil, type = nil, legend = nil) ⇒ Object



1320
1321
1322
# File 'lib/Tioga/FigMkr.rb', line 1320

def show_contour(xs, ys, gaps = nil, color = nil, type = nil, legend = nil)
    show_polyline(xs, ys, color, legend, type, gaps, false)
end

#show_edgeObject

#show_edgesObject



1123
1124
1125
1126
1127
1128
# File 'lib/Tioga/FigMkr.rb', line 1123

def show_edges
    show_top_edge
    show_bottom_edge
    show_left_edge
    show_right_edge
end

#show_error_bars(dict) ⇒ Object



1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
# File 'lib/Tioga/FigMkr.rb', line 1444

def show_error_bars(dict)
    check_dict(dict, @@keys_for_show_error_bars, 'show_error_bars')
    x = dict['x']
    y = dict['y']
    if (x == nil || y == nil)
        raise "Sorry: Must give both 'x' and 'y' for show_error_bar."
    end
    dx = dict['dx']
    dx_plus = get_if_given_else_default(dict, 'dx_plus', dx)
    dx_minus = get_if_given_else_default(dict, 'dx_minus', dx)
    dx_plus = 0 if dx_plus == nil
    dx_minus = 0 if dx_minus == nil
    dy = dict['dy']
    dy_plus = get_if_given_else_default(dict, 'dy_plus', dy)
    dy_minus = get_if_given_else_default(dict, 'dy_minus', dy)
    dy_plus = 0 if dy_plus == nil
    dy_minus = 0 if dy_minus == nil
    if (dx_plus == 0 && dy_minus == 0)
        raise "Sorry: Must give either or both 'dx' and 'dy' error ranges for show_error_bar."
    end
    end_cap = get_if_given_else_default(dict, 'end_cap', 0.15) # end_cap length in default text heights
    x_end_cap = end_cap * self.default_text_height_dy
    y_end_cap = end_cap * self.default_text_height_dx
    line_width = get_if_given_else_default(dict, 'line_width', 1)
    prev_line_width = self.line_width
    self.line_width = line_width if prev_line_width != line_width
    color = get_if_given_else_default(dict, 'color', Black)
    prev_color = self.stroke_color
    self.stroke_color = color if prev_color != color
    # vertical error (dy)
    if (dy_plus != 0 || dy_minus != 0) 
        stroke_line(x, y+dy_plus, x, y-dy_minus)
        stroke_line(x-y_end_cap, y+dy_plus, x+y_end_cap, y+dy_plus)
        stroke_line(x-y_end_cap, y-dy_minus, x+y_end_cap, y-dy_minus)
    end
    # horizontal error (dx)
    if (dx_plus != 0 || dx_minus != 0) 
        stroke_line(x+dx_plus, y, x-dx_minus, y)
        stroke_line(x+dx_plus, y-x_end_cap, x+dx_plus, y+x_end_cap)
        stroke_line(x-dx_minus, y-x_end_cap, x-dx_minus, y+x_end_cap)
    end
    self.line_width = prev_line_width if prev_line_width != line_width
    self.stroke_color = prev_color if prev_color != color
end

#show_grid(dict = {}) ⇒ Object

Draws the gridlines associated with the X and Y axis.

The following list shows the keys that cen be used in dict. In the list, ‘A’ stands for either ‘x’ or ‘y’, and ‘M’ stands for ‘major’ or ‘minor’. Keys can also be specified without the “A_M_” prefix to specify “grid-global” defaults. The grid key, if true, enables both major and minor gridlines for both x and y axes.

  • A_M_grid

  • A_M_line_type

  • A_M_line_width

  • A_M_stroke_opacity

  • A_M_stroke_transparency

  • A_M_stroke_color



1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
# File 'lib/Tioga/FigMkr.rb', line 1208

def show_grid(dict={})
  dict = {
    'line_type' => Line_Type_Dot,
    'rescale_lines' => 0.25,
    'stroke_color' => Gray,
    'major_grid' => true,
    'minor_grid' => false,
    'x_minor_rescale_lines' => 0.5,
    'y_minor_rescale_lines' => 0.5,
  }.merge(dict)

  # "grid-global" context
  context do
    @@keys_for_show_grid.each do |k|
      next unless val = dict[k]
      k += '=' if respond_to? "#{k}="
      next unless respond_to? k
      send(k, val)
    end

    if dict['x_major_grid'] || dict['x_minor_grid'] ||
       dict[  'major_grid'] || dict[  'minor_grid'] || dict['grid']
      top = axis_information(TOP)
      bottom = axis_information(BOTTOM)
      y0 = bottom['y0']
      y1 = top['y1']
      # Do minor and major grid lines in same context so minor lines will
      # inherit properties from major lines.
      context do
        %w[ major minor ].each do |m|
          next unless dict["x_#{m}_grid"] || dict["#{m}_grid"] || dict["grid"]
          @@keys_for_show_grid.each do |k|
            next unless val = dict["x_#{m}_#{k}"]
            k += '=' if respond_to? "#{k}="
            send(k, val)
          end
          bottom["#{m}_ticks"].each {|x| stroke_line(x, y0, x, y1)}
        end
      end
    end

    if dict['y_major_grid'] || dict['y_minor_grid'] ||
       dict[  'major_grid'] || dict[  'minor_grid'] || dict['grid']
      left = axis_information(LEFT)
      right = axis_information(RIGHT)
      x0 = left['x0']
      x1 = right['x1']
      # Do minor and major grid lines in same context so minor lines will
      # inherit properties from major lines.
      context do
        %w[ major minor ].each do |m|
          next unless dict["y_#{m}_grid"] || dict["#{m}_grid"] || dict["grid"]
          @@keys_for_show_grid.each do |k|
            next unless val = dict["y_#{m}_#{k}"]
            k += '=' if respond_to? "#{k}="
            send(k, val)
          end
          left["#{m}_ticks"].each {|y| stroke_line(x0, y, x1, y)}
        end
      end
    end
  end
end

#show_image(dict) ⇒ Object



1671
1672
1673
# File 'lib/Tioga/FigMkr.rb', line 1671

def show_image(dict)
    internal_show_image(dict, false)
end

#show_label(dict) ⇒ Object



1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
# File 'lib/Tioga/FigMkr.rb', line 1974

def show_label(dict)
    at = alt_names(dict, 'at', 'point')
    if check_pair(at, 'at', 'show_text')
        xloc = at[0]
        yloc = at[1]
    else
        xloc = dict['x']
        yloc = dict['y']
    end
    if (xloc == nil || yloc == nil)
        raise "Sorry: Must supply 'at', 'point',  or 'x' and 'y' for show_label"
    end
    return if !check_label_clip(xloc, yloc)
    show_text(dict)
end

#show_left_edgeObject



1138
1139
1140
# File 'lib/Tioga/FigMkr.rb', line 1138

def show_left_edge
    show_edge(LEFT) if self.left_edge_visible && self.yaxis_loc != LEFT
end

#show_legend(legend_background_function = nil) ⇒ Object



685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
# File 'lib/Tioga/FigMkr.rb', line 685

def show_legend(legend_background_function=nil)
    char_dx = self.default_text_height_dx
    char_dy = self.default_text_height_dy
    line_ht_x = char_dx * self.legend_scale
    line_ht_y = char_dy * self.legend_scale
    x = self.legend_text_xstart*line_ht_x
    ltw = self.legend_text_width
    if ltw < 0
        if @pr_margin == 0
            ltw = 1
        else
            ltw = 7
        end
    end
    xright = x + ltw*line_ht_x

    y = 1.0 - self.legend_text_ystart*line_ht_y
    update_bbox(xright, y)
    line_x0 = self.legend_line_x0*line_ht_x
    line_x1 = self.legend_line_x1*line_ht_x
    line_dy = self.legend_line_dy*line_ht_y

    # If we are measuring legends, we come up with a more
    # accurate version of xright:
    if @measure_legends
      xright = x + convert_output_to_figure_dx(legend_text_width)
      xright += line_x0     # To leave a symetric space around
      # the legend !
    end

    self.label_left_margin = self.label_right_margin = self.label_top_margin = self.label_bottom_margin = -1e99
    unless legend_background_function == nil || legend_background_function == false
       ybot = y
      # we need to remove the first element ;-)...
       @legend_info[1..-1].each do |dict|
            dy = dict['dy']; dy = 1 if dy == nil
            ybot -= line_ht_y * dy
       end
       # We add half a line below to look good
       ybot -= line_ht_y * 0.5
       ytop = y + @legend_info.first['dy'] * line_ht_y * 0.5
       legend_background_function.call([ 0, xright, ytop, ybot ])
    end
    legend_index = 0
    if @legend_info != nil
        @legend_info.each do |dict|
            text = dict['text']
            if text != nil
                # We prepare a dictionnary:
                dct = { 'text' => text,
                         'x' => x, 'y' => y, 'scale' => self.legend_scale,
                         'justification' => self.legend_justification,
                         'alignment' => self.legend_alignment }
                if @measure_legends
                  dct['measure'] = "legend-#{legend_index}"
                  legend_index += 1
                end
                show_text(dct)
            end
            line_width = dict['line_width']
            line_type = dict['line_type']
            unless (line_width < 0) || ((line_type.kind_of?String) && (line_type.casecmp('none') == 0))
            
                save_line_color = self.line_color
                save_line_width = self.line_width
                save_line_cap = self.line_cap
                save_line_type = self.line_type
                
                self.line_color = dict['line_color']
                self.line_width = dict['line_width']
                self.line_cap = dict['line_cap']
                self.line_type = line_type
                
                stroke_line(line_x0, y+line_dy, line_x1, y+line_dy)
            
                self.line_color = save_line_color
                self.line_width = save_line_width
                self.line_cap = save_line_cap
                self.line_type = save_line_type
                
            end
            # place any marker right in the middle of the line
            if dict['marker_dict'] != nil
                marker_dict = dict['marker_dict']
                marker_dict['x'] = 0.5*(line_x0 + line_x1)
                marker_dict['y'] = y+line_dy
                show_marker(marker_dict)
            elsif dict['marker']
                show_marker( 'x' => 0.5*(line_x0 + line_x1),
                        'y' => (y+line_dy),
                        'marker' => dict['marker'],
                        'color' => dict['marker_color'],
                        'scale' => dict['marker_scale'])
            end
            dy = dict['dy']; dy = 1 if dy == nil
            y -= line_ht_y * dy
        end
    end
end

#show_marker(dict) ⇒ Object



1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
# File 'lib/Tioga/FigMkr.rb', line 1901

def show_marker(dict)
    check_dict(dict, @@keys_for_show_marker, 'show_marker')
    marker = dict['marker']
    x = y = nil
    at = alt_names(dict, 'at', 'point')
    if check_pair(at, 'at', 'show_text')
        x = at[0]; y = at[1];
    end
    x = dict['x'] if x == nil
    y = dict['y'] if y == nil
    xs = alt_names(dict, 'Xs', 'xs')
    ys = alt_names(dict, 'Ys', 'ys')
    if ((xs != nil && ys == nil) || (ys != nil && xs == nil))
        raise "Sorry: Must supply both xs and ys for show_marker"
    end
    if (xs != nil && ys != nil && xs.size != ys.size)
        raise "Sorry: Must equal length xs and ys for show_marker"
    end
    color = dict['color']
    if color == nil
        fill_color = get_if_given_else_use_default_dict(dict, 'fill_color', @marker_defaults)
        stroke_color = get_if_given_else_use_default_dict(dict, 'stroke_color', @marker_defaults)
    else
      stroke_color = dict['stroke_color'] || color
      fill_color = dict['fill_color'] || color
    end
    font = dict['font']
    mode = alt_names(dict, 'mode', 'rendering_mode')
    string = alt_names(dict, 'string', 'text')
    if (marker == nil && string == nil)
        raise "Sorry: Must give either 'marker' or 'string' for show_marker"
    end
    if (marker != nil && string != nil)
        raise "Sorry: Must give either 'marker' or 'string' for show_marker, but not both"
    end
    
    stroke_width = get_if_given_else_default(dict, 'stroke_width', stroke_width)
    angle = get_if_given_else_use_default_dict(dict, 'angle', @marker_defaults)
    scale = get_if_given_else_use_default_dict(dict, 'scale', @marker_defaults)
    just = get_if_given_else_use_default_dict(dict, 'justification', @marker_defaults)
    align = get_if_given_else_use_default_dict(dict, 'alignment', @marker_defaults)
    h_scale = get_if_given_else_use_default_dict(dict, 'horizontal_scale', @marker_defaults)
    v_scale = get_if_given_else_use_default_dict(dict, 'vertical_scale', @marker_defaults)
    it_angle = get_if_given_else_use_default_dict(dict, 'italic_angle', @marker_defaults)
    ascent_angle = get_if_given_else_use_default_dict(dict, 'ascent_angle', @marker_defaults)
    glyph = 0 if glyph == nil
                 
    args = [marker, font, mode, align, just, stroke_width, string, x, y, xs, ys,
            h_scale, v_scale, scale, it_angle, ascent_angle, angle, fill_color, stroke_color]
    private_show_marker(args)       
                 
    legend_arg = dict['legend']
    if legend_arg != nil
        if legend_arg.kind_of?Hash
            legend = legend_arg.dup
            legend["line_type"] = 'None' if legend["line_type"] == nil
            legend["marker"] = marker if legend["marker"] == nil
            legend["marker_scale"] = scale if legend["marker_scale"] == nil
            legend["marker_color"] = fill_color if legend["marker_color"] == nil
            save_legend_info(legend)
        elsif legend_arg.kind_of?String
            save_legend_info(
                'line_type' => 'None', 
                'marker' => marker, 
                'marker_scale' => scale,
                'marker_color' => fill_color, 
                'text' => legend_arg)
        else
            save_legend_info(legend_arg)
        end
    end
end

#show_plot(bounds = nil, &cmd) ⇒ Object



970
971
972
973
974
975
976
# File 'lib/Tioga/FigMkr.rb', line 970

def show_plot(bounds=nil,&cmd)       
    trace_cmd_one_arg(@enter_show_plot_function, @exit_show_plot_function, bounds) {        
        set_bounds(bounds)
        context { clip_to_frame; cmd.call(self) }
        show_plot_box
    }      
end

#show_plot_boxObject



1106
1107
1108
1109
1110
1111
1112
1113
# File 'lib/Tioga/FigMkr.rb', line 1106

def show_plot_box
    show_xaxis
    show_yaxis
    show_edges
    show_title
    show_xlabel
    show_ylabel
end

#show_plot_with_legend(dict = nil, &cmd) ⇒ Object



1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
# File 'lib/Tioga/FigMkr.rb', line 1276

def show_plot_with_legend(dict=nil, &cmd)
    check_dict(dict, @@keys_for_show_plot_with_legend, 'show_plot_with_legend') if dict != nil
    legend_top_margin = get_if_given_else_use_default_dict(dict, 'legend_top_margin', @legend_defaults)
    legend_bottom_margin = get_if_given_else_use_default_dict(dict, 'legend_bottom_margin', @legend_defaults)
    legend_left_margin = get_if_given_else_use_default_dict(dict, 'legend_left_margin', @legend_defaults)
    legend_right_margin = get_if_given_else_use_default_dict(dict, 'legend_right_margin', @legend_defaults)
    legend_scale = get_if_given_else_use_default_dict(dict, 'legend_scale', @legend_defaults)
    plot_top_margin = get_if_given_else_use_default_dict(dict, 'plot_top_margin', @legend_defaults)
    plot_bottom_margin = get_if_given_else_use_default_dict(dict, 'plot_bottom_margin', @legend_defaults)
    plot_left_margin = get_if_given_else_use_default_dict(dict, 'plot_left_margin', @legend_defaults)
    plot_right_margin = get_if_given_else_use_default_dict(dict, 'plot_right_margin', @legend_defaults)
    plot_scale = get_if_given_else_use_default_dict(dict, 'plot_scale', @legend_defaults)
    legend_background_function = get_if_given_else_default(dict, 'legend_background_function', nil)
    @legend_subframe = [legend_left_margin, legend_right_margin, 
                        legend_top_margin, legend_bottom_margin]
    reset_legend_info
    rescale(plot_scale)
    subplot([plot_left_margin, plot_right_margin, plot_top_margin, plot_bottom_margin]) { cmd.call(self) }
    # We temporary store the legend information in @legend_subframes
    set_subframe(@legend_subframe)
    rescale(legend_scale) # note that legend_scale is an addition to the plot_scale, not a replacement
    @pr_margin = plot_right_margin
    show_legend(legend_background_function)
    @legend_subframe = nil
end

#show_plot_without_clipping(bounds = nil, &cmd) ⇒ Object



979
980
981
982
983
984
985
# File 'lib/Tioga/FigMkr.rb', line 979

def show_plot_without_clipping(bounds=nil,&cmd)       
    trace_cmd_one_arg(@enter_show_plot_function, @exit_show_plot_function, bounds) {        
        set_bounds(bounds)
        context { cmd.call(self) }
        show_plot_box
    }      
end

#show_polyline(xs, ys, color = nil, legend = nil, type = nil, gaps = nil, close_subpaths = nil) ⇒ Object



1306
1307
1308
1309
1310
1311
1312
1313
1314
# File 'lib/Tioga/FigMkr.rb', line 1306

def show_polyline(xs, ys, color = nil, legend = nil, type = nil, gaps = nil, close_subpaths = nil)
    context do
        self.line_type = type if type != nil
        self.stroke_color = color if color != nil
        append_points_with_gaps_to_path(xs, ys, gaps, close_subpaths)
        stroke
        save_legend_info(legend) if legend != nil
    end
end

#show_right_edgeObject



1142
1143
1144
# File 'lib/Tioga/FigMkr.rb', line 1142

def show_right_edge
    show_edge(RIGHT) if self.right_edge_visible && self.yaxis_loc != RIGHT
end

#show_rotated_labelObject

#show_rotated_textObject

#show_text(dict) ⇒ Object



1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
# File 'lib/Tioga/FigMkr.rb', line 1993

def show_text(dict)
    check_dict(dict, @@keys_for_show_text, 'show_text')
    text = dict['text']
    if text == nil
        raise "Sorry: Must supply 'text' entry in dictionary for show_text"
    end
    scale = get_if_given_else_default(dict, 'scale', 1)
    color = dict['color'] # color is [r,g,b] array.  this adds \textcolor[rgb]{r,g,b}{...}
    if color != nil
        if !color.kind_of? Array
            raise "Sorry: 'color' must be array of [r,g,b] intensities for show_text (#{color})"
        end
        r = color[0]; g = color[1]; b = color[2];
        if (!(r.kind_of? Numeric) || !(g.kind_of? Numeric) || !(b.kind_of? Numeric) )
            raise "Sorry: 'color' must be array of [r,g,b] intensities for show_text"
        end 
        text = sprintf("\\textcolor[rgb]{%0.2f,%0.2f,%0.2f}{%s}", r, g, b, text)
    end
    just = get_if_given_else_default(dict, 'justification', self.justification)
    align = get_if_given_else_default(dict, 'alignment', self.alignment)
    angle = get_if_given_else_default(dict, 'angle', 0)

    loc = alt_names(dict, 'loc', 'side')
    if (loc == nil)
        at = alt_names(dict, 'at', 'point')
        if check_pair(at, 'at', 'show_text')
            xloc = at[0]
            yloc = at[1]
        else
            xloc = dict['x']
            yloc = dict['y']
        end
        if (xloc == nil || yloc == nil)
            raise "Sorry: Must supply a location for show_text"
        end
        show_rotated_label(text, xloc, yloc, scale, angle, just, align, 
                           dict['measure'] || nil)
        return
    end
    position = alt_names(dict, 'position', 'pos')
    position = 0.5 if position == nil
    shift = dict['shift']
    if loc == LEFT
        shift = self.text_shift_on_left if shift == nil
    elsif loc == RIGHT
        shift = self.text_shift_on_right if shift == nil
    elsif loc == TOP
        shift = self.text_shift_on_top if shift == nil
    elsif loc == BOTTOM
        shift = self.text_shift_on_bottom if shift == nil
    else
        angle_add = 0
        if (loc == AT_X_ORIGIN)
            shift = self.text_shift_from_x_origin if shift == nil
            xloc = shift*self.default_text_height_dx
            yloc = convert_frame_to_figure_y(position)
            angle_add = 90
        elsif (loc == AT_Y_ORIGIN)
            shift = self.text_shift_from_y_origin if shift == nil
            yloc = shift*self.default_text_height_dx
            xloc = convert_frame_to_figure_x(position)
        else
            raise "Sorry: 'loc' must be LEFT, RIGHT, TOP, BOTTOM, AT_X_ORIGIN, or AT_Y_ORIGIN for show_text"
        end
        show_rotated_label(text, xloc, yloc, scale, angle + angle_add, just, align,
                           dict['measure'])
        return
    end
    show_rotated_text(text, loc, shift, position, scale, angle, just, 
                      align, dict['measure'])
end

#show_title(text = nil) ⇒ Object



1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
# File 'lib/Tioga/FigMkr.rb', line 1146

def show_title(text = nil)
    text = self.title if text == nil
    if (self.title_visible && text != nil)
        show_text('text' => text,
            'side' => self.title_side, 'position' => self.title_position,
            'scale' => self.title_scale, 'shift' => self.title_shift,
            'angle' => self.title_angle, 'alignment' => self.title_alignment,
            'justification' => self.title_justification,
            'color' => self.title_color)
    end
end

#show_top_edgeObject



1130
1131
1132
# File 'lib/Tioga/FigMkr.rb', line 1130

def show_top_edge
    show_edge(TOP) if self.top_edge_visible && self.xaxis_loc != TOP
end

#show_xaxisObject



1115
1116
1117
# File 'lib/Tioga/FigMkr.rb', line 1115

def show_xaxis
    show_axis(self.xaxis_loc) if self.xaxis_visible
end

#show_xlabel(text = nil) ⇒ Object



1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
# File 'lib/Tioga/FigMkr.rb', line 1158

def show_xlabel(text = nil)
    text = self.xlabel if text == nil
    if (self.xlabel_visible && text != nil)
        angle = self.xlabel_angle
        side = self.xlabel_side
        shift = self.xlabel_shift
        shift -= 0.5 if (side == TOP && angle == 0)
        show_text('text' => text,
            'side' => side, 'position' => self.xlabel_position,
            'scale' => self.xlabel_scale, 'shift' => shift,
            'angle' => angle, 'alignment' => self.xlabel_alignment,
            'justification' => self.xlabel_justification,
            'color' => self.xlabel_color)
    end
end

#show_yaxisObject



1119
1120
1121
# File 'lib/Tioga/FigMkr.rb', line 1119

def show_yaxis
    show_axis(self.yaxis_loc) if self.yaxis_visible
end

#show_ylabel(text = nil) ⇒ Object



1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
# File 'lib/Tioga/FigMkr.rb', line 1174

def show_ylabel(text = nil)
    text = self.ylabel if text == nil
    if (self.ylabel_visible && text != nil)
        angle = self.ylabel_angle
        side = self.ylabel_side
        shift = self.ylabel_shift
        shift += 0.5 if (side == RIGHT && angle == 0)
        show_text('text' => text,
            'side' => side, 'position' => self.ylabel_position,
            'scale' => self.ylabel_scale, 'shift' => shift,
            'angle' => angle, 'alignment' => self.ylabel_alignment,
            'justification' => self.ylabel_justification,
            'color' => self.ylabel_color)
    end
end

#string_hls_to_rgb(str) ⇒ Object



1656
1657
1658
# File 'lib/Tioga/FigMkr.rb', line 1656

def string_hls_to_rgb(str)
  string_hls_to_rgb!(String.new(str))
end

#string_hls_to_rgb!Object

#string_rgb_to_hls(str) ⇒ Object



1661
1662
1663
# File 'lib/Tioga/FigMkr.rb', line 1661

def string_rgb_to_hls(str)
  string_rgb_to_hls!(String.new(str))
end

#string_rgb_to_hls!Object

#strokeObject

#stroke_circleObject

#stroke_frameObject

#stroke_lineObject

#stroke_ovalObject

#stroke_polyline(xs, ys, color = nil, legend = nil, type = nil, gaps = nil, close_subpaths = nil) ⇒ Object



1316
1317
1318
# File 'lib/Tioga/FigMkr.rb', line 1316

def stroke_polyline(xs, ys, color = nil, legend = nil, type = nil, gaps = nil, close_subpaths = nil)
    show_polyline(xs, ys, color, legend, type, gaps, close_subpaths)
end

#stroke_rectObject

#stroke_rounded_rectObject

#stroke_transparencyObject



526
527
528
# File 'lib/Tioga/FigMkr.rb', line 526

def stroke_transparency
    self.transparency_for_stroke
end

#stroke_transparency=(frac) ⇒ Object



530
531
532
# File 'lib/Tioga/FigMkr.rb', line 530

def stroke_transparency=(frac)
    self.transparency_for_stroke = frac
end

#stroke_widthObject



475
476
477
# File 'lib/Tioga/FigMkr.rb', line 475

def stroke_width
    self.line_width
end

#stroke_width=(width) ⇒ Object



479
480
481
# File 'lib/Tioga/FigMkr.rb', line 479

def stroke_width=(width)
    self.line_width=(width)
end

#subfigure(margins = nil, &cmd) ⇒ Object



988
989
990
991
992
# File 'lib/Tioga/FigMkr.rb', line 988

def subfigure(margins=nil,&cmd)
    trace_cmd_one_arg(@enter_subfigure_function, @exit_subfigure_function, margins) {        
        context { doing_subfigure; set_subframe(margins); cmd.call(self) }
    }      
end

#subplot(margins = nil, &cmd) ⇒ Object



1002
1003
1004
1005
1006
1007
# File 'lib/Tioga/FigMkr.rb', line 1002

def subplot(margins=nil,&cmd)
    trace_cmd_one_arg(@enter_subplot_function, @exit_subplot_function, margins) {        
        reset_legend_info
        context { doing_subplot; set_subframe(margins); cmd.call(self) }
    }      
end

#tex_preview_preambleObject

for backward compatibility



441
442
443
# File 'lib/Tioga/FigMkr.rb', line 441

def tex_preview_preamble # for backward compatibility
    self.tex_preamble
end

#tex_preview_preamble=(str) ⇒ Object



445
446
447
# File 'lib/Tioga/FigMkr.rb', line 445

def tex_preview_preamble=(str)
    self.tex_preamble = str
end

#tex_xaxis_numeric_labelObject



385
386
387
# File 'lib/Tioga/FigMkr.rb', line 385

def tex_xaxis_numeric_label
  self.xaxis_numeric_label_tex
end

#tex_xaxis_numeric_label=(str) ⇒ Object



389
390
391
# File 'lib/Tioga/FigMkr.rb', line 389

def tex_xaxis_numeric_label=(str)
  self.xaxis_numeric_label_tex = str
end

#tex_yaxis_numeric_labelObject



394
395
396
# File 'lib/Tioga/FigMkr.rb', line 394

def tex_yaxis_numeric_label
  self.yaxis_numeric_label_tex
end

#tex_yaxis_numeric_label=(str) ⇒ Object



398
399
400
# File 'lib/Tioga/FigMkr.rb', line 398

def tex_yaxis_numeric_label=(str)
  self.yaxis_numeric_label_tex = str
end

#title_visible=(bool) ⇒ Object



535
536
537
538
539
540
# File 'lib/Tioga/FigMkr.rb', line 535

def title_visible=(bool)
    if bool != false
        raise "Sorry: can only set 'title_visible' to false."
    end
    self.no_title
end

#top_edge_visible=(bool) ⇒ Object



584
585
586
587
588
589
# File 'lib/Tioga/FigMkr.rb', line 584

def top_edge_visible=(bool)
    if bool != false
        raise "Sorry: can only set 'top_edge_visible' to false."
    end
    self.no_top_edge
end

#trace_cmd_no_arg(entry_function, exit_function, &cmd) ⇒ Object



920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
# File 'lib/Tioga/FigMkr.rb', line 920

def trace_cmd_no_arg(entry_function, exit_function, &cmd)
    
    unless entry_function == nil 
        begin
            entry_function.call(self)
        rescue Exception => er
            report_error(er, nil)
        end
    end
    
    result = cmd.call(self)
    
    unless exit_function == nil 
        begin
            exit_function.call(self)
        rescue Exception => er
            report_error(er, nil)
        end
    end
    
    return result
    
end

#trace_cmd_one_arg(entry_function, exit_function, arg, &cmd) ⇒ Object



945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
# File 'lib/Tioga/FigMkr.rb', line 945

def trace_cmd_one_arg(entry_function, exit_function, arg, &cmd)
    
    unless entry_function == nil 
        begin
            entry_function.call(arg)
        rescue Exception => er
            report_error(er, nil)
        end
    end
    
    result = cmd.call(self)
    
    unless exit_function == nil 
        begin
            exit_function.call(arg)
        rescue Exception => er
            report_error(er, nil)
        end
    end
    
    return result
    
end

#transparency_for_fillObject



509
510
511
# File 'lib/Tioga/FigMkr.rb', line 509

def transparency_for_fill
    1.0 - self.fill_opacity
end

#transparency_for_fill=(frac) ⇒ Object



513
514
515
# File 'lib/Tioga/FigMkr.rb', line 513

def transparency_for_fill=(frac)
    self.fill_opacity=(1.0 - frac)
end

#transparency_for_strokeObject



501
502
503
# File 'lib/Tioga/FigMkr.rb', line 501

def transparency_for_stroke
    1.0 - self.stroke_opacity
end

#transparency_for_stroke=(frac) ⇒ Object



505
506
507
# File 'lib/Tioga/FigMkr.rb', line 505

def transparency_for_stroke=(frac)
    self.stroke_opacity=(1.0 - frac)
end

#update_bboxObject

#xaxis_visible=(bool) ⇒ Object



556
557
558
559
560
561
# File 'lib/Tioga/FigMkr.rb', line 556

def xaxis_visible=(bool)
    if bool != false
        raise "Sorry: can only set 'xaxis_visible' to false."
    end
    self.no_xaxis
end

#xlabel_visible=(bool) ⇒ Object



542
543
544
545
546
547
# File 'lib/Tioga/FigMkr.rb', line 542

def xlabel_visible=(bool)
    if bool != false
        raise "Sorry: can only set 'xlabel_visible' to false."
    end
    self.no_xlabel
end

#yaxis_visible=(bool) ⇒ Object



563
564
565
566
567
568
# File 'lib/Tioga/FigMkr.rb', line 563

def yaxis_visible=(bool)
    if bool != false
        raise "Sorry: can only set 'yaxis_visible' to false."
    end
    self.no_yaxis
end

#ylabel_visible=(bool) ⇒ Object



549
550
551
552
553
554
# File 'lib/Tioga/FigMkr.rb', line 549

def ylabel_visible=(bool)
    if bool != false
        raise "Sorry: can only set 'ylabel_visible' to false."
    end
    self.no_ylabel
end