Module: CTioga2::Graphics::Styles
- Defined in:
- lib/ctioga2/graphics/styles/box.rb,
lib/ctioga2/graphics/styles/axes.rb,
lib/ctioga2/graphics/styles/base.rb,
lib/ctioga2/graphics/styles/fill.rb,
lib/ctioga2/graphics/styles/plot.rb,
lib/ctioga2/graphics/styles/sets.rb,
lib/ctioga2/graphics/styles/curve.rb,
lib/ctioga2/graphics/styles/image.rb,
lib/ctioga2/graphics/styles/scope.rb,
lib/ctioga2/graphics/styles/texts.rb,
lib/ctioga2/graphics/styles/ticks.rb,
lib/ctioga2/graphics/styles/arrows.rb,
lib/ctioga2/graphics/styles/legend.rb,
lib/ctioga2/graphics/styles/styles.rb,
lib/ctioga2/graphics/styles/carrays.rb,
lib/ctioga2/graphics/styles/contour.rb,
lib/ctioga2/graphics/styles/factory.rb,
lib/ctioga2/graphics/styles/colormap.rb,
lib/ctioga2/graphics/styles/drawable.rb,
lib/ctioga2/graphics/styles/errorbar.rb,
lib/ctioga2/graphics/styles/location.rb,
lib/ctioga2/graphics/styles/map-axes.rb,
lib/ctioga2/graphics/styles/gradients.rb,
lib/ctioga2/graphics/styles/background.rb,
lib/ctioga2/graphics/styles/plot-types.rb,
lib/ctioga2/graphics/styles/stylesheet.rb,
lib/ctioga2/graphics/styles/colorbrewer.rb
Overview
All the styles
Defined Under Namespace
Modules: Sets Classes: ArrowStyle, AxisStyle, AxisTicks, BackgroundStyle, BaseContourStyle, BaseTextStyle, BasicStyle, BoxStyle, CircularArray, ColorMap, ContoursStyle, CrossedLinesFillPattern, CurveFillStyle, CurveStyle, CurveStyleFactory, ErrorBarStyle, FillPattern, FillStyle, FullLatexFont, FullTextStyle, HistogramStyle, ImageStyle, LaTeXFont, LegendStorageStyle, LineStyle, LocationStyle, MapAxisStyle, MarkerStringStyle, MarkerStyle, MultiColumnLegendStyle, OrientedLineStyle, ParametricPlotStyle, PlotStyle, ScopeStyle, SingleLineFillPattern, StrokeStyle, StyleSheet, TextLabel, TwoPointGradient
Constant Summary collapse
- BoxShapeRE =
{ /^square$/i => :square, /^round(ed)?$/i => :round, }
- BoxShape =
CmdType.new('box-shape', {:type => :re_list, :list => BoxShapeRE}, <<EOD) The shape of a box. It can be: * @square@ for a plain square box * @round@ for a rounded box EOD
- AxisStyleOptions =
AxisStyle.()
- PartialAxisStyle =
AxisStyleOptions.without('decoration')
- FillPatternType =
CmdType.new('fill-pattern', { :type => :function_based, :class => Graphics::Styles::FillPattern }, <<EOD) A fill pattern, one of: * @lines@:_angle_,_distance_,_width_ * @vlines@:_distance_,_width_ * @hlines@:_distance_,_width_ * @xlines@:_distance_,_width_,_angle_ * @solid@ or @plain@ The first three are lines, of arbitrary orientation for @lines@, vertical for @vlines@ and horizontal for @hlines@. @xlines@ correspond to crossed perpendicular lines (the _angle_ is 45 by default). For these styles, the _distance_ and _width_ are all optional and correspond respectively to the distance between the lines and the line width. @solid@ or @plain@ correspond to solid fill (i.e. not patterned). EOD
- AxisGroup =
CmdGroup.new('axes-labels', "Axes and labels", "Axes and labels", 40)
- AxisTypeCommands =
[]
- AxisStyleCommand =
Cmd.new("axis-style",nil,"--axis-style", [ CmdArg.new('axis'), ], asco) do |plotmaker, which, opts| axes = [which] if opts['also-axes'] axes += opts['also-axes'].split(/\s*,\s*/) end for w in axes begin style = AxisStyle.current_axis_style(plotmaker, w) style.set_from_hash(opts) rescue Exception => e Log::error {"Error while setting style of axis: #{w} -- #{e}"} end end end
- ClearAxesCommand =
Cmd.new("clear-axes",nil,"--clear-axes" ) do |plotmaker, opts| PlotStyle.current_plot_style(plotmaker).clear_axes end
- DrawingFrameCommand =
Cmd.new("drawing-frame",nil,"--drawing-frame", [], { 'units' => CmdArg.new('text') }) do |plotmaker, opts| style = PlotStyle.current_plot_style(plotmaker) style.clear_axes style.padding = nil u = opts['units'] || 'cm' if u =~ /([\d.]+)?\s*(cm|in|bp|pt|mm)/ nb = $1 ? $1.to_f : 1.0 un = $2 style.frame_real_size = nb * Types::Dimension::DimensionConversion.fetch(un) else raise 'Invalid unit' end end
- TicksCommand =
Cmd.new("ticks",nil,"--ticks", [ CmdArg.new('axis'), ], Styles::AxisTicks.) do |plotmaker, which, opts| style = AxisStyle.current_axis_style(plotmaker, which) style.ticks.set_from_hash(opts) end
- BackgroundLinesCommand =
Cmd.new('background-lines', nil, '--background-lines', [ CmdArg.new('axis'), CmdArg.new('color-or-false') ], StrokeStyle.().without('color') ) do |plotmaker, which, color, | axis = AxisStyle.current_axis_style(plotmaker, which) if color style = {'color' => color} style.merge!() if axis.background_lines axis.background_lines.set_from_hash(style) else axis.background_lines = StrokeStyle.from_hash(style) end else axis.background_lines = false end end
- BackgroundGridCommand =
Cmd.new('background-grid', nil, '--background-grid', [ CmdArg.new('color-or-false') ], StrokeStyle.().without('color') ) do |plotmaker, color, | for which in [:left, :bottom] axis = AxisStyle.current_axis_style(plotmaker, which) if color style = {'color' => color} style.merge!() if axis.background_lines axis.background_lines.set_from_hash(style) else axis.background_lines = StrokeStyle.from_hash(style) end else axis.background_lines = false end end end
- TitleLabelCommand =
Cmd.new('title', '-t', '--title', [ CmdArg.new('text') ], TextLabel.().without('text') ) do |plotmaker, label, | PlotStyle.current_plot_style(plotmaker). set_label_style('title', , label) end
- NoTitleLabelCommand =
Cmd.new('no-title', nil, '--no-title', []) do |plotmaker| PlotStyle.current_plot_style(plotmaker). set_label_style('title', {}, false) end
- X2Command =
Cmd.new('x2', nil, '--x2', []) do |plotmaker| plotmaker.interpreter. run_commands("xaxis top\naxis-style top /decoration=full") end
- Y2Command =
Cmd.new('y2', nil, '--y2', []) do |plotmaker| plotmaker.interpreter. run_commands("yaxis right\naxis-style right /decoration=full") end
- NewZAxisCommand =
Cmd.new('new-zaxis', nil, '--new-zaxis', [ CmdArg.new('text') ], ZAxisStyle.merge(Elements::TiogaElement::StyleBaseOptions) ) do |plotmaker, name, | cps = PlotStyle.current_plot_style(plotmaker) axis = Elements::MapAxisElement.new(cps.target_plot, ) cps.set_axis(name, axis) axis.style.set_from_hash() end
- LabelStyleCommand =
Cmd.new('label-style', nil, '--label-style', [ CmdArg.new('label') ], # Here: change the label too... FullTextLabelOptions) do |plotmaker, which, | PlotStyle.current_plot_style(plotmaker). set_label_style(which, ) end
- AspectRatioRE =
{ /ignore/i => :ignore, /expand/i => :expand, /contract/i => :contract, }
- AspectRatioType =
CmdType.new('aspect-ratio', {:type => :re_list, :list => AspectRatioRE}, <<EOD) How the {command: draw-image} command respects the original image aspect ratio: * @ignore@ (the default) ignores the original aspect ratio * @expand@ expand the original box to respect aspect ratio * @contract@ contract the original box to respect aspect ratio EOD
- FullTextStyleOptions =
A hash that can be used as a base for optional arguments to things that take texts.
FullTextStyle.()
- FullTextLabelOptions =
TextLabel.()
- StyleSheetGroup =
CmdGroup.new('style-sheets', "Default styles", <<EOD, 40) Commands for defining default styles. All commands take the selector of the style to be defined. It is a CSS-like selector, relying on #id and .class, and using #parentality. Therefore, defining a style for @.insets #stuff@ will define it for an object named @stuff@, but only if it is contained within another one that has a @.insets@ class. ctioga2 does not support changing a style after its use. It may affect only the following objects or all the ones that were created from the beginning, depending on the context. For safety, only define style before issueing any graphics command. EOD
- StyleSheetCommands =
{}
- StyleSheetPredefinedNames =
{}
- AllStyleKeys =
[]
- AllStyleOptions =
{}
- GenericStyleCommand =
Cmd.new("define-style",nil, "--define-style", [ CmdArg.new('text'), ], AllStyleOptions ) do |plotmaker, xpath, opts| StyleSheet.style_sheet.update_style(xpath, opts) end
- LoadStyleCommand =
Cmd.new("load-style", nil, "--load-style", [ CmdArg.new('file'), ], {} ) do |plotmaker, file| Utils::open(file) do |f| str = f.read StyleSheet.style_sheet.update_from_string(str) end end
- SkipCommand =
Cmd.new("skip",nil,"--skip", [], {'number' => CmdArg.new("integer")} ) do |plotmaker, opts| number = opts['number'] || 1 fct = plotmaker.curve_generator.style_factory while number > 0 number -= 1 fct.next end end
- ReuseCommand =
Cmd.new("reuse-style",nil,"--reuse-style", [CmdArg.new('object')], {} ) do |plotmaker, obj, opts| stl = obj.curve_style.to_hash plotmaker.curve_generator.style_factory.set_next_style(stl) end
- ZAxisStyle =
TODO:
This naming doesn’t look that good, honestly
MapAxisStyle.()
- BackgroundGroup =
CmdGroup.new('background', "Background", <<EOD, 40) Commands dealing with the aspect of the background of a plot (excluding background lines, which are linked to axes). EOD
- BackgroundColorCmd =
Cmd.new('background', nil, '--background', [ CmdArg.new('color-or-false') ]) do |plotmaker, color| PlotStyle.current_plot_style(plotmaker). background.style.background_color = color end
- WatermarkCmd =
Cmd.new('watermark', nil, '--watermark', [ CmdArg.new('text') ], MarkerStringStyle.) do |plotmaker, text, opts| bg = PlotStyle.current_plot_style(plotmaker). background bg.watermark = text bg.watermark_style.set_from_hash(opts) end
- StyleAspectRE =
{ /^marker[_-]color$/i => :marker_color, /^marker[_-]fill[_-]color$/i => :marker_fill_color, /^marker[_-]line[_-]color$/i => :marker_line_color, /^marker[_-](size|scale)$/i => :marker_scale, }
- StyleAspect =
CmdType.new('style-aspect', {:type => :re_list, :list => StyleAspectRE}, <<EOD) This type designs which aspect of the style of a {command: xy-parametric} plot is controlled by a certain Z value. It can take the following values: * @marker_color@: the color for the markers * @marker_size@/@marker_scale@: the size of the markers EOD
- CumulativeHistogramsType =
CmdType.new('cumulative-histograms', { :type => :integer, :shortcuts => { /next/i => :next, /no|false/i => false } }, <<EOD) How to specify that histograms should be stacked. Can be: * a positive number, in which case the following histograms will be added to the numbered one (0 is the first) * no/false, in which case the following histograms are not stacked * next, in which case the following histograms get stacked on a new slot EOD
- ComputeDxRE =
{ /^no(ne)?$/i => false, /^min(dx)?$/i => :mindx, }
- ComputeDx =
CmdType.new('compute-dx', {:type => :re_list, :list => ComputeDxRE}, <<EOD) This controls how the histograms treats unevenly spaced X values: * @none@: ignores the problem, and treats the points as if they were all evenly spaced * @min@, @mindx@: considers that all slots have the size of the smallest variation of X values EOD