Class: Tioga::FigureMaker
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: svn+ssh://rubyforge.org/var/svn/tioga/tags/tioga/Tioga%201.18/lib/Tioga/FigMkr.rb $'
- TIOGA_VERSION =
if SVN_URL =~ /tags\/tioga\/Tioga%20([^\/]+)/
$1
else
"SVN version"
end
- 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, '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{AliceBlue}{rgb}{0.940,0.972,1.000}
\definecolor{AntiqueWhite}{rgb}{0.980,0.920,0.844}
\definecolor{Aqua}{rgb}{0.000,1.000,1.000}
\definecolor{Aquamarine}{rgb}{0.498,1.000,0.830}
\definecolor{Avocado}{rgb}{0.600,0.600,0.000}
\definecolor{Azure}{rgb}{0.940,1.000,1.000}
\definecolor{Beige}{rgb}{0.960,0.960,0.864}
\definecolor{Bisque}{rgb}{1.000,0.894,0.770}
\definecolor{Black}{rgb}{0.000,0.000,0.000}
\definecolor{BlanchedAlmond}{rgb}{1.000,0.920,0.804}
\definecolor{Blue}{rgb}{0.000,0.000,1.000}
\definecolor{BlueGreen}{rgb}{0.000,0.600,0.400}
\definecolor{BlueViolet}{rgb}{0.540,0.170,0.888}
\definecolor{BrickRed}{rgb}{0.645,0.000,0.129}
\definecolor{BrightBlue}{rgb}{0.000,0.400,1.000}
\definecolor{BrightPink}{rgb}{1.000,0.400,0.800}
\definecolor{Brown}{rgb}{0.648,0.165,0.165}
\definecolor{Burgundy}{rgb}{0.600,0.000,0.200}
\definecolor{BurlyWood}{rgb}{0.870,0.720,0.530}
\definecolor{CadetBlue}{rgb}{0.372,0.620,0.628}
\definecolor{Cement}{rgb}{0.800,0.800,0.600}
\definecolor{Chartreuse}{rgb}{0.498,1.000,0.000}
\definecolor{Chiffon}{rgb}{0.980,0.980,0.824}
\definecolor{Chocolate}{rgb}{0.824,0.410,0.116}
\definecolor{Coral}{rgb}{1.000,0.498,0.312}
\definecolor{CornflowerBlue}{rgb}{0.392,0.585,0.930}
\definecolor{Cornsilk}{rgb}{1.000,0.972,0.864}
\definecolor{Crimson}{rgb}{0.800,0.000,0.200}
\definecolor{Cyan}{rgb}{0.000,1.000,1.000}
\definecolor{DarkBlue}{rgb}{0.000,0.000,0.545}
\definecolor{DarkChocolate}{rgb}{0.400,0.200,0.000}
\definecolor{DarkCyan}{rgb}{0.000,0.545,0.545}
\definecolor{DarkGoldenrod}{rgb}{0.720,0.525,0.044}
\definecolor{DarkGray}{rgb}{0.664,0.664,0.664}
\definecolor{DarkGreen}{rgb}{0.000,0.392,0.000}
\definecolor{DarkGrey}{rgb}{0.664,0.664,0.664}
\definecolor{DarkKhaki}{rgb}{0.740,0.716,0.420}
\definecolor{DarkLavender}{rgb}{0.400,0.200,0.600}
\definecolor{DarkMagenta}{rgb}{0.545,0.000,0.545}
\definecolor{DarkOliveGreen}{rgb}{0.332,0.420,0.185}
\definecolor{DarkOrange}{rgb}{1.000,0.550,0.000}
\definecolor{DarkOrchid}{rgb}{0.600,0.196,0.800}
\definecolor{DarkPeriwinkle}{rgb}{0.400,0.400,1.000}
\definecolor{DarkPurpleBlue}{rgb}{0.400,0.000,0.800}
\definecolor{DarkRed}{rgb}{0.545,0.000,0.000}
\definecolor{DarkRoyalBlue}{rgb}{0.000,0.200,0.800}
\definecolor{DarkSalmon}{rgb}{0.912,0.590,0.480}
\definecolor{DarkSeaGreen}{rgb}{0.560,0.736,0.560}
\definecolor{DarkSlateBlue}{rgb}{0.284,0.240,0.545}
\definecolor{DarkSlateGray}{rgb}{0.185,0.310,0.310}
\definecolor{DarkSlateGrey}{rgb}{0.185,0.310,0.310}
\definecolor{DarkSmoke}{rgb}{0.920,0.920,0.920}
\definecolor{DarkTurquoise}{rgb}{0.000,0.808,0.820}
\definecolor{DarkViolet}{rgb}{0.580,0.000,0.828}
\definecolor{DeepPink}{rgb}{1.000,0.080,0.576}
\definecolor{DeepSkyBlue}{rgb}{0.000,0.750,1.000}
\definecolor{DimGray}{rgb}{0.410,0.410,0.410}
\definecolor{DimGrey}{rgb}{0.410,0.410,0.410}
\definecolor{DodgerBlue}{rgb}{0.116,0.565,1.000}
\definecolor{FireBrick}{rgb}{0.698,0.132,0.132}
\definecolor{FloralWhite}{rgb}{1.000,0.980,0.940}
\definecolor{ForestGreen}{rgb}{0.132,0.545,0.132}
\definecolor{Fuchsia}{rgb}{1.000,0.000,1.000}
\definecolor{Gainsboro}{rgb}{0.864,0.864,0.864}
\definecolor{GhostWhite}{rgb}{0.972,0.972,1.000}
\definecolor{Gold}{rgb}{1.000,0.844,0.000}
\definecolor{GoldenBrown}{rgb}{0.600,0.400,0.000}
\definecolor{Goldenrod}{rgb}{0.855,0.648,0.125}
\definecolor{GrassGreen}{rgb}{0.200,0.600,0.000}
\definecolor{Gray}{rgb}{0.500,0.500,0.500}
\definecolor{GrayBlue}{rgb}{0.000,0.400,0.600}
\definecolor{Green}{rgb}{0.000,0.500,0.000}
\definecolor{GreenYellow}{rgb}{0.680,1.000,0.185}
\definecolor{Grey}{rgb}{0.500,0.500,0.500}
\definecolor{Honeydew}{rgb}{0.940,1.000,0.940}
\definecolor{HotPink}{rgb}{1.000,0.410,0.705}
\definecolor{IndianRed}{rgb}{0.804,0.360,0.360}
\definecolor{Indigo}{rgb}{0.294,0.000,0.510}
\definecolor{Ivory}{rgb}{1.000,1.000,0.940}
\definecolor{Khaki}{rgb}{0.940,0.900,0.550}
\definecolor{Lavender}{rgb}{0.900,0.900,0.980}
\definecolor{LavenderBlue}{rgb}{0.400,0.200,1.000}
\definecolor{LavenderBlush}{rgb}{1.000,0.940,0.960}
\definecolor{LawnGreen}{rgb}{0.488,0.990,0.000}
\definecolor{LemonChiffon}{rgb}{1.000,0.980,0.804}
\definecolor{LightBlue}{rgb}{0.680,0.848,0.900}
\definecolor{LightBrightGreen}{rgb}{0.000,0.800,0.200}
\definecolor{LightCoral}{rgb}{0.940,0.500,0.500}
\definecolor{LightCrimson}{rgb}{0.864,0.080,0.235}
\definecolor{LightCyan}{rgb}{0.880,1.000,1.000}
\definecolor{LightDullGreen}{rgb}{0.400,1.000,0.600}
\definecolor{LightGold}{rgb}{0.800,0.800,0.400}
\definecolor{LightGrassGreen}{rgb}{0.400,1.000,0.400}
\definecolor{LightGray}{rgb}{0.828,0.828,0.828}
\definecolor{LightGreen}{rgb}{0.565,0.932,0.565}
\definecolor{LightGrey}{rgb}{0.828,0.828,0.828}
\definecolor{LightMustard}{rgb}{1.000,0.800,0.400}
\definecolor{LightOliveGreen}{rgb}{0.600,0.800,0.600}
\definecolor{LightOrchid}{rgb}{0.600,0.400,0.800}
\definecolor{LightPlum}{rgb}{0.800,0.600,0.800}
\definecolor{LightRose}{rgb}{1.000,0.600,0.800}
\definecolor{LightSalmon}{rgb}{1.000,0.628,0.480}
\definecolor{LightSandyBrown}{rgb}{1.000,0.800,0.600}
\definecolor{LightSeaGreen}{rgb}{0.125,0.698,0.668}
\definecolor{LightSienna}{rgb}{0.800,0.400,0.000}
\definecolor{LightSkyBlue}{rgb}{0.530,0.808,0.980}
\definecolor{LightSlateGray}{rgb}{0.468,0.532,0.600}
\definecolor{LightSlateGrey}{rgb}{0.468,0.532,0.600}
\definecolor{LightSteelBlue}{rgb}{0.690,0.770,0.870}
\definecolor{LightTurquoise}{rgb}{0.200,1.000,0.800}
\definecolor{LightYellow}{rgb}{1.000,1.000,0.880}
\definecolor{LightYellowGreen}{rgb}{0.800,0.800,0.200}
\definecolor{Lilac}{rgb}{0.800,0.600,1.000}
\definecolor{Lime}{rgb}{0.000,1.000,0.000}
\definecolor{LimeGreen}{rgb}{0.196,0.804,0.196}
\definecolor{Linen}{rgb}{0.980,0.940,0.900}
\definecolor{Magenta}{rgb}{1.000,0.000,1.000}
\definecolor{Maroon}{rgb}{0.500,0.000,0.000}
\definecolor{Mauve}{rgb}{0.800,0.200,0.400}
\definecolor{MediumAquamarine}{rgb}{0.400,0.804,0.668}
\definecolor{MediumBlue}{rgb}{0.000,0.000,0.804}
\definecolor{MediumGreen}{rgb}{0.000,0.600,0.000}
\definecolor{MediumOrange}{rgb}{1.000,0.400,0.000}
\definecolor{MediumOrchid}{rgb}{0.730,0.332,0.828}
\definecolor{MediumPurple}{rgb}{0.576,0.440,0.860}
\definecolor{MediumSeaGreen}{rgb}{0.235,0.700,0.444}
\definecolor{MediumSlateBlue}{rgb}{0.484,0.408,0.932}
\definecolor{MediumSpringGreen}{rgb}{0.000,0.980,0.604}
\definecolor{MediumTurquoise}{rgb}{0.284,0.820,0.800}
\definecolor{MediumVioletRed}{rgb}{0.780,0.084,0.520}
\definecolor{YellowGreen}{rgb}{0.800,0.800,0.000}
\definecolor{MidnightBlue}{rgb}{0.098,0.098,0.440}
\definecolor{MintCream}{rgb}{0.960,1.000,0.980}
\definecolor{MistyRose}{rgb}{1.000,0.894,0.884}
\definecolor{Moccasin}{rgb}{1.000,0.894,0.710}
\definecolor{MustardSeed}{rgb}{0.800,0.600,0.000}
\definecolor{NavajoWhite}{rgb}{1.000,0.870,0.680}
\definecolor{Navy}{rgb}{0.000,0.000,0.500}
\definecolor{OldLace}{rgb}{0.992,0.960,0.900}
\definecolor{Olive}{rgb}{0.500,0.500,0.000}
\definecolor{OliveDrab}{rgb}{0.420,0.556,0.136}
\definecolor{Orange}{rgb}{1.000,0.648,0.000}
\definecolor{OrangeRed}{rgb}{1.000,0.270,0.000}
\definecolor{Orchid}{rgb}{0.855,0.440,0.840}
\definecolor{PaleGoldenrod}{rgb}{0.932,0.910,0.668}
\definecolor{PaleGreen}{rgb}{0.596,0.985,0.596}
\definecolor{PaleTurquoise}{rgb}{0.688,0.932,0.932}
\definecolor{PaleVioletRed}{rgb}{0.860,0.440,0.576}
\definecolor{PapayaWhip}{rgb}{1.000,0.936,0.835}
\definecolor{PeachPuff}{rgb}{1.000,0.855,0.725}
\definecolor{Periwinkle}{rgb}{0.600,0.000,1.000}
\definecolor{Peru}{rgb}{0.804,0.520,0.248}
\definecolor{Pink}{rgb}{1.000,0.752,0.796}
\definecolor{Plum}{rgb}{0.868,0.628,0.868}
\definecolor{PowderBlue}{rgb}{0.690,0.880,0.900}
\definecolor{Pumpkin}{rgb}{1.000,0.600,0.200}
\definecolor{Purple}{rgb}{0.500,0.000,0.500}
\definecolor{PurpleBlue}{rgb}{0.400,0.200,0.800}
\definecolor{PurpleGray}{rgb}{0.600,0.600,0.800}
\definecolor{Red}{rgb}{1.000,0.000,0.000}
\definecolor{RedBrown}{rgb}{0.800,0.400,0.200}
\definecolor{RedOrange}{rgb}{0.800,0.200,0.000}
\definecolor{Rose}{rgb}{1.000,0.400,0.600}
\definecolor{RosyBrown}{rgb}{0.736,0.560,0.560}
\definecolor{RoyalBlue}{rgb}{0.255,0.410,0.884}
\definecolor{RoyalPurple}{rgb}{0.400,0.000,0.600}
\definecolor{SaddleBrown}{rgb}{0.545,0.270,0.075}
\definecolor{LightChartreuse}{rgb}{0.800,1.000,0.400}
\definecolor{Saffron}{rgb}{1.000,0.800,0.000}
\definecolor{Salmon}{rgb}{0.980,0.500,0.448}
\definecolor{SalmonRed}{rgb}{1.000,0.400,0.400}
\definecolor{SandyBrown}{rgb}{0.956,0.644,0.376}
\definecolor{SeaGreen}{rgb}{0.180,0.545,0.340}
\definecolor{Seashell}{rgb}{1.000,0.960,0.932}
\definecolor{Sienna}{rgb}{0.628,0.320,0.176}
\definecolor{Silver}{rgb}{0.752,0.752,0.752}
\definecolor{SkyBlue}{rgb}{0.530,0.808,0.920}
\definecolor{SlateBlue}{rgb}{0.415,0.352,0.804}
\definecolor{SlateGray}{rgb}{0.440,0.500,0.565}
\definecolor{SlateGrey}{rgb}{0.440,0.500,0.565}
\definecolor{Smoke}{rgb}{0.950,0.950,0.950}
\definecolor{Snow}{rgb}{1.000,0.980,0.980}
\definecolor{SoftYellow}{rgb}{1.000,1.000,0.400}
\definecolor{SpringGreen}{rgb}{0.000,1.000,0.498}
\definecolor{SteelBlue}{rgb}{0.275,0.510,0.705}
\definecolor{Tan}{rgb}{0.824,0.705,0.550}
\definecolor{Teal}{rgb}{0.000,0.500,0.500}
\definecolor{Thistle}{rgb}{0.848,0.750,0.848}
\definecolor{Tomato}{rgb}{1.000,0.390,0.280}
\definecolor{Turquoise}{rgb}{0.250,0.880,0.815}
\definecolor{Violet}{rgb}{0.932,0.510,0.932}
\definecolor{WarmGray}{rgb}{0.678,0.660,0.562}
\definecolor{Wheat}{rgb}{0.960,0.870,0.700}
\definecolor{White}{rgb}{1.000,1.000,1.000}
\definecolor{WhiteSmoke}{rgb}{0.970,0.970,0.970}
\definecolor{Yellow}{rgb}{1.000,1.000,0.000}
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'])
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
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
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
-
#append_arc_to_path ⇒ Object
-
#append_circle_to_path ⇒ Object
-
#append_curve_to_path ⇒ Object
-
#append_frame_to_path ⇒ Object
-
#append_interpolant_to_path(interp) ⇒ Object
-
#append_oval_to_path ⇒ Object
-
#append_point_to_path ⇒ Object
-
#append_points_to_path ⇒ Object
-
#append_points_with_gaps_to_path(xs, ys, gaps, close_subpaths = false) ⇒ Object
-
#append_rect_to_path ⇒ Object
-
#append_rounded_rect_to_path ⇒ Object
-
#argument_value(spec, dict, key) ⇒ Object
Returns the value associated with the given key.
-
#axial_shading(dict) ⇒ Object
-
#axis_information ⇒ Object
-
#bbox_bottom ⇒ Object
-
#bbox_left ⇒ Object
-
#bbox_right ⇒ Object
-
#bbox_top ⇒ Object
-
#bezier_control_points ⇒ Object
-
#bottom_edge_visible=(bool) ⇒ Object
-
#check_label_clip ⇒ Object
-
#clip ⇒ Object
-
#clip_circle ⇒ Object
-
#clip_oval ⇒ Object
-
#clip_rect ⇒ Object
-
#clip_to_frame ⇒ Object
-
#close_and_stroke ⇒ Object
-
#close_eofill_and_stroke ⇒ Object
-
#close_fill_and_stroke ⇒ Object
-
#close_path ⇒ Object
-
#column_margins(dict) ⇒ Object
-
#context(&cmd) ⇒ Object
-
#convert_figure_to_frame_dx ⇒ Object
-
#convert_figure_to_frame_dy ⇒ Object
-
#convert_figure_to_frame_x ⇒ Object
-
#convert_figure_to_frame_y ⇒ Object
-
#convert_figure_to_output_dx ⇒ Object
-
#convert_figure_to_output_dy ⇒ Object
-
#convert_figure_to_output_x ⇒ Object
-
#convert_figure_to_output_y ⇒ Object
-
#convert_frame_to_figure_dx ⇒ Object
-
#convert_frame_to_figure_dy ⇒ Object
-
#convert_frame_to_figure_x ⇒ Object
-
#convert_frame_to_figure_y ⇒ Object
-
#convert_frame_to_page_dx ⇒ Object
-
#convert_frame_to_page_dy ⇒ Object
-
#convert_frame_to_page_x ⇒ Object
-
#convert_frame_to_page_y ⇒ Object
-
#convert_inches_to_output ⇒ Object
coordinate system conversions.
-
#convert_mm_to_output ⇒ Object
-
#convert_output_to_figure_dx ⇒ Object
-
#convert_output_to_figure_dy ⇒ Object
-
#convert_output_to_figure_x ⇒ Object
-
#convert_output_to_figure_y ⇒ Object
-
#convert_output_to_inches ⇒ Object
-
#convert_output_to_mm ⇒ Object
-
#convert_output_to_page_dx ⇒ Object
-
#convert_output_to_page_dy ⇒ Object
-
#convert_output_to_page_x ⇒ Object
-
#convert_output_to_page_y ⇒ Object
-
#convert_page_to_frame_dx ⇒ Object
-
#convert_page_to_frame_dy ⇒ Object
-
#convert_page_to_frame_x ⇒ Object
-
#convert_page_to_frame_y ⇒ Object
-
#convert_page_to_output_dx ⇒ Object
-
#convert_page_to_output_dy ⇒ Object
-
#convert_page_to_output_x ⇒ Object
-
#convert_page_to_output_y ⇒ Object
-
#convert_to_colormap ⇒ Object
-
#convert_to_degrees ⇒ Object
-
#create_colormap(dict) ⇒ Object
-
#create_figure_temp_files(name) ⇒ Object
returns true if successful, false if failed.
-
#create_gradient_colormap(dict) ⇒ Object
-
#create_image_data(data, dict) ⇒ Object
-
#create_monochrome_image_data(data, dict) ⇒ Object
-
#def_enter_context_function(&cmd) ⇒ Object
-
#def_enter_page_function(&cmd) ⇒ Object
-
#def_enter_show_plot_function(&cmd) ⇒ Object
-
#def_enter_subfigure_function(&cmd) ⇒ Object
-
#def_enter_subplot_function(&cmd) ⇒ Object
-
#def_eval_function(&cmd) ⇒ Object
-
#def_exit_context_function(&cmd) ⇒ Object
-
#def_exit_page_function(&cmd) ⇒ Object
-
#def_exit_show_plot_function(&cmd) ⇒ Object
-
#def_exit_subfigure_function(&cmd) ⇒ Object
-
#def_exit_subplot_function(&cmd) ⇒ Object
-
#def_figure(name, &cmd) ⇒ Object
-
#default_enter_page_function ⇒ Object
-
#default_line_scale=(s) ⇒ Object
-
#discard_path ⇒ Object
-
#do_box_labels(title, xlabel, ylabel) ⇒ Object
-
#doing_subfigure ⇒ Object
-
#doing_subplot ⇒ Object
-
#eoclip ⇒ Object
-
#eofill ⇒ Object
-
#eofill_and_stroke ⇒ Object
-
#eval_function(string) ⇒ Object
-
#figure_index(name) ⇒ Object
-
#figure_name(num) ⇒ Object
-
#figure_pdf(name) ⇒ Object
-
#fill ⇒ Object
-
#fill_and_stroke ⇒ Object
-
#fill_and_stroke_circle ⇒ Object
-
#fill_and_stroke_frame ⇒ Object
-
#fill_and_stroke_oval ⇒ Object
-
#fill_and_stroke_rect ⇒ Object
-
#fill_and_stroke_rounded_rect ⇒ Object
-
#fill_circle ⇒ Object
-
#fill_frame ⇒ Object
-
#fill_oval ⇒ Object
-
#fill_rect ⇒ Object
-
#fill_rounded_rect ⇒ Object
-
#fill_transparency ⇒ Object
-
#fill_transparency=(frac) ⇒ Object
-
#get_color_from_colormap ⇒ Object
-
#get_save_filename ⇒ Object
-
#get_text_size(name, default = 1.0) ⇒ Object
Returns informations about the size of the named element.
-
#hls_to_rgb ⇒ Object
-
#in_subfigure ⇒ Object
-
#initialize ⇒ FigureMaker
constructor
A new instance of FigureMaker.
-
#intense_colormap ⇒ Object
-
#jpg_info ⇒ Object
-
#landscape ⇒ Object
-
#left_edge_visible=(bool) ⇒ Object
-
#legend_height ⇒ Object
-
#legend_text_width ⇒ Object
Returns the exact length of the text width in output coordinates.
-
#line_color ⇒ Object
-
#line_color=(color) ⇒ Object
-
#line_type_set ⇒ Object
graphics attribute accessors.
-
#load_png(file) ⇒ Object
-
#make_all(fignums = nil, report = false) ⇒ Object
-
#make_contour(dict) ⇒ Object
-
#make_figure(num) ⇒ Object
-
#make_interpolant(dict) ⇒ Object
-
#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.
-
#make_portfolio(name, fignums = nil, report = false) ⇒ Object
-
#make_portfolio_pdf(name, fignums = nil, report = false) ⇒ Object
-
#make_preview_pdf(num) ⇒ Object
-
#make_spline_interpolated_points(dict) ⇒ Object
-
#make_steps(dict) ⇒ Object
-
#marker_string_info ⇒ Object
-
#mellow_colormap ⇒ Object
-
#move_to_point ⇒ Object
-
#no_bottom_edge ⇒ Object
-
#no_left_edge ⇒ Object
-
#no_right_edge ⇒ Object
-
#no_title ⇒ Object
-
#no_top_edge ⇒ Object
-
#no_xaxis ⇒ Object
-
#no_xlabel ⇒ Object
-
#no_yaxis ⇒ Object
-
#no_ylabel ⇒ Object
-
#opacity_for_fill ⇒ Object
-
#opacity_for_fill=(frac) ⇒ Object
-
#opacity_for_stroke ⇒ Object
-
#opacity_for_stroke=(frac) ⇒ Object
-
#page_setup(width, height) ⇒ Object
in big-points (1/72 inch).
-
#pdf_grestore ⇒ Object
-
#pdf_gsave ⇒ Object
-
#portrait ⇒ Object
-
#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.
-
#private_append_points_with_gaps_to_path ⇒ Object
-
#private_axial_shading ⇒ Object
-
#private_create_colormap ⇒ Object
-
#private_create_image_data ⇒ Object
-
#private_create_monochrome_image_data ⇒ Object
-
#private_init_fm_data ⇒ Object
-
#private_make ⇒ Object
-
#private_make_portfolio ⇒ Object
-
#private_make_spline_interpolated_points ⇒ Object
-
#private_make_steps ⇒ Object
-
#private_radial_shading ⇒ Object
-
#private_register_cmyk_image ⇒ Object
-
#private_register_grayscale_image ⇒ Object
-
#private_register_hls_image ⇒ Object
-
#private_register_image ⇒ Object
-
#private_register_jpg ⇒ Object
-
#private_register_monochrome_image ⇒ Object
-
#private_register_rgb_image ⇒ Object
-
#private_save_measure ⇒ Object
-
#private_set_bounds ⇒ Object
-
#private_set_default_font_size ⇒ Object
-
#private_set_subframe ⇒ Object
-
#private_show_image_from_ref ⇒ Object
-
#private_show_marker ⇒ Object
-
#radial_shading(dict) ⇒ Object
-
#rainbow_colormap ⇒ Object
-
#register_font ⇒ Object
-
#register_image(dict) ⇒ Object
-
#require_all(fignums = nil, report = false, always_make = false) ⇒ Object
-
#require_pdf(num) ⇒ Object
-
#rescale(factor) ⇒ Object
-
#rescale_lines ⇒ Object
-
#rescale_text ⇒ Object
-
#reset_enter_context_function ⇒ Object
-
#reset_enter_page_function ⇒ Object
-
#reset_enter_show_plot_function ⇒ Object
-
#reset_enter_subfigure_function ⇒ Object
-
#reset_enter_subplot_function ⇒ Object
-
#reset_eval_function ⇒ Object
-
#reset_exit_context_function ⇒ Object
-
#reset_exit_page_function ⇒ Object
-
#reset_exit_show_plot_function ⇒ Object
-
#reset_exit_subfigure_function ⇒ Object
-
#reset_exit_subplot_function ⇒ Object
-
#reset_figures ⇒ 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.
-
#reset_legend_info ⇒ Object
-
#reset_plot_attrs ⇒ Object
-
#reset_state ⇒ Object
-
#rgb_to_hls ⇒ Object
-
#right_edge_visible=(bool) ⇒ Object
-
#root_plot ⇒ Object
-
#rounded_rect_oval ⇒ Object
-
#row_margins(dict) ⇒ Object
-
#save_legend_info(arg) ⇒ Object
-
#save_legend_separator(dy) ⇒ Object
-
#set_aspect_ratio(width_to_height) ⇒ Object
-
#set_aspect_ratio_relative_to_frame(width_to_height) ⇒ Object
-
#set_bounds(dict = nil) ⇒ Object
-
#set_default_font_size(size, update_preview_size_string = true) ⇒ Object
-
#set_device_pagesize ⇒ Object
-
#set_frame_sides ⇒ Object
-
#set_landscape ⇒ Object
-
#set_physical_aspect_ratio(width_to_height) ⇒ Object
-
#set_portrait ⇒ Object
-
#set_subframe(dict = nil) ⇒ Object
-
#show_arrow(dict) ⇒ Object
TODO: add linestyle capacities to arrows.
-
#show_axis ⇒ Object
-
#show_bottom_edge ⇒ Object
-
#show_contour(xs, ys, gaps = nil, color = nil, type = nil, legend = nil) ⇒ Object
-
#show_edge ⇒ Object
-
#show_edges ⇒ Object
-
#show_error_bars(dict) ⇒ Object
-
#show_grid(dict = {}) ⇒ Object
Draws the gridlines associated with the X and Y axis.
-
#show_image(dict) ⇒ Object
-
#show_label(dict) ⇒ Object
-
#show_left_edge ⇒ Object
-
#show_legend(legend_background_function = nil) ⇒ Object
-
#show_marker(dict) ⇒ Object
-
#show_plot(bounds = nil, &cmd) ⇒ Object
-
#show_plot_box ⇒ Object
-
#show_plot_with_legend(dict = nil, &cmd) ⇒ Object
-
#show_plot_without_clipping(bounds = nil, &cmd) ⇒ Object
-
#show_polyline(xs, ys, color = nil, legend = nil, type = nil, gaps = nil, close_subpaths = nil) ⇒ Object
-
#show_right_edge ⇒ Object
-
#show_rotated_label ⇒ Object
-
#show_rotated_text ⇒ Object
-
#show_text(dict) ⇒ Object
-
#show_title(text = nil) ⇒ Object
-
#show_top_edge ⇒ Object
-
#show_xaxis ⇒ Object
-
#show_xlabel(text = nil) ⇒ Object
-
#show_yaxis ⇒ Object
-
#show_ylabel(text = nil) ⇒ Object
-
#string_hls_to_rgb(str) ⇒ Object
-
#string_hls_to_rgb! ⇒ Object
-
#string_rgb_to_hls(str) ⇒ Object
-
#string_rgb_to_hls! ⇒ Object
-
#stroke ⇒ Object
-
#stroke_circle ⇒ Object
-
#stroke_frame ⇒ Object
-
#stroke_line ⇒ Object
-
#stroke_oval ⇒ Object
-
#stroke_polyline(xs, ys, color = nil, legend = nil, type = nil, gaps = nil, close_subpaths = nil) ⇒ Object
-
#stroke_rect ⇒ Object
-
#stroke_rounded_rect ⇒ Object
-
#stroke_transparency ⇒ Object
-
#stroke_transparency=(frac) ⇒ Object
-
#stroke_width ⇒ Object
-
#stroke_width=(width) ⇒ Object
-
#subfigure(margins = nil, &cmd) ⇒ Object
-
#subplot(margins = nil, &cmd) ⇒ Object
-
#tex_preview_preamble ⇒ Object
for backward compatibility.
-
#tex_preview_preamble=(str) ⇒ Object
-
#tex_xaxis_numeric_label ⇒ Object
-
#tex_xaxis_numeric_label=(str) ⇒ Object
-
#tex_yaxis_numeric_label ⇒ Object
-
#tex_yaxis_numeric_label=(str) ⇒ Object
-
#title_visible=(bool) ⇒ Object
-
#top_edge_visible=(bool) ⇒ Object
-
#trace_cmd_no_arg(entry_function, exit_function, &cmd) ⇒ Object
-
#trace_cmd_one_arg(entry_function, exit_function, arg, &cmd) ⇒ Object
-
#transparency_for_fill ⇒ Object
-
#transparency_for_fill=(frac) ⇒ Object
-
#transparency_for_stroke ⇒ Object
-
#transparency_for_stroke=(frac) ⇒ Object
-
#update_bbox ⇒ Object
-
#xaxis_visible=(bool) ⇒ Object
-
#xlabel_visible=(bool) ⇒ Object
-
#yaxis_visible=(bool) ⇒ Object
-
#ylabel_visible=(bool) ⇒ Object
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
Returns a new instance of FigureMaker.
352
353
354
355
|
# File 'lib/Tioga/FigMkr.rb', line 352
def initialize
@fm_data = Dvector.new(@@fm_data_size)
reset_figures
end
|
Instance Attribute Details
#add_model_number ⇒ Object
Returns the value of attribute add_model_number.
187
188
189
|
# File 'lib/Tioga/FigMkr.rb', line 187
def add_model_number
@add_model_number
end
|
#auto_refresh_filename ⇒ Object
Returns the value of attribute auto_refresh_filename.
189
190
191
|
# File 'lib/Tioga/FigMkr.rb', line 189
def auto_refresh_filename
@auto_refresh_filename
end
|
#autocleanup ⇒ Object
Whether or not do do automatic cleanup of the files
162
163
164
|
# File 'lib/Tioga/FigMkr.rb', line 162
def autocleanup
@autocleanup
end
|
#create_save_dir ⇒ Object
Whether or not to create save_dir if it doesn’t exist
159
160
161
|
# File 'lib/Tioga/FigMkr.rb', line 159
def create_save_dir
@create_save_dir
end
|
#current_pdflatex_call ⇒ Object
Returns the value of attribute current_pdflatex_call.
174
175
176
|
# File 'lib/Tioga/FigMkr.rb', line 174
def current_pdflatex_call
@current_pdflatex_call
end
|
#default_frame_bottom ⇒ Object
Returns the value of attribute default_frame_bottom.
154
155
156
|
# File 'lib/Tioga/FigMkr.rb', line 154
def default_frame_bottom
@default_frame_bottom
end
|
#default_frame_left ⇒ Object
Returns the value of attribute default_frame_left.
151
152
153
|
# File 'lib/Tioga/FigMkr.rb', line 151
def default_frame_left
@default_frame_left
end
|
#default_frame_right ⇒ Object
Returns the value of attribute default_frame_right.
152
153
154
|
# File 'lib/Tioga/FigMkr.rb', line 152
def default_frame_right
@default_frame_right
end
|
#default_frame_top ⇒ Object
Returns the value of attribute default_frame_top.
153
154
155
|
# File 'lib/Tioga/FigMkr.rb', line 153
def default_frame_top
@default_frame_top
end
|
#default_page_height ⇒ Object
Returns the value of attribute default_page_height.
150
151
152
|
# File 'lib/Tioga/FigMkr.rb', line 150
def default_page_height
@default_page_height
end
|
#default_page_width ⇒ Object
Returns the value of attribute default_page_width.
149
150
151
|
# File 'lib/Tioga/FigMkr.rb', line 149
def default_page_width
@default_page_width
end
|
Returns the value of attribute figure_names.
125
126
127
|
# File 'lib/Tioga/FigMkr.rb', line 125
def figure_names
@figure_names
end
|
Returns the value of attribute figure_pdfs.
127
128
129
|
# File 'lib/Tioga/FigMkr.rb', line 127
def figure_pdfs
@figure_pdfs
end
|
#legend_defaults ⇒ Object
Returns the value of attribute legend_defaults.
135
136
137
|
# File 'lib/Tioga/FigMkr.rb', line 135
def legend_defaults
@legend_defaults
end
|
#legend_info ⇒ Object
Returns the value of attribute legend_info.
119
120
121
|
# File 'lib/Tioga/FigMkr.rb', line 119
def legend_info
@legend_info
end
|
#line_type ⇒ Object
Returns the value of attribute line_type.
121
122
123
|
# File 'lib/Tioga/FigMkr.rb', line 121
def line_type
@line_type
end
|
#marker_defaults ⇒ Object
Returns the value of attribute marker_defaults.
137
138
139
|
# File 'lib/Tioga/FigMkr.rb', line 137
def marker_defaults
@marker_defaults
end
|
#max_nested_pdflatex_calls ⇒ Object
Maximum number of pdflatex calls. If nil, then unlimited, but that could be a very bad idea.
173
174
175
|
# File 'lib/Tioga/FigMkr.rb', line 173
def max_nested_pdflatex_calls
@max_nested_pdflatex_calls
end
|
#measure_legends ⇒ Object
If we want to use #legend_bounding_box. It is off by default as it causes a systematic second run of pdflatex.
179
180
181
|
# File 'lib/Tioga/FigMkr.rb', line 179
def measure_legends
@measure_legends
end
|
#measures_info ⇒ Object
An accessor for @measures_info:
168
169
170
|
# File 'lib/Tioga/FigMkr.rb', line 168
def measures_info
@measures_info
end
|
#model_number ⇒ Object
old preview attributes – to be removed later
186
187
188
|
# File 'lib/Tioga/FigMkr.rb', line 186
def model_number
@model_number
end
|
#multithreads_okay_for_tioga ⇒ Object
Whether or not do do multithreading for parallel pdflatex calls
165
166
167
|
# File 'lib/Tioga/FigMkr.rb', line 165
def multithreads_okay_for_tioga
@multithreads_okay_for_tioga
end
|
#need_to_reload_data ⇒ Object
Returns the value of attribute need_to_reload_data.
188
189
190
|
# File 'lib/Tioga/FigMkr.rb', line 188
def need_to_reload_data
@need_to_reload_data
end
|
#num_error_lines ⇒ Object
Returns the value of attribute num_error_lines.
156
157
158
|
# File 'lib/Tioga/FigMkr.rb', line 156
def num_error_lines
@num_error_lines
end
|
Returns the value of attribute num_figures.
123
124
125
|
# File 'lib/Tioga/FigMkr.rb', line 123
def num_figures
@num_figures
end
|
#pdflatex_errors ⇒ Object
Stores the errors recorded in the last run of pdflatex.
182
183
184
|
# File 'lib/Tioga/FigMkr.rb', line 182
def pdflatex_errors
@pdflatex_errors
end
|
#quiet_mode ⇒ Object
Returns the value of attribute quiet_mode.
133
134
135
|
# File 'lib/Tioga/FigMkr.rb', line 133
def quiet_mode
@quiet_mode
end
|
#run_dir ⇒ Object
Returns the value of attribute run_dir.
129
130
131
|
# File 'lib/Tioga/FigMkr.rb', line 129
def run_dir
@run_dir
end
|
#save_dir ⇒ Object
Returns the value of attribute save_dir.
131
132
133
|
# File 'lib/Tioga/FigMkr.rb', line 131
def save_dir
@save_dir
end
|
#style_filename ⇒ Object
Returns the value of attribute style_filename.
117
118
119
|
# File 'lib/Tioga/FigMkr.rb', line 117
def style_filename
@style_filename
end
|
#tex_fontfamily ⇒ Object
Returns the value of attribute tex_fontfamily.
145
146
147
|
# File 'lib/Tioga/FigMkr.rb', line 145
def tex_fontfamily
@tex_fontfamily
end
|
#tex_fontseries ⇒ Object
Returns the value of attribute tex_fontseries.
146
147
148
|
# File 'lib/Tioga/FigMkr.rb', line 146
def tex_fontseries
@tex_fontseries
end
|
#tex_fontshape ⇒ Object
Returns the value of attribute tex_fontshape.
147
148
149
|
# File 'lib/Tioga/FigMkr.rb', line 147
def tex_fontshape
@tex_fontshape
end
|
#tex_fontsize ⇒ Object
Returns the value of attribute tex_fontsize.
144
145
146
|
# File 'lib/Tioga/FigMkr.rb', line 144
def tex_fontsize
@tex_fontsize
end
|
#tex_preamble ⇒ Object
Returns the value of attribute tex_preamble.
139
140
141
|
# File 'lib/Tioga/FigMkr.rb', line 139
def tex_preamble
@tex_preamble
end
|
#tex_xoffset ⇒ Object
attr_accessor :tex_preview_documentclass
attr_accessor :tex_preview_pagestyle attr_accessor :tex_preview_tiogafigure_command
194
195
196
|
# File 'lib/Tioga/FigMkr.rb', line 194
def tex_xoffset
@tex_xoffset
end
|
#tex_yoffset ⇒ Object
Returns the value of attribute tex_yoffset.
195
196
197
|
# File 'lib/Tioga/FigMkr.rb', line 195
def tex_yoffset
@tex_yoffset
end
|
#title ⇒ Object
Returns the value of attribute title.
105
106
107
|
# File 'lib/Tioga/FigMkr.rb', line 105
def title
@title
end
|
#xaxis_locations_for_major_ticks ⇒ Object
Returns the value of attribute xaxis_locations_for_major_ticks.
109
110
111
|
# File 'lib/Tioga/FigMkr.rb', line 109
def xaxis_locations_for_major_ticks
@xaxis_locations_for_major_ticks
end
|
#xaxis_locations_for_minor_ticks ⇒ Object
Returns the value of attribute xaxis_locations_for_minor_ticks.
110
111
112
|
# File 'lib/Tioga/FigMkr.rb', line 110
def xaxis_locations_for_minor_ticks
@xaxis_locations_for_minor_ticks
end
|
#xaxis_numeric_label_tex ⇒ Object
Returns the value of attribute xaxis_numeric_label_tex.
141
142
143
|
# File 'lib/Tioga/FigMkr.rb', line 141
def xaxis_numeric_label_tex
@xaxis_numeric_label_tex
end
|
#xaxis_tick_labels ⇒ Object
Returns the value of attribute xaxis_tick_labels.
111
112
113
|
# File 'lib/Tioga/FigMkr.rb', line 111
def xaxis_tick_labels
@xaxis_tick_labels
end
|
#xlabel ⇒ Object
Returns the value of attribute xlabel.
106
107
108
|
# File 'lib/Tioga/FigMkr.rb', line 106
def xlabel
@xlabel
end
|
#yaxis_locations_for_major_ticks ⇒ Object
Returns the value of attribute yaxis_locations_for_major_ticks.
113
114
115
|
# File 'lib/Tioga/FigMkr.rb', line 113
def yaxis_locations_for_major_ticks
@yaxis_locations_for_major_ticks
end
|
#yaxis_locations_for_minor_ticks ⇒ Object
Returns the value of attribute yaxis_locations_for_minor_ticks.
114
115
116
|
# File 'lib/Tioga/FigMkr.rb', line 114
def yaxis_locations_for_minor_ticks
@yaxis_locations_for_minor_ticks
end
|
#yaxis_numeric_label_tex ⇒ Object
Returns the value of attribute yaxis_numeric_label_tex.
142
143
144
|
# File 'lib/Tioga/FigMkr.rb', line 142
def yaxis_numeric_label_tex
@yaxis_numeric_label_tex
end
|
#yaxis_tick_labels ⇒ Object
Returns the value of attribute yaxis_tick_labels.
115
116
117
|
# File 'lib/Tioga/FigMkr.rb', line 115
def yaxis_tick_labels
@yaxis_tick_labels
end
|
#ylabel ⇒ Object
Returns the value of attribute ylabel.
107
108
109
|
# File 'lib/Tioga/FigMkr.rb', line 107
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
|
.default ⇒ Object
: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_rgb ⇒ Object
We define them as class methods too, as they do not depend on a
FigureMaker instance
.make_contour(dict) ⇒ Object
1329
1330
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
|
# File 'lib/Tioga/FigMkr.rb', line 1329
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
82
83
84
85
86
|
# File 'lib/Tioga/FigMkr.rb', line 82
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
|
.pdflatex ⇒ Object
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/Tioga/FigMkr.rb', line 67
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
78
79
80
|
# File 'lib/Tioga/FigMkr.rb', line 78
def FigureMaker.pdflatex=(s)
@@which_pdflatex = s
end
|
.private_make_contour ⇒ Object
.rgb_to_hls ⇒ Object
.string_hls_to_rgb! ⇒ Object
.string_rgb_to_hls! ⇒ Object
.version ⇒ Object
: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_path ⇒ Object
#append_circle_to_path ⇒ Object
#append_curve_to_path ⇒ Object
#append_frame_to_path ⇒ Object
#append_interpolant_to_path(interp) ⇒ Object
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
|
# File 'lib/Tioga/FigMkr.rb', line 1429
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_path ⇒ Object
#append_point_to_path ⇒ Object
#append_points_to_path ⇒ Object
#append_points_with_gaps_to_path(xs, ys, gaps, close_subpaths = false) ⇒ Object
1300
1301
1302
|
# File 'lib/Tioga/FigMkr.rb', line 1300
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_path ⇒ Object
#append_rounded_rect_to_path ⇒ Object
#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
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
|
# File 'lib/Tioga/FigMkr.rb', line 629
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 =~ /^->(.*)/ 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
1602
1603
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
|
# File 'lib/Tioga/FigMkr.rb', line 1602
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
|
#bbox_bottom ⇒ Object
#bbox_left ⇒ Object
#bbox_right ⇒ Object
#bbox_top ⇒ Object
#bezier_control_points ⇒ Object
#bottom_edge_visible=(bool) ⇒ Object
589
590
591
592
593
594
|
# File 'lib/Tioga/FigMkr.rb', line 589
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_clip ⇒ Object
#clip ⇒ Object
#clip_circle ⇒ Object
#clip_oval ⇒ Object
#clip_rect ⇒ Object
#clip_to_frame ⇒ Object
#close_and_stroke ⇒ Object
#close_eofill_and_stroke ⇒ Object
#close_fill_and_stroke ⇒ Object
#close_path ⇒ Object
#column_margins(dict) ⇒ Object
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
|
# File 'lib/Tioga/FigMkr.rb', line 1011
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 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
1065
1066
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
|
# File 'lib/Tioga/FigMkr.rb', line 1065
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_frame_to_page_dx ⇒ Object
#convert_frame_to_page_dy ⇒ Object
#convert_frame_to_page_x ⇒ Object
#convert_frame_to_page_y ⇒ Object
#convert_inches_to_output ⇒ Object
coordinate system conversions
#convert_mm_to_output ⇒ Object
#convert_output_to_inches ⇒ Object
#convert_output_to_mm ⇒ Object
#convert_output_to_page_dx ⇒ Object
#convert_output_to_page_dy ⇒ Object
#convert_output_to_page_x ⇒ Object
#convert_output_to_page_y ⇒ Object
#convert_page_to_frame_dx ⇒ Object
#convert_page_to_frame_dy ⇒ Object
#convert_page_to_frame_x ⇒ Object
#convert_page_to_frame_y ⇒ Object
#convert_page_to_output_dx ⇒ Object
#convert_page_to_output_dy ⇒ Object
#convert_page_to_output_x ⇒ Object
#convert_page_to_output_y ⇒ Object
#convert_to_colormap ⇒ Object
#convert_to_degrees ⇒ Object
#create_colormap(dict) ⇒ Object
1758
1759
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
|
# File 'lib/Tioga/FigMkr.rb', line 1758
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
|
returns true if successful, false if failed.
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
|
# File 'lib/Tioga/FigMkr.rb', line 2317
def create_figure_temp_files(name) 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
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
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
|
# File 'lib/Tioga/FigMkr.rb', line 1826
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
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
|
# File 'lib/Tioga/FigMkr.rb', line 1848
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
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
|
# File 'lib/Tioga/FigMkr.rb', line 1877
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
2170
2171
2172
2173
2174
2175
|
# File 'lib/Tioga/FigMkr.rb', line 2170
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
2076
2077
2078
2079
2080
2081
|
# File 'lib/Tioga/FigMkr.rb', line 2076
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
2100
2101
2102
2103
2104
2105
|
# File 'lib/Tioga/FigMkr.rb', line 2100
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
|
2124
2125
2126
2127
2128
2129
|
# File 'lib/Tioga/FigMkr.rb', line 2124
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
2147
2148
2149
2150
2151
2152
|
# File 'lib/Tioga/FigMkr.rb', line 2147
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
2068
2069
2070
2071
2072
2073
|
# File 'lib/Tioga/FigMkr.rb', line 2068
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
2181
2182
2183
2184
2185
2186
|
# File 'lib/Tioga/FigMkr.rb', line 2181
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
2087
2088
2089
2090
2091
2092
|
# File 'lib/Tioga/FigMkr.rb', line 2087
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
2111
2112
2113
2114
2115
2116
|
# File 'lib/Tioga/FigMkr.rb', line 2111
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
|
2135
2136
2137
2138
2139
2140
|
# File 'lib/Tioga/FigMkr.rb', line 2135
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
2158
2159
2160
2161
2162
2163
|
# File 'lib/Tioga/FigMkr.rb', line 2158
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
|
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
|
# File 'lib/Tioga/FigMkr.rb', line 2211
def def_figure(name, &cmd)
name = name.split(' ').join('_') 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_function ⇒ Object
405
406
407
408
409
|
# File 'lib/Tioga/FigMkr.rb', line 405
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
401
402
403
|
# File 'lib/Tioga/FigMkr.rb', line 401
def default_line_scale=(s)
self.rescale_lines(s)
end
|
#discard_path ⇒ Object
#do_box_labels(title, xlabel, ylabel) ⇒ Object
811
812
813
814
815
816
817
818
819
820
821
|
# File 'lib/Tioga/FigMkr.rb', line 811
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_subplot ⇒ Object
#eoclip ⇒ Object
#eofill ⇒ Object
#eofill_and_stroke ⇒ Object
#eval_function(string) ⇒ Object
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
|
# File 'lib/Tioga/FigMkr.rb', line 2193
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
|
2225
2226
2227
|
# File 'lib/Tioga/FigMkr.rb', line 2225
def figure_index(name)
return @figure_names.index(name)
end
|
447
448
449
|
# File 'lib/Tioga/FigMkr.rb', line 447
def figure_name(num)
@figure_names[num]
end
|
451
452
453
454
455
456
457
458
459
|
# File 'lib/Tioga/FigMkr.rb', line 451
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
|
#fill ⇒ Object
#fill_and_stroke ⇒ Object
#fill_and_stroke_circle ⇒ Object
#fill_and_stroke_frame ⇒ Object
#fill_and_stroke_oval ⇒ Object
#fill_and_stroke_rect ⇒ Object
#fill_and_stroke_rounded_rect ⇒ Object
#fill_circle ⇒ Object
#fill_frame ⇒ Object
#fill_oval ⇒ Object
#fill_rect ⇒ Object
#fill_rounded_rect ⇒ Object
#fill_transparency ⇒ Object
516
517
518
|
# File 'lib/Tioga/FigMkr.rb', line 516
def fill_transparency
self.transparency_for_fill
end
|
#fill_transparency=(frac) ⇒ Object
520
521
522
|
# File 'lib/Tioga/FigMkr.rb', line 520
def fill_transparency=(frac)
self.transparency_for_fill = frac
end
|
#get_color_from_colormap ⇒ Object
#get_save_filename ⇒ Object
#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.
369
370
371
372
373
374
375
|
# File 'lib/Tioga/FigMkr.rb', line 369
def get_text_size(name, default = 1.0)
if self.measures_info.key? name
return self.measures_info[name]
else
return {} end
end
|
996
997
998
|
# File 'lib/Tioga/FigMkr.rb', line 996
def in_subfigure
return ! self.root_figure
end
|
#intense_colormap ⇒ Object
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
|
# File 'lib/Tioga/FigMkr.rb', line 1786
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_info ⇒ Object
#landscape ⇒ Object
847
848
849
|
# File 'lib/Tioga/FigMkr.rb', line 847
def landscape
set_landscape
end
|
#left_edge_visible=(bool) ⇒ Object
568
569
570
571
572
573
|
# File 'lib/Tioga/FigMkr.rb', line 568
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_height ⇒ Object
797
798
799
800
801
|
# File 'lib/Tioga/FigMkr.rb', line 797
def legend_height
height = 0.0
@legend_info.each { |dict| height += dict['dy'] }
return height
end
|
#legend_text_width ⇒ Object
Returns the exact length of the text width in output coordinates
785
786
787
788
789
790
791
792
793
794
795
|
# File 'lib/Tioga/FigMkr.rb', line 785
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 10 * width
end
|
#line_color ⇒ Object
461
462
463
|
# File 'lib/Tioga/FigMkr.rb', line 461
def line_color
self.stroke_color
end
|
#line_color=(color) ⇒ Object
465
466
467
|
# File 'lib/Tioga/FigMkr.rb', line 465
def line_color=(color)
self.stroke_color=(color)
end
|
#line_type_set ⇒ Object
graphics attribute accessors
#load_png(file) ⇒ Object
1678
1679
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
|
# File 'lib/Tioga/FigMkr.rb', line 1678
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
end
end
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
2296
2297
2298
|
# File 'lib/Tioga/FigMkr.rb', line 2296
def make_all(fignums=nil, report=false)
require_all(fignums, report, true)
end
|
#make_contour(dict) ⇒ Object
1325
1326
1327
|
# File 'lib/Tioga/FigMkr.rb', line 1325
def make_contour(dict)
return FigureMaker.make_contour(dict)
end
|
2229
2230
2231
|
# File 'lib/Tioga/FigMkr.rb', line 2229
def make_figure(num)
make_pdf(num)
end
|
#make_interpolant(dict) ⇒ Object
1419
1420
1421
1422
1423
1424
1425
1426
1427
|
# File 'lib/Tioga/FigMkr.rb', line 1419
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.
2241
2242
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
|
# File 'lib/Tioga/FigMkr.rb', line 2241
def make_pdf(num,&cmd) 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
@current_pdflatex_call ||= 0
begin
@figure_pdfs[num] = finish_making_pdf(@figure_names[num])
rescue Exception => e
p e, e.backtrace
end
if @measures.keys != old_measure_keys
@current_pdflatex_call += 1
if (!@max_nested_pdflatex_calls || (@current_pdflatex_call < @max_nested_pdflatex_calls))
make_pdf(num)
end
end
@current_pdflatex_call = nil
return @figure_pdfs[num]
end
|
#make_portfolio(name, fignums = nil, report = false) ⇒ Object
2306
2307
2308
2309
2310
|
# File 'lib/Tioga/FigMkr.rb', line 2306
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
2301
2302
2303
|
# File 'lib/Tioga/FigMkr.rb', line 2301
def make_portfolio_pdf(name, fignums=nil, report=false)
make_portfolio(name,fignums,report)
end
|
#make_preview_pdf(num) ⇒ Object
2234
2235
2236
|
# File 'lib/Tioga/FigMkr.rb', line 2234
def make_preview_pdf(num) make_pdf(num)
end
|
#make_spline_interpolated_points(dict) ⇒ Object
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
|
# File 'lib/Tioga/FigMkr.rb', line 1401
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
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
|
# File 'lib/Tioga/FigMkr.rb', line 1377
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_info ⇒ Object
#mellow_colormap ⇒ Object
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
|
# File 'lib/Tioga/FigMkr.rb', line 1798
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
|
#no_bottom_edge ⇒ Object
#no_left_edge ⇒ Object
#no_right_edge ⇒ Object
#no_title ⇒ Object
#no_top_edge ⇒ Object
#no_xaxis ⇒ Object
#no_xlabel ⇒ Object
#no_yaxis ⇒ Object
#no_ylabel ⇒ Object
#opacity_for_fill ⇒ Object
490
491
492
|
# File 'lib/Tioga/FigMkr.rb', line 490
def opacity_for_fill
self.fill_opacity
end
|
#opacity_for_fill=(frac) ⇒ Object
494
495
496
|
# File 'lib/Tioga/FigMkr.rb', line 494
def opacity_for_fill=(frac)
self.fill_opacity=(frac)
end
|
#opacity_for_stroke ⇒ Object
482
483
484
|
# File 'lib/Tioga/FigMkr.rb', line 482
def opacity_for_stroke
self.stroke_opacity
end
|
#opacity_for_stroke=(frac) ⇒ Object
486
487
488
|
# File 'lib/Tioga/FigMkr.rb', line 486
def opacity_for_stroke=(frac)
self.stroke_opacity=(frac)
end
|
#page_setup(width, height) ⇒ Object
in big-points (1/72 inch)
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
|
# File 'lib/Tioga/FigMkr.rb', line 417
def page_setup(width,height) set_device_pagesize(width*10-1, height*10-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_grestore ⇒ Object
#portrait ⇒ Object
855
856
857
|
# File 'lib/Tioga/FigMkr.rb', line 855
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 !
614
615
616
617
618
619
620
621
622
623
624
625
|
# File 'lib/Tioga/FigMkr.rb', line 614
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_path ⇒ Object
#private_axial_shading ⇒ Object
#private_create_colormap ⇒ Object
#private_create_image_data ⇒ Object
#private_create_monochrome_image_data ⇒ Object
#private_init_fm_data ⇒ Object
#private_make ⇒ Object
#private_make_portfolio ⇒ Object
#private_make_spline_interpolated_points ⇒ Object
#private_make_steps ⇒ Object
#private_radial_shading ⇒ Object
#private_register_cmyk_image ⇒ Object
#private_register_grayscale_image ⇒ Object
#private_register_hls_image ⇒ Object
#private_register_image ⇒ Object
#private_register_jpg ⇒ Object
#private_register_monochrome_image ⇒ Object
#private_register_rgb_image ⇒ Object
#private_save_measure ⇒ Object
#private_set_bounds ⇒ Object
#private_set_default_font_size ⇒ Object
#private_set_subframe ⇒ Object
#private_show_image_from_ref ⇒ Object
#private_show_marker ⇒ Object
#radial_shading(dict) ⇒ Object
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
|
# File 'lib/Tioga/FigMkr.rb', line 1634
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_colormap ⇒ Object
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
|
# File 'lib/Tioga/FigMkr.rb', line 1810
def rainbow_colormap
if @rainbow_colormap == nil
@rainbow_colormap = create_colormap(
'points' => [0.00, 0.27, 0.46, 0.73, 1.00], '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_image(dict) ⇒ Object
1674
1675
1676
|
# File 'lib/Tioga/FigMkr.rb', line 1674
def register_image(dict)
internal_show_image(dict, true)
end
|
#require_all(fignums = nil, report = false, always_make = false) ⇒ Object
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
|
# File 'lib/Tioga/FigMkr.rb', line 2277
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
2270
2271
2272
2273
2274
|
# File 'lib/Tioga/FigMkr.rb', line 2270
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
1099
1100
1101
1102
|
# File 'lib/Tioga/FigMkr.rb', line 1099
def rescale(factor)
rescale_text(factor)
rescale_lines(factor)
end
|
#rescale_text ⇒ Object
#reset_enter_context_function ⇒ Object
2177
2178
2179
|
# File 'lib/Tioga/FigMkr.rb', line 2177
def reset_enter_context_function
@enter_subplot_context = nil
end
|
#reset_enter_page_function ⇒ Object
2083
2084
2085
|
# File 'lib/Tioga/FigMkr.rb', line 2083
def reset_enter_page_function
@enter_page_function = nil
end
|
#reset_enter_show_plot_function ⇒ Object
2107
2108
2109
|
# File 'lib/Tioga/FigMkr.rb', line 2107
def reset_enter_show_plot_function
@enter_show_plot_function = nil
end
|
2131
2132
2133
|
# File 'lib/Tioga/FigMkr.rb', line 2131
def reset_enter_subfigure_function
@enter_subfigure_function = nil
end
|
#reset_enter_subplot_function ⇒ Object
2154
2155
2156
|
# File 'lib/Tioga/FigMkr.rb', line 2154
def reset_enter_subplot_function
@enter_subplot_function = nil
end
|
#reset_eval_function ⇒ Object
2064
2065
2066
|
# File 'lib/Tioga/FigMkr.rb', line 2064
def reset_eval_function
@eval_command = nil
end
|
#reset_exit_context_function ⇒ Object
2188
2189
2190
|
# File 'lib/Tioga/FigMkr.rb', line 2188
def reset_exit_context_function
@exit_subplot_context = nil
end
|
#reset_exit_page_function ⇒ Object
2094
2095
2096
|
# File 'lib/Tioga/FigMkr.rb', line 2094
def reset_exit_page_function
@exit_page_function = nil
end
|
#reset_exit_show_plot_function ⇒ Object
2118
2119
2120
|
# File 'lib/Tioga/FigMkr.rb', line 2118
def reset_exit_show_plot_function
@exit_show_plot_function = nil
end
|
2142
2143
2144
|
# File 'lib/Tioga/FigMkr.rb', line 2142
def reset_exit_subfigure_function
@exit_subfigure_function = nil
end
|
#reset_exit_subplot_function ⇒ Object
2165
2166
2167
|
# File 'lib/Tioga/FigMkr.rb', line 2165
def reset_exit_subplot_function
@exit_subplot_function = nil
end
|
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
206
207
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
|
# File 'lib/Tioga/FigMkr.rb', line 206
def reset_figures @figure_commands = []
@num_figures = 0
@create_save_dir = true
@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
'
@tex_preview_pagestyle = 'empty'
@default_page_width = 72*5 @default_page_height = 72*5
@default_frame_left = 0.15 @default_frame_right = 0.85 @default_frame_top = 0.85 @default_frame_bottom = 0.15
@xaxis_numeric_label_tex = '$#1$'
@yaxis_numeric_label_tex = '$#1$'
@tex_preview_fullpage = true
@tex_preview_minwhitespace = nil
@tex_preview_tiogafigure_command = 'tiogafigurescaledtofit'
@tex_preview_figure_width = '\paperwidth - 2in'
@tex_preview_figure_height = '\paperheight - 2in'
@num_error_lines = 10
reset_plot_attrs
@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 }
@autocleanup = true
@multithreads_okay_for_tioga = true
@measures = {}
@measures_info = {}
@measure_legends = false
@max_nested_pdflatex_calls = 3
self.vincent_or_bill = false
self.log_minor_ticks_limit = 10
end
|
#reset_legend_info ⇒ Object
803
804
805
|
# File 'lib/Tioga/FigMkr.rb', line 803
def reset_legend_info
@legend_info = [ ]
end
|
#reset_plot_attrs ⇒ Object
337
338
339
340
341
342
343
344
345
346
347
348
349
|
# File 'lib/Tioga/FigMkr.rb', line 337
def reset_plot_attrs
@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
end
|
#reset_state ⇒ Object
378
379
380
|
# File 'lib/Tioga/FigMkr.rb', line 378
def reset_state
reset_figures
end
|
#rgb_to_hls ⇒ Object
#right_edge_visible=(bool) ⇒ Object
575
576
577
578
579
580
|
# File 'lib/Tioga/FigMkr.rb', line 575
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_plot ⇒ Object
992
993
994
|
# File 'lib/Tioga/FigMkr.rb', line 992
def root_plot
return ! self.in_subplot
end
|
#rounded_rect_oval ⇒ Object
#row_margins(dict) ⇒ Object
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
|
# File 'lib/Tioga/FigMkr.rb', line 1039
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 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
667
668
669
670
671
672
673
674
675
676
677
678
679
680
|
# File 'lib/Tioga/FigMkr.rb', line 667
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
807
808
809
|
# File 'lib/Tioga/FigMkr.rb', line 807
def save_legend_separator(dy)
save_legend_info('dy' => dy, 'line_width' => -1)
end
|
#set_aspect_ratio(width_to_height) ⇒ Object
839
840
841
|
# File 'lib/Tioga/FigMkr.rb', line 839
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
823
824
825
826
827
828
829
830
831
|
# File 'lib/Tioga/FigMkr.rb', line 823
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
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
|
# File 'lib/Tioga/FigMkr.rb', line 893
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
411
412
413
414
415
|
# File 'lib/Tioga/FigMkr.rb', line 411
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_pagesize ⇒ Object
#set_frame_sides ⇒ Object
#set_landscape ⇒ Object
843
844
845
|
# File 'lib/Tioga/FigMkr.rb', line 843
def set_landscape
set_aspect_ratio(11.0/8.5)
end
|
#set_physical_aspect_ratio(width_to_height) ⇒ Object
833
834
835
836
837
|
# File 'lib/Tioga/FigMkr.rb', line 833
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_portrait ⇒ Object
851
852
853
|
# File 'lib/Tioga/FigMkr.rb', line 851
def set_portrait
set_aspect_ratio(8.5/11.0)
end
|
#set_subframe(dict = nil) ⇒ Object
862
863
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
|
# File 'lib/Tioga/FigMkr.rb', line 862
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.
1496
1497
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
|
# File 'lib/Tioga/FigMkr.rb', line 1496
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']
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 head_frac = tail_frac = 0.5 end
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_axis ⇒ Object
#show_bottom_edge ⇒ Object
1132
1133
1134
|
# File 'lib/Tioga/FigMkr.rb', line 1132
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
1318
1319
1320
|
# File 'lib/Tioga/FigMkr.rb', line 1318
def show_contour(xs, ys, gaps = nil, color = nil, type = nil, legend = nil)
show_polyline(xs, ys, color, legend, type, gaps, false)
end
|
#show_edge ⇒ Object
#show_edges ⇒ Object
1121
1122
1123
1124
1125
1126
|
# File 'lib/Tioga/FigMkr.rb', line 1121
def show_edges
show_top_edge
show_bottom_edge
show_left_edge
show_right_edge
end
|
#show_error_bars(dict) ⇒ Object
1442
1443
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
|
# File 'lib/Tioga/FigMkr.rb', line 1442
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) 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
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
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
1206
1207
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
|
# File 'lib/Tioga/FigMkr.rb', line 1206
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)
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']
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']
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
1669
1670
1671
|
# File 'lib/Tioga/FigMkr.rb', line 1669
def show_image(dict)
internal_show_image(dict, false)
end
|
#show_label(dict) ⇒ Object
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
|
# File 'lib/Tioga/FigMkr.rb', line 1972
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_edge ⇒ Object
1136
1137
1138
|
# File 'lib/Tioga/FigMkr.rb', line 1136
def show_left_edge
show_edge(LEFT) if self.left_edge_visible && self.yaxis_loc != LEFT
end
|
#show_legend(legend_background_function = nil) ⇒ Object
683
684
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
|
# File 'lib/Tioga/FigMkr.rb', line 683
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 @measure_legends
xright = x + convert_output_to_figure_dx(legend_text_width)
xright += line_x0 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
@legend_info[1..-1].each do |dict|
dy = dict['dy']; dy = 1 if dy == nil
ybot -= line_ht_y * dy
end
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
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
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
1899
1900
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
|
# File 'lib/Tioga/FigMkr.rb', line 1899
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
968
969
970
971
972
973
974
|
# File 'lib/Tioga/FigMkr.rb', line 968
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_box ⇒ Object
1104
1105
1106
1107
1108
1109
1110
1111
|
# File 'lib/Tioga/FigMkr.rb', line 1104
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
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
|
# File 'lib/Tioga/FigMkr.rb', line 1274
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) }
set_subframe(@legend_subframe)
rescale(legend_scale) @pr_margin = plot_right_margin
show_legend(legend_background_function)
@legend_subframe = nil
end
|
#show_plot_without_clipping(bounds = nil, &cmd) ⇒ Object
977
978
979
980
981
982
983
|
# File 'lib/Tioga/FigMkr.rb', line 977
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
1304
1305
1306
1307
1308
1309
1310
1311
1312
|
# File 'lib/Tioga/FigMkr.rb', line 1304
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_edge ⇒ Object
1140
1141
1142
|
# File 'lib/Tioga/FigMkr.rb', line 1140
def show_right_edge
show_edge(RIGHT) if self.right_edge_visible && self.yaxis_loc != RIGHT
end
|
#show_rotated_label ⇒ Object
#show_rotated_text ⇒ Object
#show_text(dict) ⇒ Object
1991
1992
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
|
# File 'lib/Tioga/FigMkr.rb', line 1991
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'] 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
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
|
# File 'lib/Tioga/FigMkr.rb', line 1144
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_edge ⇒ Object
1128
1129
1130
|
# File 'lib/Tioga/FigMkr.rb', line 1128
def show_top_edge
show_edge(TOP) if self.top_edge_visible && self.xaxis_loc != TOP
end
|
#show_xaxis ⇒ Object
1113
1114
1115
|
# File 'lib/Tioga/FigMkr.rb', line 1113
def show_xaxis
show_axis(self.xaxis_loc) if self.xaxis_visible
end
|
#show_xlabel(text = nil) ⇒ Object
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
|
# File 'lib/Tioga/FigMkr.rb', line 1156
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_yaxis ⇒ Object
1117
1118
1119
|
# File 'lib/Tioga/FigMkr.rb', line 1117
def show_yaxis
show_axis(self.yaxis_loc) if self.yaxis_visible
end
|
#show_ylabel(text = nil) ⇒ Object
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
|
# File 'lib/Tioga/FigMkr.rb', line 1172
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
1654
1655
1656
|
# File 'lib/Tioga/FigMkr.rb', line 1654
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
1659
1660
1661
|
# File 'lib/Tioga/FigMkr.rb', line 1659
def string_rgb_to_hls(str)
string_rgb_to_hls!(String.new(str))
end
|
#string_rgb_to_hls! ⇒ Object
#stroke ⇒ Object
#stroke_circle ⇒ Object
#stroke_frame ⇒ Object
#stroke_line ⇒ Object
#stroke_oval ⇒ Object
#stroke_polyline(xs, ys, color = nil, legend = nil, type = nil, gaps = nil, close_subpaths = nil) ⇒ Object
1314
1315
1316
|
# File 'lib/Tioga/FigMkr.rb', line 1314
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_rect ⇒ Object
#stroke_rounded_rect ⇒ Object
#stroke_transparency ⇒ Object
524
525
526
|
# File 'lib/Tioga/FigMkr.rb', line 524
def stroke_transparency
self.transparency_for_stroke
end
|
#stroke_transparency=(frac) ⇒ Object
528
529
530
|
# File 'lib/Tioga/FigMkr.rb', line 528
def stroke_transparency=(frac)
self.transparency_for_stroke = frac
end
|
#stroke_width ⇒ Object
473
474
475
|
# File 'lib/Tioga/FigMkr.rb', line 473
def stroke_width
self.line_width
end
|
#stroke_width=(width) ⇒ Object
477
478
479
|
# File 'lib/Tioga/FigMkr.rb', line 477
def stroke_width=(width)
self.line_width=(width)
end
|
986
987
988
989
990
|
# File 'lib/Tioga/FigMkr.rb', line 986
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
1000
1001
1002
1003
1004
1005
|
# File 'lib/Tioga/FigMkr.rb', line 1000
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_preamble ⇒ Object
for backward compatibility
439
440
441
|
# File 'lib/Tioga/FigMkr.rb', line 439
def tex_preview_preamble self.tex_preamble
end
|
#tex_preview_preamble=(str) ⇒ Object
443
444
445
|
# File 'lib/Tioga/FigMkr.rb', line 443
def tex_preview_preamble=(str)
self.tex_preamble = str
end
|
#tex_xaxis_numeric_label ⇒ Object
383
384
385
|
# File 'lib/Tioga/FigMkr.rb', line 383
def tex_xaxis_numeric_label
self.xaxis_numeric_label_tex
end
|
#tex_xaxis_numeric_label=(str) ⇒ Object
387
388
389
|
# File 'lib/Tioga/FigMkr.rb', line 387
def tex_xaxis_numeric_label=(str)
self.xaxis_numeric_label_tex = str
end
|
#tex_yaxis_numeric_label ⇒ Object
392
393
394
|
# File 'lib/Tioga/FigMkr.rb', line 392
def tex_yaxis_numeric_label
self.yaxis_numeric_label_tex
end
|
#tex_yaxis_numeric_label=(str) ⇒ Object
396
397
398
|
# File 'lib/Tioga/FigMkr.rb', line 396
def tex_yaxis_numeric_label=(str)
self.yaxis_numeric_label_tex = str
end
|
#title_visible=(bool) ⇒ Object
533
534
535
536
537
538
|
# File 'lib/Tioga/FigMkr.rb', line 533
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
582
583
584
585
586
587
|
# File 'lib/Tioga/FigMkr.rb', line 582
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
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
|
# File 'lib/Tioga/FigMkr.rb', line 918
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
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
|
# File 'lib/Tioga/FigMkr.rb', line 943
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_fill ⇒ Object
507
508
509
|
# File 'lib/Tioga/FigMkr.rb', line 507
def transparency_for_fill
1.0 - self.fill_opacity
end
|
#transparency_for_fill=(frac) ⇒ Object
511
512
513
|
# File 'lib/Tioga/FigMkr.rb', line 511
def transparency_for_fill=(frac)
self.fill_opacity=(1.0 - frac)
end
|
#transparency_for_stroke ⇒ Object
499
500
501
|
# File 'lib/Tioga/FigMkr.rb', line 499
def transparency_for_stroke
1.0 - self.stroke_opacity
end
|
#transparency_for_stroke=(frac) ⇒ Object
503
504
505
|
# File 'lib/Tioga/FigMkr.rb', line 503
def transparency_for_stroke=(frac)
self.stroke_opacity=(1.0 - frac)
end
|
#update_bbox ⇒ Object
#xaxis_visible=(bool) ⇒ Object
554
555
556
557
558
559
|
# File 'lib/Tioga/FigMkr.rb', line 554
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
540
541
542
543
544
545
|
# File 'lib/Tioga/FigMkr.rb', line 540
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
561
562
563
564
565
566
|
# File 'lib/Tioga/FigMkr.rb', line 561
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
547
548
549
550
551
552
|
# File 'lib/Tioga/FigMkr.rb', line 547
def ylabel_visible=(bool)
if bool != false
raise "Sorry: can only set 'ylabel_visible' to false."
end
self.no_ylabel
end
|