diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..97c645a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +Gemfile.lock +**/*.swp +coverage/ diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..3687797 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--require spec_helper +--color diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..be02188 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,13 @@ +require: rubocop-rspec +inherit_from: .rubocop_todo.yml + +AllCops: + TargetRubyVersion: 2.5 + +RSpec/DescribeClass: + Exclude: + - 'spec/**/*_spec.rb' + +Metrics/BlockLength: + Exclude: + - 'spec/**/*_spec.rb' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..961b79d --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,606 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2019-11-26 16:32:38 +0000 using RuboCop version 0.73.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_argument, with_fixed_indentation +Layout/AlignArguments: + Exclude: + - 'lib/gnuplot.rb' + - 'test/test_gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/AlignArray: + Exclude: + - 'test/test_gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLineAfterMagicComment: + Exclude: + - 'ruby_gnuplot.gemspec' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines. +Layout/EmptyLineBetweenDefs: + Exclude: + - 'lib/gnuplot.rb' + - 'test/test_gnuplot.rb' + +# Offense count: 12 +# Cop supports --auto-correct. +Layout/EmptyLines: + Exclude: + - 'lib/gnuplot.rb' + - 'test/test_gnuplot.rb' + +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, no_empty_lines +Layout/EmptyLinesAroundBlockBody: + Exclude: + - 'examples/multiple_data_sets.rb' + - 'test/arrtest.rb' + - 'test/multtest.rb' + - 'test/sinwave.rb' + +# Offense count: 11 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only +Layout/EmptyLinesAroundClassBody: + Exclude: + - 'lib/gnuplot.rb' + - 'test/test_gnuplot.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Layout/EmptyLinesAroundMethodBody: + Exclude: + - 'lib/gnuplot.rb' + - 'test/test_gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines +Layout/EmptyLinesAroundModuleBody: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Exclude: + - 'test/test_gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: IndentationWidth. +Layout/IndentAssignment: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: normal, indented_internal_methods +Layout/IndentationConsistency: + Exclude: + - 'examples/multiple_data_sets.rb' + - 'lib/gnuplot.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: Width, IgnoredPatterns. +Layout/IndentationWidth: + Exclude: + - 'examples/3d_surface_plot.rb' + - 'lib/gnuplot.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Layout/SpaceAfterComma: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 13 +# Cop supports --auto-correct. +Layout/SpaceAfterMethodName: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/SpaceAroundEqualsInParameterDefault: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment. +Layout/SpaceAroundOperators: + Exclude: + - 'examples/discrete_points.rb' + - 'examples/multiple_data_sets.rb' + - 'ruby_gnuplot.gemspec' + - 'test/arrtest.rb' + - 'test/histtest.rb' + - 'test/multtest.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceBeforeBlockBraces: + Exclude: + - 'examples/histogram.rb' + - 'lib/gnuplot.rb' + +# Offense count: 18 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBrackets: space, no_space +Layout/SpaceInsideArrayLiteralBrackets: + Exclude: + - 'lib/gnuplot.rb' + - 'test/test_gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/SpaceInsideArrayPercentLiteral: + Exclude: + - 'examples/histogram.rb' + +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideBlockBraces: + Exclude: + - 'examples/histogram.rb' + - 'lib/gnuplot.rb' + +# Offense count: 120 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/SpaceInsideParens: + Enabled: false + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: IndentationWidth. +Layout/Tab: + Exclude: + - 'examples/3d_surface_plot.rb' + - 'examples/multiple_data_sets.rb' + - 'lib/gnuplot.rb' + - 'test/test_gnuplot.rb' + +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingBlankLines: + Exclude: + - 'examples/histogram.rb' + - 'examples/sin_wave.rb' + - 'test/arrtest.rb' + - 'test/histtest.rb' + - 'test/multtest.rb' + - 'test/sinwave.rb' + - 'test/test_gnuplot.rb' + +# Offense count: 27 +# Cop supports --auto-correct. +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'examples/discrete_points.rb' + - 'examples/histogram.rb' + - 'examples/multiple_data_sets.rb' + - 'examples/output_image_file.rb' + - 'examples/sin_wave.rb' + +# Offense count: 1 +Lint/AmbiguousOperator: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 2 +Lint/ShadowingOuterLocalVariable: + Exclude: + - 'test/test_gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. +Lint/UnusedBlockArgument: + Exclude: + - 'test/histtest.rb' + +# Offense count: 1 +Lint/UselessAssignment: + Exclude: + - 'test/test_gnuplot.rb' + +# Offense count: 3 +Metrics/AbcSize: + Max: 23 + +# Offense count: 9 +# Configuration parameters: CountComments, ExcludedMethods. +# ExcludedMethods: refine +Metrics/BlockLength: + Max: 143 + +# Offense count: 1 +Metrics/CyclomaticComplexity: + Max: 13 + +# Offense count: 8 +# Configuration parameters: CountComments, ExcludedMethods. +Metrics/MethodLength: + Max: 22 + +# Offense count: 1 +Metrics/PerceivedComplexity: + Max: 12 + +# Offense count: 1 +# Configuration parameters: EnforcedStyleForLeadingUnderscores. +# SupportedStylesForLeadingUnderscores: disallowed, required, optional +Naming/MemoizedInstanceVariableName: + Exclude: + - 'Rakefile' + +# Offense count: 4 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: io, id, to, by, on, in, at, ip, db +Naming/UncommunicativeMethodParamName: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: snake_case, camelCase +Naming/VariableName: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +Security/Eval: + Exclude: + - 'Rakefile' + +# Offense count: 16 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: prefer_alias, prefer_alias_method +Style/Alias: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, conditionals +Style/AndOr: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners. +# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces +# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object +# FunctionalMethods: let, let!, subject, watch +# IgnoredMethods: lambda, proc, it +Style/BlockDelimiters: + Exclude: + - 'examples/multiple_data_sets.rb' + - 'lib/gnuplot.rb' + - 'test/multtest.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: is_a?, kind_of? +Style/ClassCheck: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +Style/ClassMethods: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 9 +# Cop supports --auto-correct. +Style/ColonMethodCall: + Exclude: + - 'lib/gnuplot.rb' + - 'test/test_gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 7 +Style/Documentation: + Exclude: + - 'spec/**/*' + - 'test/**/*' + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/Encoding: + Exclude: + - 'ruby_gnuplot.gemspec' + +# Offense count: 9 +# Cop supports --auto-correct. +Style/ExpandPathArguments: + Exclude: + - 'Rakefile' + - 'examples/3d_surface_plot.rb' + - 'examples/discrete_points.rb' + - 'examples/histogram.rb' + - 'examples/multiple_data_sets.rb' + - 'examples/output_image_file.rb' + - 'examples/sin_wave.rb' + - 'ruby_gnuplot.gemspec' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: each, for +Style/For: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 23 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, never +Style/FrozenStringLiteralComment: + Enabled: false + +# Offense count: 1 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +Style/HashSyntax: + EnforcedStyle: hash_rockets + +# Offense count: 3 +# Cop supports --auto-correct. +Style/IfUnlessModifier: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +Style/IfUnlessModifierOfIfUnless: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: IgnoredMethods. +Style/MethodCallWithoutArgsParentheses: + Exclude: + - 'test/histtest.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline +Style/MethodDefParentheses: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +Style/MethodMissingSuper: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +Style/MissingRespondToMissing: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/MultilineIfThen: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Exclude: + - 'lib/gnuplot.rb' + - 'lib/ruby_gnuplot/version.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: both, prefix, postfix +Style/NegatedIf: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/NestedModifier: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/Not: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 18 +# Cop supports --auto-correct. +# Configuration parameters: Strict. +Style/NumericLiterals: + MinDigits: 7 + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods. +# SupportedStyles: predicate, comparison +Style/NumericPredicate: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowSafeAssignment, AllowInMultilineConditions. +Style/ParenthesesAroundCondition: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'examples/histogram.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowMultipleReturnValues. +Style/RedundantReturn: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +Style/RedundantSelf: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: use_perl_names, use_english_names +Style/SpecialGlobalVars: + Exclude: + - 'ruby_gnuplot.gemspec' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/StderrPuts: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 235 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: IgnoredMethods. +# IgnoredMethods: respond_to, define_method +Style/SymbolProc: + Exclude: + - 'examples/discrete_points.rb' + - 'examples/histogram.rb' + - 'examples/multiple_data_sets.rb' + - 'lib/gnuplot.rb' + - 'test/arrtest.rb' + - 'test/multtest.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, AllowSafeAssignment. +# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex +Style/TernaryParentheses: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArrayLiteral: + Exclude: + - 'examples/histogram.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: WordRegex. +# SupportedStyles: percent, brackets +Style/WordArray: + EnforcedStyle: percent + MinSize: 10 + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: forbid_for_all_comparison_operators, forbid_for_equality_operators_only, require_for_all_comparison_operators, require_for_equality_operators_only +Style/YodaCondition: + Exclude: + - 'test/test_gnuplot.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/ZeroLengthPredicate: + Exclude: + - 'lib/gnuplot.rb' + +# Offense count: 9 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Metrics/LineLength: + Max: 115 diff --git a/ChangeLog b/ChangeLog index 4a9cdf9..0698188 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2.6.1 +* TheKnight Fix bug in SPlot.to_gplot implementation. + +2.6.0 +* better readme, allow for unsetting variables, thanks @kot-behemoth and @evnu + +2.5.0 + * save output to instance variable, thanks for the patch. + 2.4.1 * Quote escape more strings. Thanks for the tip! diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8123674 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM ruby:2.5.0 as base + +RUN apt-get update && apt-get install -y gnuplot + +RUN useradd -u 1000 gnuplot; \ + mkdir -p /home/gnuplot/gnuplot; \ + chown gnuplot.gnuplot -R /home/gnuplot + +WORKDIR /home/gnuplot/gnuplot + +USER gnuplot + +COPY lib/ ./lib/ +COPY *.gemspec ./ +COPY Gemfile ./ + +RUN gem install bundler; bundle install diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..3ef8ff9 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in ruby_gnuplot.gemspec +gemspec diff --git a/README.textile b/README.textile index 43b6773..3757e4e 100644 --- a/README.textile +++ b/README.textile @@ -14,71 +14,79 @@ h2. History and Background been using it actively ever since. Now rdp maintains it. See also the changelog for more detail. +h2. Pre-requisites and Installation + + 1. (mac) Install XQuartz from here: + @http://xquartz.macosforge.org/landing/@ + + 2. Install gnuplot with homebrew (not OS X? install it using your package manager): + @brew install gnuplot --with-x11@ + + 3. Install gnuplot gem: + @gem install gnuplot@ + h2. Ruby Gnuplot Concepts Gnuplot has a very simple conceptual model. Calls to _Set_ are made to set parameters and either _Plot_ or _Splot_ is called to generate the actual plot. The _dataset_ to be - plotted can be specified in a number of ways, contained in a seperate + plotted can be specified in a number of ways, contained in a separate file, generated from a function, read from standard input, or read immediately after the plot command. The object model for the Ruby gnuplot wrapper directly mimics this - layout and flow. The following are the standard steps for generating a + layout and flow. The following are the standard steps for generating a plot: -p. Instantiate a Plot or Splot object and set parameters by gnuplot variable name. -p. Instantiate DataSet objects and attach Ruby objects containing - the data to be plotted to the DataSet. Attach properties that modify - the plot command using the modifier name. + 1. Instantiate a @Plot@ or @Splot@ object and set parameters by gnuplot variable name. + + 2. Instantiate @DataSet@ objects and attach Ruby objects containing the data to be plotted to the @DataSet@. Attach properties that modify the plot command using the modifier name. -p. Send the Plot/Splot object to a Gnuplot instance for - plotting. + 3. Send the @Plot@/@Splot@ object to a @Gnuplot@ instance for plotting. The Version 2.0 interface makes very heavy use of blocks leading to very readable code. -Gnuplot.open - +@Gnuplot.open@ bq. - Instantiates a new Gnuplot process. The path to the executable is + Instantiates a new Gnuplot process. The path to the executable is determined on a Unix or MacOSX system using the which command. Windows users, I have no idea what to do. If a block is given to the function the opened process is passed into - the block. This mimics the most common usage of the File.open method. + the block. This mimics the most common usage of the @File.open@ method. -Plot.new +@Plot.new@ -SPlot.new +@SPlot.new@ bq. - Create a new Plot or Splot object. DataSets are attached to the object + Create a new @Plot@ or @SPlot@ object. @DataSet@ s are attached to the object to specify the data and its properties. If a block is given to the function, the plot object is passed into the block. -DataSet.new +@DataSet.new@ bq. Associates a Ruby object containing the data to plot with the properties - that will be passed to the plot command for that dataset. Any Ruby - object can be associated with a DataSet as long as it understands the - to_gplot method. + that will be passed to the plot command for that dataset. Any Ruby + object can be associated with a @DataSet@ as long as it understands the + @to_gplot@ method. - to_gplot +@to_gplot@ bq. Within Gnuplot, plot data is read in very simple formats. The - to_gplot method is expected to write the data of the object in a format - that is understandable by Gnuplot. One of the many great things about - Ruby is that methods can be added after the original declaration. The - gnuplot module defines the to_gplot method on the following classes: - Array, String, and Matrix. - Simply define a to_gplot method on your own class to tie the class into + @to_gplot@ method is expected to write the data of the object in a format + that is understandable by Gnuplot. One of the many great things about + Ruby is that methods can be added after the original declaration. The + gnuplot module defines the @to_gplot@ method on the following classes: + @Array@, @String@, and @Matrix@. + Simply define a @to_gplot@ method on your own class to tie the class into gnuplot. h2. Examples @@ -89,26 +97,13 @@ h3. Simple sin wave bq. The following example simply plots the value of sin(x) between the ranges of -10 and 10. A few points to notice: -p. The code uses nested blocks to construct the plot. The newly - created object is passed to the block so it can be modified in - place. +* The code uses nested blocks to construct the plot. The newly created object is passed to the block so it can be modified in place. -p. Each of the gnuplot plot variables are modified using the - variable name as a method name on the plot object or on the dataset - object. The wrapper also takes care of the single quoting that is - required on some of the variables like title, ylabel, and xlabel. - +* Each of the gnuplot plot variables are modified using the variable name as a method name on the plot object or on the dataset object. The wrapper also takes care of the single quoting that is required on some of the variables like @title@, @ylabel@, and @xlabel@. -p. The plot object simply has an array of DataSets. The - constructor initializes this empty array before yielding to the - block. This method uses the << operator to add the DataSet to - the plot. - +* The plot object simply has an array of @DataSet@s. The constructor initializes this empty array before yielding to the block. This method uses the @<<@ operator to add the @DataSet@ to the plot. -p. When the plot block ends, if an IO object is given to the Plot - constructor, the plot commands will be written to the IO object. - Any object can be passed to the constructor as long as it - understands the << operator. +* When the plot block ends, if an @IO@ object is given to the @Plot@ constructor, the plot commands will be written to the @IO@ object. Any object can be passed to the constructor as long as it understands the @<<@ operator.
 Gnuplot.open do |gp|
@@ -116,8 +111,8 @@ Gnuplot.open do |gp|
   
     plot.xrange "[-10:10]"
     plot.title  "Sin Wave Example"
-    plot.ylabel "x"
-    plot.xlabel "sin(x)"
+    plot.xlabel "x"
+    plot.ylabel "sin(x)"
     
     plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds|
       ds.with = "lines"
@@ -130,21 +125,22 @@ end
 
Or you can write it out to a file (the above snippet displays the graph, in Linux, but in windows you'd need to write it to a file). -See the file examples/output_image_file.rb. + +See the file @examples/output_image_file.rb@. h3. Plotting discrete points -Array data can be plotted quite easily since Arrays have a defined to_gplot method. +Array data can be plotted quite easily since @Array@s have a defined @to_gplot@ method. -Simply pass an array of data to the constructor of the DataSet object or set the data property of the DataSet. In this example, because there are two arrays, each array will be a single column of data to the gnuplot process. +Simply pass an array of data to the constructor of the @DataSet@ object or set the data property of the @DataSet@. In this example, because there are two arrays, each array will be a single column of data to the gnuplot process.
 Gnuplot.open do |gp|
   Gnuplot::Plot.new( gp ) do |plot|
   
     plot.title  "Array Plot Example"
-    plot.ylabel "x"
-    plot.xlabel "x^2"
+    plot.xlabel "x"
+    plot.ylabel "x^2"
     
     x = (0..50).collect { |v| v.to_f }
     y = x.collect { |v| v ** 2 }
@@ -159,9 +155,9 @@ end
     
 h3. Multiple Data Sets
 
-As many data sets as are desired can be attached to a plot. Each of these can have their own plot modifiers. Notice in this example how the data array is explicitly set instead of using the << operator.
+As many data sets as are desired can be attached to a plot. Each of these can have their own plot modifiers. Notice in this example how the data array is explicitly set instead of using the @<<@ operator.
 
-Also in this example, the commands are not written to the Gnuplot process but are instead written to a File called gnuplot.dat. This file can later be run directly by a gnuplot process as it contains only the gnuplot commands.
+Also in this example, the commands are not written to the Gnuplot process but are instead written to a File called @gnuplot.dat@. This file can later be run directly by a gnuplot process as it contains only the gnuplot commands.
 
 
 File.open( "gnuplot.dat", "w") do |gp|
@@ -192,11 +188,19 @@ File.open( "gnuplot.dat", "w") do |gp|
 end
 
+h3. Miscellanrous + You can also add arbitrary lines to the output
-plot.arbitrary_lines << "set ylabel \"y label" font \"Helvetica,20\""
+plot.arbitrary_lines << "set ylabel \"y label\" font \"Helvetica,20\""
 
See more in the examples folder. Also since this is basically just a wrapper for gnuplot itself, you should be able to do anything that it can do (demos: -http://gnuplot.sourceforge.net/demo_4.4/ ) \ No newline at end of file +http://gnuplot.sourceforge.net/demo_4.4/ ) + +h3. Security + +Note that if you pass any user-controlled strings to the gem, it's possible for an attacker to run arbitrary commands. + +In addition to title, any other graph properties that accept strings should be affected too. they're all passed to the system command. So only use strings you trust. diff --git a/Rakefile b/Rakefile index 5b8c3aa..bc3514b 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,23 @@ -require 'jeweler' -Jeweler::Tasks.new do |s| - s.name = 'gnuplot' - s.description = s.summary = "Utility library to aid in interacting with gnuplot from ruby" - s.version = "2.4.1" - s.authors='roger pack' - s.autorequire = 'gnuplot.rb' - s.email = "rogerpack2005@gmail.com" - s.homepage = "http://github.com/rdp/ruby_gnuplot/tree/master" -end \ No newline at end of file +require "bundler/gem_tasks" +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require 'rubygems/package_task' + +require_relative 'lib/ruby_gnuplot/version' + +desc 'run unit tests' +task :default => :test + +Rake::TestTask.new do |t| + t.libs << "lib" << 'spec/support' + t.test_files = FileList['test/**/*.rb'] + t.verbose = false + t.warning = false +end + +def gemspec + @clean_gemspec ||= eval(File.read(File.expand_path('../ruby_gnuplot.gemspec', __FILE__))) +end + +Gem::PackageTask.new(gemspec) { |pkg| } diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..61d4e71 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3' +services: + ruby_gnuplot: + build: . + working_dir: /home/gnuplot/gnuplot + container_name: ruby_gnuplot + command: /bin/bash + volumes: + - .:/home/gnuplot/gnuplot diff --git a/examples/3d_surface_plot.rb b/examples/3d_surface_plot.rb index 3c02451..942d8ce 100644 --- a/examples/3d_surface_plot.rb +++ b/examples/3d_surface_plot.rb @@ -1,3 +1,4 @@ +$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) require "gnuplot" Gnuplot.open do |gp| @@ -11,4 +12,4 @@ ] end sleep 10 -end \ No newline at end of file +end diff --git a/lib/gnuplot.rb b/lib/gnuplot.rb index 92cd27f..21ca23d 100644 --- a/lib/gnuplot.rb +++ b/lib/gnuplot.rb @@ -1,21 +1,21 @@ # Methods and variables for interacting with the gnuplot process. Most of # these methods are for sending data to a gnuplot process, not for reading from -# it. Most of the methods are implemented as added methods to the built in +# it. Most of the methods are implemented as added methods to the built in # classes. require 'matrix' - + module Gnuplot # Trivial implementation of the which command that uses the PATH environment # variable to attempt to find the given application. The application must # be executable and reside in one of the directories in the PATH environment # to be found. The first match that is found will be returned. - # + # # bin [String] The name of the executable to search for. - # + # # Return the full path to the first match or nil if no match is found. - # + # def Gnuplot.which ( bin ) if RUBY_PLATFORM =~ /mswin|mingw/ all = [bin, bin + '.exe'] @@ -41,59 +41,67 @@ def Gnuplot.which_helper bin # This is an implementation that works when the which command is # available. - # + # # IO.popen("which #{bin}") { |io| return io.readline.chomp } return nil - end + end # Find the path to the gnuplot executable. The name of the executable can # be specified using the RB_GNUPLOT environment variable but will default to - # the command 'gnuplot'. - # + # the command 'gnuplot'. + # # persist [bool] Add the persist flag to the gnuplot executable - # + # # Return the path to the gnuplot executable or nil if one cannot be found. def Gnuplot.gnuplot( persist = true ) - cmd = '"' + which( ENV['RB_GNUPLOT'] || 'gnuplot' ) + '"' - raise 'gnuplot executable not found' unless cmd + exe_loc = which( ENV['RB_GNUPLOT'] || 'gnuplot' ) + raise 'gnuplot executable not found on path' unless exe_loc + cmd = '"' + exe_loc + '"' cmd += " -persist" if persist cmd end - + # Open a gnuplot process that exists in the current PATH. If the persist # flag is true then the -persist flag is added to the command line. The - # path to the gnuplot executable is determined using the 'which' command. + # path to the gnuplot executable is determined using the 'which' command. # # See the gnuplot documentation for information on the persist flag. # # todo Add a method to pass the gnuplot path to the function. - + def Gnuplot.open( persist=true ) - cmd = Gnuplot.gnuplot( persist ) or raise 'gnuplot not found' - IO::popen( cmd, "w") { |io| yield io } - end - - + cmd = Gnuplot.gnuplot( persist ) + IO::popen( cmd, "w+") { |io| + yield io + io.close_write + @output = io.read + } + return @output + end + + + # Holds command information and performs the formatting of that command # information to a Gnuplot process. When constructing a new plot for # gnuplot, this is the first object that must be instantiated. On this # object set the various properties and add data sets. class Plot - attr_accessor :cmd, :data, :sets + attr_accessor :cmd, :data, :settings QUOTED = [ "title", "output", "xlabel", "x2label", "ylabel", "y2label", "clabel", "cblabel", "zlabel" ] def initialize (io = nil, cmd = "plot") @cmd = cmd - @sets = [] + @settings = [] @arbitrary_lines = [] @data = [] + @styles = [] yield self if block_given? - puts "writing this to gnuplot:\n" + to_gplot + "\n" if $VERBOSE + $stderr.puts "writing this to gnuplot:\n" + to_gplot + "\n" if $VERBOSE - if io + if io io << to_gplot io << store_datasets end @@ -111,14 +119,19 @@ def method_missing( methId, *args ) # Set a variable to the given value. +Var+ must be a gnuplot variable and # +value+ must be the value to set it to. Automatic quoting will be - # performed if the variable requires it. + # performed if the variable requires it. # # This is overloaded by the +method_missing+ method so see that for more # readable code. def set ( var, value = "" ) value = "\"#{value}\"" if QUOTED.include? var unless value =~ /^'.*'$/ - @sets << [ var, value ] + @settings << [ :set, var, value ] + end + + # Unset a variable. +Var+ must be a gnuplot variable. + def unset ( var ) + @settings << [ :unset, var ] end @@ -127,10 +140,72 @@ def set ( var, value = "" ) # gnuplot process. def [] ( var ) - v = @sets.assoc( var ) - v[1] || nil + v = @settings.reverse.rassoc( var ) + if v.nil? or v.first == :unset + nil + else + v[2] + end end + class Style + attr_accessor :linestyle, :linetype, :linewidth, :linecolor, + :pointtype, :pointsize, :fill, :index + + alias :ls :linestyle + alias :lt :linetype + alias :lw :linewidth + alias :lc :linecolor + alias :pt :pointtype + alias :ps :pointsize + alias :fs :fill + + alias :ls= :linestyle= + alias :lt= :linetype= + alias :lw= :linewidth= + alias :lc= :linecolor= + alias :pt= :pointtype= + alias :ps= :pointsize= + alias :fs= :fill= + + STYLES = [:ls, :lt, :lw, :lc, :pt, :ps, :fs] + + def Style.increment_index + @index ||= 0 + @index += 1 + + @index + end + + def initialize + STYLES.each do |s| + send("#{s}=", nil) + end + yield self if block_given? + + # only set the index if the user didn't do it + @index = Style::increment_index if index.nil? + end + + def to_s + str = "set style line #{index}" + STYLES.each do |s| + style = send(s) + if not style.nil? + str << " #{s} #{style}" + end + end + + str + end + end + + # Create a gnuplot linestyle + def style &blk + s = Style.new &blk + @styles << s + s + end def add_data ( ds ) @data << ds @@ -138,7 +213,10 @@ def add_data ( ds ) def to_gplot (io = "") - @sets.each { |var, val| io << "set #{var} #{val}\n" } + @settings.each do |setting| + io << setting.map(&:to_s).join(" ") << "\n" + end + @styles.each{|s| io << s.to_s << "\n"} @arbitrary_lines.each{|line| io << line << "\n" } io @@ -152,21 +230,25 @@ def store_datasets (io = "") v = @data.collect { |ds| ds.to_gplot } io << v.compact.join("e\n") end - + io end end + # Analogous to Plot class, holds command information and performs the formatting of that command + # information to a Gnuplot process. Should be used when for drawing 3D plots. + class SPlot < Plot def initialize (io = nil, cmd = "splot") super end - - def to_gplot (io = "") - @sets.each { |var, val| io << "set #{var} #{val}\n" } - io + # Currently using the implementation from parent class Plot. + # Leaving the method explicit here, though, as to allow an specific + # implementation for SPlot in the future. + def to_gplot (io = "") + super end end @@ -176,7 +258,7 @@ def to_gplot (io = "") # has a reference to the actual data being plotted as well as settings that # control the "plot" command. The data object must support the to_gplot # command. - # + # # +data+ The data that will be plotted. The only requirement is that the # object understands the to_gplot method. # @@ -187,39 +269,47 @@ def to_gplot (io = "") # # @todo Use the delegator to delegate to the data property. - class DataSet - attr_accessor :title, :with, :using, :data, :linewidth, :matrix, :smooth, :axes - + class DataSet + attr_accessor :title, :with, :using, :data, :linewidth, :linecolor, :matrix, :smooth, :axes, :index, :linestyle + + alias :ls :linestyle + alias :ls= :linestyle= + def initialize (data = nil) @data = data - @title = @with = @using = @linewidth = @matrix = @smooth = @axes = nil # avoid warnings + @linestyle = @title = @with = @using = @linewidth = @linecolor = @matrix = + @smooth = @axes = @index = nil # avoid warnings yield self if block_given? end - + def notitle @title = "notitle" end def plot_args (io = "") - + # Order of these is important or gnuplot barfs on 'em io << ( (@data.instance_of? String) ? @data : "'-'" ) + io << " index #{@index}" if @index + io << " using #{@using}" if @using - + io << " axes #{@axes}" if @axes - + io << case @title when /notitle/ then " notitle" when nil then "" - else " title '#{@title}'" + else " title '#{@title}'" end io << " matrix" if @matrix io << " smooth #{@smooth}" if @smooth io << " with #{@with}" if @with + io << " linecolor #{@linecolor}" if @linecolor io << " linewidth #{@linewidth}" if @linewidth + io << " linestyle #{@linestyle.index}" if @linestyle io end @@ -238,19 +328,20 @@ def to_gsplot else @data.to_gsplot end end - + end end class Array def to_gplot - if ( self[0].kind_of? Array ) then + return "" if self.empty? + + case self[0] + when Array tmp = self[0].zip( *self[1..-1] ) tmp.collect { |a| a.join(" ") }.join("\n") + "\ne" - elsif ( self[0].kind_of? Numeric ) then - s = "" - self.length.times { |i| s << "#{self[i]}\n" } - s + when Numeric + self.join("\n") else self[0].zip( *self[1..-1] ).to_gplot end @@ -258,7 +349,7 @@ def to_gplot def to_gsplot f = "" - + if ( self[0].kind_of? Array ) then x = self[0] y = self[1] @@ -275,16 +366,16 @@ def to_gsplot else self[0].zip( *self[1..-1] ).to_gsplot end - + f end end - + class Matrix def to_gplot (x = nil, y = nil) xgrid = x || (0...self.column_size).to_a ygrid = y || (0...self.row_size).to_a - + f = "" ygrid.length.times do |j| y = ygrid[j] @@ -294,7 +385,7 @@ def to_gplot (x = nil, y = nil) end end end - + f end diff --git a/lib/ruby_gnuplot/version.rb b/lib/ruby_gnuplot/version.rb new file mode 100644 index 0000000..ba6c60b --- /dev/null +++ b/lib/ruby_gnuplot/version.rb @@ -0,0 +1,3 @@ +module RubyGnuplot + VERSION = "2.6.1" +end diff --git a/ruby_gnuplot.gemspec b/ruby_gnuplot.gemspec new file mode 100644 index 0000000..97239a1 --- /dev/null +++ b/ruby_gnuplot.gemspec @@ -0,0 +1,25 @@ +# coding: utf-8 +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'ruby_gnuplot/version' + +Gem::Specification.new do |s| + s.name = 'gnuplot' + s.description = s.summary = "Utility library to aid in interacting with gnuplot from ruby" + s.version = RubyGnuplot::VERSION + s.authors='roger pack' + s.email = "rogerpack2005@gmail.com" + s.homepage = "http://github.com/rdp/ruby_gnuplot/tree/master" + s.license = "BSD" + + s.files = `git ls-files`.split($/) + s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) } + s.test_files = s.files.grep(%r{^(test|spec|features)/}) + s.require_paths = ["lib"] + + s.add_development_dependency 'minitest' + s.add_development_dependency 'rspec', '3.9.0' + s.add_development_dependency 'rubocop', '0.73.0' + s.add_development_dependency 'rubocop-rspec', '1.33.0' + s.add_development_dependency 'simplecov', '0.17.0' +end diff --git a/spec/fixtures/plots/array_plot.eps b/spec/fixtures/plots/array_plot.eps new file mode 100644 index 0000000..98b8de1 --- /dev/null +++ b/spec/fixtures/plots/array_plot.eps @@ -0,0 +1,810 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: spec/tmp/array_plot.eps +%%Creator: gnuplot 5.0 patchlevel 5 +%%CreationDate: Wed Nov 6 21:24:07 2019 +%%DocumentFonts: (atend) +%%BoundingBox: 50 50 410 302 +%%EndComments +%%BeginProlog +/gnudict 256 dict def +gnudict begin +% +% The following true/false flags may be edited by hand if desired. +% The unit line width and grayscale image gamma correction may also be changed. +% +/Color false def +/Blacktext false def +/Solid false def +/Dashlength 1 def +/Landscape false def +/Level1 false def +/Level3 false def +/Rounded false def +/ClipToBoundingBox false def +/SuppressPDFMark false def +/TransparentPatterns false def +/gnulinewidth 5.000 def +/userlinewidth gnulinewidth def +/Gamma 1.0 def +/BackgroundColor {-1.000 -1.000 -1.000} def +% +/vshift -46 def +/dl1 { + 10.0 Dashlength userlinewidth gnulinewidth div mul mul mul + Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if +} def +/dl2 { + 10.0 Dashlength userlinewidth gnulinewidth div mul mul mul + Rounded { currentlinewidth 0.75 mul add } if +} def +/hpt_ 31.5 def +/vpt_ 31.5 def +/hpt hpt_ def +/vpt vpt_ def +/doclip { + ClipToBoundingBox { + newpath 50 50 moveto 410 50 lineto 410 302 lineto 50 302 lineto closepath + clip + } if +} def +% +% Gnuplot Prolog Version 5.1 (Oct 2015) +% +%/SuppressPDFMark true def +% +/M {moveto} bind def +/L {lineto} bind def +/R {rmoveto} bind def +/V {rlineto} bind def +/N {newpath moveto} bind def +/Z {closepath} bind def +/C {setrgbcolor} bind def +/f {rlineto fill} bind def +/g {setgray} bind def +/Gshow {show} def % May be redefined later in the file to support UTF-8 +/vpt2 vpt 2 mul def +/hpt2 hpt 2 mul def +/Lshow {currentpoint stroke M 0 vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def + /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def +/DL {Color {setrgbcolor Solid {pop []} if 0 setdash} + {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def +/BL {stroke userlinewidth 2 mul setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +/AL {stroke userlinewidth 2 div setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +/UL {dup gnulinewidth mul /userlinewidth exch def + dup 1 lt {pop 1} if 10 mul /udl exch def} def +/PL {stroke userlinewidth setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +3.8 setmiterlimit +% Classic Line colors (version 5.0) +/LCw {1 1 1} def +/LCb {0 0 0} def +/LCa {0 0 0} def +/LC0 {1 0 0} def +/LC1 {0 1 0} def +/LC2 {0 0 1} def +/LC3 {1 0 1} def +/LC4 {0 1 1} def +/LC5 {1 1 0} def +/LC6 {0 0 0} def +/LC7 {1 0.3 0} def +/LC8 {0.5 0.5 0.5} def +% Default dash patterns (version 5.0) +/LTB {BL [] LCb DL} def +/LTw {PL [] 1 setgray} def +/LTb {PL [] LCb DL} def +/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def +/LT0 {PL [] LC0 DL} def +/LT1 {PL [2 dl1 3 dl2] LC1 DL} def +/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def +/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def +/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def +/LT5 {PL [4 dl1 2 dl2] LC5 DL} def +/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def +/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def +/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def +/SL {[] 0 setdash} def +/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def +/Dia {stroke [] 0 setdash 2 copy vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath stroke + Pnt} def +/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V + currentpoint stroke M + hpt neg vpt neg R hpt2 0 V stroke + } def +/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath stroke + Pnt} def +/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M + hpt2 vpt2 neg V currentpoint stroke M + hpt2 neg 0 R hpt2 vpt2 V stroke} def +/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath stroke + Pnt} def +/Star {2 copy Pls Crs} def +/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath fill} def +/TriUF {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath fill} def +/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath stroke + Pnt} def +/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath fill} def +/DiaF {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath fill} def +/Pent {stroke [] 0 setdash 2 copy gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath stroke grestore Pnt} def +/PentF {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath fill grestore} def +/Circle {stroke [] 0 setdash 2 copy + hpt 0 360 arc stroke Pnt} def +/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def +/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def +/C1 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc closepath fill + vpt 0 360 arc closepath} bind def +/C2 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C3 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C4 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 180 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C5 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc + 2 copy moveto + 2 copy vpt 180 270 arc closepath fill + vpt 0 360 arc} bind def +/C6 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C7 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C8 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 270 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C9 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 270 450 arc closepath fill + vpt 0 360 arc closepath} bind def +/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill + 2 copy moveto + 2 copy vpt 90 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C11 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 180 arc closepath fill + 2 copy moveto + 2 copy vpt 270 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C12 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 180 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C13 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc closepath fill + 2 copy moveto + 2 copy vpt 180 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C14 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 360 arc closepath fill + vpt 0 360 arc} bind def +/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto + neg 0 rlineto closepath} bind def +/Square {dup Rec} bind def +/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def +/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def +/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def +/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def +/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def +/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def +/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill + exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def +/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def +/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill + 2 copy vpt Square fill Bsquare} bind def +/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def +/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def +/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill + Bsquare} bind def +/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill + Bsquare} bind def +/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def +/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill + 2 copy vpt Square fill Bsquare} bind def +/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill + 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def +/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def +/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def +/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def +/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def +/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def +/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def +/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def +/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def +/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def +/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def +/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def +/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def +/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def +/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def +/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def +/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def +/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def +/DiaE {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath stroke} def +/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath stroke} def +/TriUE {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath stroke} def +/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath stroke} def +/PentE {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath stroke grestore} def +/CircE {stroke [] 0 setdash + hpt 0 360 arc stroke} def +/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def +/DiaW {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V Opaque stroke} def +/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V Opaque stroke} def +/TriUW {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V Opaque stroke} def +/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V Opaque stroke} def +/PentW {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + Opaque stroke grestore} def +/CircW {stroke [] 0 setdash + hpt 0 360 arc Opaque stroke} def +/BoxFill {gsave Rec 1 setgray fill grestore} def +/Density { + /Fillden exch def + currentrgbcolor + /ColB exch def /ColG exch def /ColR exch def + /ColR ColR Fillden mul Fillden sub 1 add def + /ColG ColG Fillden mul Fillden sub 1 add def + /ColB ColB Fillden mul Fillden sub 1 add def + ColR ColG ColB setrgbcolor} def +/BoxColFill {gsave Rec PolyFill} def +/PolyFill {gsave Density fill grestore grestore} def +/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def +% +% PostScript Level 1 Pattern Fill routine for rectangles +% Usage: x y w h s a XX PatternFill +% x,y = lower left corner of box to be filled +% w,h = width and height of box +% a = angle in degrees between lines and x-axis +% XX = 0/1 for no/yes cross-hatch +% +/PatternFill {gsave /PFa [ 9 2 roll ] def + PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate + PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec + TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse + clip + currentlinewidth 0.5 mul setlinewidth + /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def + 0 0 M PFa 5 get rotate PFs -2 div dup translate + 0 1 PFs PFa 4 get div 1 add floor cvi + {PFa 4 get mul 0 M 0 PFs V} for + 0 PFa 6 get ne { + 0 1 PFs PFa 4 get div 1 add floor cvi + {PFa 4 get mul 0 2 1 roll M PFs 0 V} for + } if + stroke grestore} def +% +/languagelevel where + {pop languagelevel} {1} ifelse +dup 2 lt + {/InterpretLevel1 true def + /InterpretLevel3 false def} + {/InterpretLevel1 Level1 def + 2 gt + {/InterpretLevel3 Level3 def} + {/InterpretLevel3 false def} + ifelse } + ifelse +% +% PostScript level 2 pattern fill definitions +% +/Level2PatternFill { +/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8} + bind def +/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} +>> matrix makepattern +/Pat1 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke + 0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke} +>> matrix makepattern +/Pat2 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L + 8 8 L 8 0 L 0 0 L fill} +>> matrix makepattern +/Pat3 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L + 0 12 M 12 0 L stroke} +>> matrix makepattern +/Pat4 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L + 0 -4 M 12 8 L stroke} +>> matrix makepattern +/Pat5 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L + 0 12 M 8 -4 L 4 12 M 10 0 L stroke} +>> matrix makepattern +/Pat6 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L + 0 -4 M 8 12 L 4 -4 M 10 8 L stroke} +>> matrix makepattern +/Pat7 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L + 12 0 M -4 8 L 12 4 M 0 10 L stroke} +>> matrix makepattern +/Pat8 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L + -4 0 M 12 8 L -4 4 M 8 10 L stroke} +>> matrix makepattern +/Pat9 exch def +/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def +/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def +/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def +/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def +/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def +/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def +/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def +} def +% +% +%End of PostScript Level 2 code +% +/PatternBgnd { + TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse +} def +% +% Substitute for Level 2 pattern fill codes with +% grayscale if Level 2 support is not selected. +% +/Level1PatternFill { +/Pattern1 {0.250 Density} bind def +/Pattern2 {0.500 Density} bind def +/Pattern3 {0.750 Density} bind def +/Pattern4 {0.125 Density} bind def +/Pattern5 {0.375 Density} bind def +/Pattern6 {0.625 Density} bind def +/Pattern7 {0.875 Density} bind def +} def +% +% Now test for support of Level 2 code +% +Level1 {Level1PatternFill} {Level2PatternFill} ifelse +% +/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont +dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall +currentdict end definefont pop +% +/MFshow { + { dup 5 get 3 ge + { 5 get 3 eq {gsave} {grestore} ifelse } + {dup dup 0 get findfont exch 1 get scalefont setfont + [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6 + get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq + {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5 + get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div + dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get + textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop + pop aload pop M} ifelse }ifelse }ifelse } + ifelse } + forall} def +/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def +/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse } + {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont + 6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def +/MLshow { currentpoint stroke M + 0 exch R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/MRshow { currentpoint stroke M + exch dup MFwidth neg 3 -1 roll R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/MCshow { currentpoint stroke M + exch dup MFwidth -2 div 3 -1 roll R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/XYsave { [( ) 1 2 true false 3 ()] } bind def +/XYrestore { [( ) 1 2 true false 4 ()] } bind def +Level1 SuppressPDFMark or +{} { +/SDict 10 dict def +systemdict /pdfmark known not { + userdict /pdfmark systemdict /cleartomark get put +} if +SDict begin [ + /Title (spec/tmp/array_plot.eps) + /Subject (gnuplot plot) + /Creator (gnuplot 5.0 patchlevel 5) +% /Producer (gnuplot) +% /Keywords () + /CreationDate (Wed Nov 6 21:24:07 2019) + /DOCINFO pdfmark +end +} ifelse +% +% Support for boxed text - Ethan A Merritt May 2005 +% +/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put + userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put + /Boxing true def } def +/ExtendTextBox { Boxing + { gsave dup false charpath pathbbox + dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse + dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse + dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse + dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse + grestore } if } def +/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M + TBx1 TBxmargin sub TBy2 TBymargin add L + TBx2 TBxmargin add TBy2 TBymargin add L + TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def +/DrawTextBox { PopTextBox stroke /Boxing false def} def +/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def +0 0 0 0 InitTextBox +/TBxmargin 20 def +/TBymargin 20 def +/Boxing false def +/textshow { ExtendTextBox Gshow } def +% +% redundant definitions for compatibility with prologue.ps older than 5.0.2 +/LTB {BL [] LCb DL} def +/LTb {PL [] LCb DL} def +end +%%EndProlog +%%Page: 1 1 +gnudict begin +gsave +doclip +50 50 translate +0.050 0.050 scale +0 setgray +newpath +(Helvetica) findfont 140 scalefont setfont +BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {BackgroundColor C 1.000 0 0 7200.00 5040.00 BoxColFill} if +1.000 UL +LTb +LCb setrgbcolor +770 588 M +63 0 V +6114 0 R +-63 0 V +stroke +686 588 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +770 1394 M +63 0 V +6114 0 R +-63 0 V +stroke +686 1394 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 500)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +770 2200 M +63 0 V +6114 0 R +-63 0 V +stroke +686 2200 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 1000)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +770 3007 M +63 0 V +6114 0 R +-63 0 V +stroke +686 3007 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 1500)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +770 3813 M +63 0 V +6114 0 R +-63 0 V +stroke +686 3813 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 2000)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +770 4619 M +63 0 V +6114 0 R +-63 0 V +stroke +686 4619 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 2500)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +770 588 M +0 63 V +0 3968 R +0 -63 V +stroke +770 448 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +2005 588 M +0 63 V +0 3968 R +0 -63 V +stroke +2005 448 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 10)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +3241 588 M +0 63 V +0 3968 R +0 -63 V +stroke +3241 448 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 20)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +4476 588 M +0 63 V +0 3968 R +0 -63 V +stroke +4476 448 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 30)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +5712 588 M +0 63 V +0 3968 R +0 -63 V +stroke +5712 448 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 40)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +6947 588 M +0 63 V +0 3968 R +0 -63 V +stroke +6947 448 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 50)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +1.000 UL +LTB +LCb setrgbcolor +770 4619 N +770 588 L +6177 0 V +0 4031 V +-6177 0 V +Z stroke +1.000 UP +1.000 UL +LTb +LCb setrgbcolor +LCb setrgbcolor +112 2603 M +currentpoint gsave translate -270 rotate 0 0 moveto +[ [(Helvetica) 140.0 0.0 true true 0 (x)] +] -46.7 MCshow +grestore +LTb +LCb setrgbcolor +3858 238 M +[ [(Helvetica) 140.0 0.0 true true 0 (x)] +[(Helvetica) 112.0 70.0 true true 0 (2)] +] -60.7 MCshow +LTb +LCb setrgbcolor +3858 4829 M +[ [(Helvetica) 140.0 0.0 true true 0 (Array Plot Example)] +] -46.7 MCshow +% Begin plot #1 +1.000 UP +1.000 UL +LTb +LCb setrgbcolor +770 588 M +124 2 V +123 4 V +124 9 V +123 11 V +124 14 V +123 18 V +124 21 V +123 24 V +124 28 V +123 30 V +124 34 V +123 37 V +124 40 V +124 44 V +123 47 V +124 50 V +123 53 V +124 56 V +123 60 V +124 63 V +123 66 V +124 69 V +123 73 V +124 76 V +124 79 V +123 82 V +124 85 V +123 89 V +124 92 V +123 95 V +124 99 V +123 101 V +124 105 V +123 108 V +124 111 V +123 115 V +124 117 V +124 121 V +123 124 V +124 128 V +123 130 V +124 134 V +123 137 V +124 141 V +123 143 V +124 147 V +123 150 V +124 153 V +123 156 V +124 160 V +770 588 Pls +894 590 Pls +1017 594 Pls +1141 603 Pls +1264 614 Pls +1388 628 Pls +1511 646 Pls +1635 667 Pls +1758 691 Pls +1882 719 Pls +2005 749 Pls +2129 783 Pls +2252 820 Pls +2376 860 Pls +2500 904 Pls +2623 951 Pls +2747 1001 Pls +2870 1054 Pls +2994 1110 Pls +3117 1170 Pls +3241 1233 Pls +3364 1299 Pls +3488 1368 Pls +3611 1441 Pls +3735 1517 Pls +3859 1596 Pls +3982 1678 Pls +4106 1763 Pls +4229 1852 Pls +4353 1944 Pls +4476 2039 Pls +4600 2138 Pls +4723 2239 Pls +4847 2344 Pls +4970 2452 Pls +5094 2563 Pls +5217 2678 Pls +5341 2795 Pls +5465 2916 Pls +5588 3040 Pls +5712 3168 Pls +5835 3298 Pls +5959 3432 Pls +6082 3569 Pls +6206 3710 Pls +6329 3853 Pls +6453 4000 Pls +6576 4150 Pls +6700 4303 Pls +6823 4459 Pls +6947 4619 Pls +% End plot #1 +2.000 UL +LTb +LCb setrgbcolor +1.000 UL +LTB +LCb setrgbcolor +770 4619 N +770 588 L +6177 0 V +0 4031 V +-6177 0 V +Z stroke +1.000 UP +1.000 UL +LTb +LCb setrgbcolor +stroke +grestore +end +showpage +%%Trailer +%%DocumentFonts: Helvetica diff --git a/spec/fixtures/plots/histogram_plot.eps b/spec/fixtures/plots/histogram_plot.eps new file mode 100644 index 0000000..c2edc90 --- /dev/null +++ b/spec/fixtures/plots/histogram_plot.eps @@ -0,0 +1,889 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: spec/tmp/histogram_plot.eps +%%Creator: gnuplot 5.0 patchlevel 5 +%%CreationDate: Fri Nov 22 22:11:02 2019 +%%DocumentFonts: (atend) +%%BoundingBox: 50 50 410 302 +%%EndComments +%%BeginProlog +/gnudict 256 dict def +gnudict begin +% +% The following true/false flags may be edited by hand if desired. +% The unit line width and grayscale image gamma correction may also be changed. +% +/Color false def +/Blacktext false def +/Solid false def +/Dashlength 1 def +/Landscape false def +/Level1 false def +/Level3 false def +/Rounded false def +/ClipToBoundingBox false def +/SuppressPDFMark false def +/TransparentPatterns false def +/gnulinewidth 5.000 def +/userlinewidth gnulinewidth def +/Gamma 1.0 def +/BackgroundColor {-1.000 -1.000 -1.000} def +% +/vshift -46 def +/dl1 { + 10.0 Dashlength userlinewidth gnulinewidth div mul mul mul + Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if +} def +/dl2 { + 10.0 Dashlength userlinewidth gnulinewidth div mul mul mul + Rounded { currentlinewidth 0.75 mul add } if +} def +/hpt_ 31.5 def +/vpt_ 31.5 def +/hpt hpt_ def +/vpt vpt_ def +/doclip { + ClipToBoundingBox { + newpath 50 50 moveto 410 50 lineto 410 302 lineto 50 302 lineto closepath + clip + } if +} def +% +% Gnuplot Prolog Version 5.1 (Oct 2015) +% +%/SuppressPDFMark true def +% +/M {moveto} bind def +/L {lineto} bind def +/R {rmoveto} bind def +/V {rlineto} bind def +/N {newpath moveto} bind def +/Z {closepath} bind def +/C {setrgbcolor} bind def +/f {rlineto fill} bind def +/g {setgray} bind def +/Gshow {show} def % May be redefined later in the file to support UTF-8 +/vpt2 vpt 2 mul def +/hpt2 hpt 2 mul def +/Lshow {currentpoint stroke M 0 vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def + /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def +/DL {Color {setrgbcolor Solid {pop []} if 0 setdash} + {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def +/BL {stroke userlinewidth 2 mul setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +/AL {stroke userlinewidth 2 div setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +/UL {dup gnulinewidth mul /userlinewidth exch def + dup 1 lt {pop 1} if 10 mul /udl exch def} def +/PL {stroke userlinewidth setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +3.8 setmiterlimit +% Classic Line colors (version 5.0) +/LCw {1 1 1} def +/LCb {0 0 0} def +/LCa {0 0 0} def +/LC0 {1 0 0} def +/LC1 {0 1 0} def +/LC2 {0 0 1} def +/LC3 {1 0 1} def +/LC4 {0 1 1} def +/LC5 {1 1 0} def +/LC6 {0 0 0} def +/LC7 {1 0.3 0} def +/LC8 {0.5 0.5 0.5} def +% Default dash patterns (version 5.0) +/LTB {BL [] LCb DL} def +/LTw {PL [] 1 setgray} def +/LTb {PL [] LCb DL} def +/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def +/LT0 {PL [] LC0 DL} def +/LT1 {PL [2 dl1 3 dl2] LC1 DL} def +/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def +/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def +/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def +/LT5 {PL [4 dl1 2 dl2] LC5 DL} def +/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def +/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def +/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def +/SL {[] 0 setdash} def +/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def +/Dia {stroke [] 0 setdash 2 copy vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath stroke + Pnt} def +/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V + currentpoint stroke M + hpt neg vpt neg R hpt2 0 V stroke + } def +/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath stroke + Pnt} def +/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M + hpt2 vpt2 neg V currentpoint stroke M + hpt2 neg 0 R hpt2 vpt2 V stroke} def +/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath stroke + Pnt} def +/Star {2 copy Pls Crs} def +/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath fill} def +/TriUF {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath fill} def +/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath stroke + Pnt} def +/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath fill} def +/DiaF {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath fill} def +/Pent {stroke [] 0 setdash 2 copy gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath stroke grestore Pnt} def +/PentF {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath fill grestore} def +/Circle {stroke [] 0 setdash 2 copy + hpt 0 360 arc stroke Pnt} def +/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def +/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def +/C1 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc closepath fill + vpt 0 360 arc closepath} bind def +/C2 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C3 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C4 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 180 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C5 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc + 2 copy moveto + 2 copy vpt 180 270 arc closepath fill + vpt 0 360 arc} bind def +/C6 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C7 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C8 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 270 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C9 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 270 450 arc closepath fill + vpt 0 360 arc closepath} bind def +/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill + 2 copy moveto + 2 copy vpt 90 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C11 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 180 arc closepath fill + 2 copy moveto + 2 copy vpt 270 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C12 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 180 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C13 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc closepath fill + 2 copy moveto + 2 copy vpt 180 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C14 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 360 arc closepath fill + vpt 0 360 arc} bind def +/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto + neg 0 rlineto closepath} bind def +/Square {dup Rec} bind def +/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def +/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def +/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def +/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def +/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def +/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def +/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill + exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def +/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def +/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill + 2 copy vpt Square fill Bsquare} bind def +/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def +/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def +/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill + Bsquare} bind def +/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill + Bsquare} bind def +/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def +/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill + 2 copy vpt Square fill Bsquare} bind def +/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill + 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def +/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def +/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def +/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def +/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def +/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def +/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def +/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def +/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def +/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def +/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def +/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def +/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def +/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def +/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def +/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def +/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def +/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def +/DiaE {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath stroke} def +/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath stroke} def +/TriUE {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath stroke} def +/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath stroke} def +/PentE {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath stroke grestore} def +/CircE {stroke [] 0 setdash + hpt 0 360 arc stroke} def +/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def +/DiaW {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V Opaque stroke} def +/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V Opaque stroke} def +/TriUW {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V Opaque stroke} def +/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V Opaque stroke} def +/PentW {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + Opaque stroke grestore} def +/CircW {stroke [] 0 setdash + hpt 0 360 arc Opaque stroke} def +/BoxFill {gsave Rec 1 setgray fill grestore} def +/Density { + /Fillden exch def + currentrgbcolor + /ColB exch def /ColG exch def /ColR exch def + /ColR ColR Fillden mul Fillden sub 1 add def + /ColG ColG Fillden mul Fillden sub 1 add def + /ColB ColB Fillden mul Fillden sub 1 add def + ColR ColG ColB setrgbcolor} def +/BoxColFill {gsave Rec PolyFill} def +/PolyFill {gsave Density fill grestore grestore} def +/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def +% +% PostScript Level 1 Pattern Fill routine for rectangles +% Usage: x y w h s a XX PatternFill +% x,y = lower left corner of box to be filled +% w,h = width and height of box +% a = angle in degrees between lines and x-axis +% XX = 0/1 for no/yes cross-hatch +% +/PatternFill {gsave /PFa [ 9 2 roll ] def + PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate + PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec + TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse + clip + currentlinewidth 0.5 mul setlinewidth + /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def + 0 0 M PFa 5 get rotate PFs -2 div dup translate + 0 1 PFs PFa 4 get div 1 add floor cvi + {PFa 4 get mul 0 M 0 PFs V} for + 0 PFa 6 get ne { + 0 1 PFs PFa 4 get div 1 add floor cvi + {PFa 4 get mul 0 2 1 roll M PFs 0 V} for + } if + stroke grestore} def +% +/languagelevel where + {pop languagelevel} {1} ifelse +dup 2 lt + {/InterpretLevel1 true def + /InterpretLevel3 false def} + {/InterpretLevel1 Level1 def + 2 gt + {/InterpretLevel3 Level3 def} + {/InterpretLevel3 false def} + ifelse } + ifelse +% +% PostScript level 2 pattern fill definitions +% +/Level2PatternFill { +/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8} + bind def +/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} +>> matrix makepattern +/Pat1 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke + 0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke} +>> matrix makepattern +/Pat2 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L + 8 8 L 8 0 L 0 0 L fill} +>> matrix makepattern +/Pat3 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L + 0 12 M 12 0 L stroke} +>> matrix makepattern +/Pat4 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L + 0 -4 M 12 8 L stroke} +>> matrix makepattern +/Pat5 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L + 0 12 M 8 -4 L 4 12 M 10 0 L stroke} +>> matrix makepattern +/Pat6 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L + 0 -4 M 8 12 L 4 -4 M 10 8 L stroke} +>> matrix makepattern +/Pat7 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L + 12 0 M -4 8 L 12 4 M 0 10 L stroke} +>> matrix makepattern +/Pat8 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L + -4 0 M 12 8 L -4 4 M 8 10 L stroke} +>> matrix makepattern +/Pat9 exch def +/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def +/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def +/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def +/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def +/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def +/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def +/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def +} def +% +% +%End of PostScript Level 2 code +% +/PatternBgnd { + TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse +} def +% +% Substitute for Level 2 pattern fill codes with +% grayscale if Level 2 support is not selected. +% +/Level1PatternFill { +/Pattern1 {0.250 Density} bind def +/Pattern2 {0.500 Density} bind def +/Pattern3 {0.750 Density} bind def +/Pattern4 {0.125 Density} bind def +/Pattern5 {0.375 Density} bind def +/Pattern6 {0.625 Density} bind def +/Pattern7 {0.875 Density} bind def +} def +% +% Now test for support of Level 2 code +% +Level1 {Level1PatternFill} {Level2PatternFill} ifelse +% +/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont +dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall +currentdict end definefont pop +% +/MFshow { + { dup 5 get 3 ge + { 5 get 3 eq {gsave} {grestore} ifelse } + {dup dup 0 get findfont exch 1 get scalefont setfont + [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6 + get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq + {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5 + get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div + dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get + textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop + pop aload pop M} ifelse }ifelse }ifelse } + ifelse } + forall} def +/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def +/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse } + {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont + 6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def +/MLshow { currentpoint stroke M + 0 exch R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/MRshow { currentpoint stroke M + exch dup MFwidth neg 3 -1 roll R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/MCshow { currentpoint stroke M + exch dup MFwidth -2 div 3 -1 roll R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/XYsave { [( ) 1 2 true false 3 ()] } bind def +/XYrestore { [( ) 1 2 true false 4 ()] } bind def +Level1 SuppressPDFMark or +{} { +/SDict 10 dict def +systemdict /pdfmark known not { + userdict /pdfmark systemdict /cleartomark get put +} if +SDict begin [ + /Title (spec/tmp/histogram_plot.eps) + /Subject (gnuplot plot) + /Creator (gnuplot 5.0 patchlevel 5) +% /Producer (gnuplot) +% /Keywords () + /CreationDate (Fri Nov 22 22:11:02 2019) + /DOCINFO pdfmark +end +} ifelse +% +% Support for boxed text - Ethan A Merritt May 2005 +% +/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put + userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put + /Boxing true def } def +/ExtendTextBox { Boxing + { gsave dup false charpath pathbbox + dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse + dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse + dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse + dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse + grestore } if } def +/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M + TBx1 TBxmargin sub TBy2 TBymargin add L + TBx2 TBxmargin add TBy2 TBymargin add L + TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def +/DrawTextBox { PopTextBox stroke /Boxing false def} def +/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def +0 0 0 0 InitTextBox +/TBxmargin 20 def +/TBymargin 20 def +/Boxing false def +/textshow { ExtendTextBox Gshow } def +% +% redundant definitions for compatibility with prologue.ps older than 5.0.2 +/LTB {BL [] LCb DL} def +/LTb {PL [] LCb DL} def +end +%%EndProlog +%%Page: 1 1 +gnudict begin +gsave +doclip +50 50 translate +0.050 0.050 scale +0 setgray +newpath +(Helvetica) findfont 140 scalefont setfont +BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {BackgroundColor C 1.000 0 0 7200.00 5040.00 BoxColFill} if +1.000 UL +LTb +LCb setrgbcolor +686 448 M +63 0 V +6198 0 R +-63 0 V +stroke +602 448 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 911 M +63 0 V +6198 0 R +-63 0 V +stroke +602 911 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 20)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 1375 M +63 0 V +6198 0 R +-63 0 V +stroke +602 1375 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 40)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 1838 M +63 0 V +6198 0 R +-63 0 V +stroke +602 1838 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 60)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 2302 M +63 0 V +6198 0 R +-63 0 V +stroke +602 2302 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 80)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 2765 M +63 0 V +6198 0 R +-63 0 V +stroke +602 2765 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 100)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 3229 M +63 0 V +6198 0 R +-63 0 V +stroke +602 3229 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 120)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 3692 M +63 0 V +6198 0 R +-63 0 V +stroke +602 3692 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 140)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 4156 M +63 0 V +6198 0 R +-63 0 V +stroke +602 4156 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 160)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 4619 M +63 0 V +6198 0 R +-63 0 V +stroke +602 4619 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 180)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 448 M +0 63 V +0 4108 R +0 -63 V +stroke +686 308 M +[ [(Helvetica) 140.0 0.0 true true 0 (-0.1)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +1938 448 M +0 63 V +0 4108 R +0 -63 V +stroke +1938 308 M +[ [(Helvetica) 140.0 0.0 true true 0 (-0.05)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +3190 448 M +0 63 V +0 4108 R +0 -63 V +stroke +3190 308 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +4443 448 M +0 63 V +0 4108 R +0 -63 V +stroke +4443 308 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0.05)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +5695 448 M +0 63 V +0 4108 R +0 -63 V +stroke +5695 308 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0.1)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +6947 448 M +0 63 V +0 4108 R +0 -63 V +stroke +6947 308 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0.15)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +1.000 UL +LTB +LCb setrgbcolor +686 4619 N +686 448 L +6261 0 V +0 4171 V +-6261 0 V +Z stroke +1.000 UP +1.000 UL +LTb +LCb setrgbcolor +LCb setrgbcolor +112 2533 M +currentpoint gsave translate -270 rotate 0 0 moveto +[ [(Helvetica) 140.0 0.0 true true 0 (frequency)] +] -46.7 MCshow +grestore +LTb +LCb setrgbcolor +3816 98 M +[ [(Helvetica) 140.0 0.0 true true 0 (x)] +] -46.7 MCshow +LTb +LCb setrgbcolor +3816 4829 M +[ [(Helvetica) 140.0 0.0 true true 0 (Histogram)] +] -46.7 MCshow +% Begin plot #1 +1.000 UL +LTb +LCb setrgbcolor +LCb setrgbcolor +6296 4486 M +[ [(Helvetica) 140.0 0.0 true true 0 (smooth frequency)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +6380 4451 N +399 0 V +0 70 V +-399 0 V +0 -70 V +Z stroke +811 448 N +0 371 V +251 0 V +0 -371 V +-251 0 V +Z stroke +1062 448 N +0 209 V +250 0 V +0 -209 V +-250 0 V +Z stroke +1312 448 N +0 301 V +251 0 V +0 -301 V +-251 0 V +Z stroke +1563 448 N +0 255 V +250 0 V +0 -255 V +-250 0 V +Z stroke +1813 448 N +0 116 V +250 0 V +0 -116 V +-250 0 V +Z stroke +2063 448 N +0 209 V +251 0 V +0 -209 V +-251 0 V +Z stroke +2314 448 N +0 487 V +250 0 V +0 -487 V +-250 0 V +Z stroke +2564 448 N +0 417 V +251 0 V +0 -417 V +-251 0 V +Z stroke +2815 448 N +0 602 V +250 0 V +0 -602 V +-250 0 V +Z stroke +3065 448 N +0 3754 V +251 0 V +0 -3754 V +-251 0 V +Z stroke +3316 448 N +0 742 V +250 0 V +0 -742 V +-250 0 V +Z stroke +3566 448 N +0 440 V +251 0 V +0 -440 V +-251 0 V +Z stroke +3817 448 N +0 417 V +250 0 V +0 -417 V +-250 0 V +Z stroke +4067 448 N +0 301 V +250 0 V +0 -301 V +-250 0 V +Z stroke +4317 448 N +0 324 V +251 0 V +0 -324 V +-251 0 V +Z stroke +4568 448 N +0 278 V +250 0 V +0 -278 V +-250 0 V +Z stroke +4818 448 N +0 348 V +251 0 V +0 -348 V +-251 0 V +Z stroke +5069 448 N +0 394 V +250 0 V +0 -394 V +-250 0 V +Z stroke +5319 448 N +0 348 V +251 0 V +0 -348 V +-251 0 V +Z stroke +5570 448 N +0 463 V +250 0 V +0 -463 V +-250 0 V +Z stroke +5820 448 N +0 834 V +125 0 V +0 -834 V +-125 0 V +Z stroke +% End plot #1 +2.000 UL +LTb +LCb setrgbcolor +1.000 UL +LTB +LCb setrgbcolor +686 4619 N +686 448 L +6261 0 V +0 4171 V +-6261 0 V +Z stroke +1.000 UP +1.000 UL +LTb +LCb setrgbcolor +stroke +grestore +end +showpage +%%Trailer +%%DocumentFonts: Helvetica diff --git a/spec/fixtures/plots/multtest_plot.eps b/spec/fixtures/plots/multtest_plot.eps new file mode 100644 index 0000000..7575c79 --- /dev/null +++ b/spec/fixtures/plots/multtest_plot.eps @@ -0,0 +1,857 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: spec/tmp/multtest_plot.eps +%%Creator: gnuplot 5.0 patchlevel 5 +%%CreationDate: Fri Nov 22 22:28:48 2019 +%%DocumentFonts: (atend) +%%BoundingBox: 50 50 410 302 +%%EndComments +%%BeginProlog +/gnudict 256 dict def +gnudict begin +% +% The following true/false flags may be edited by hand if desired. +% The unit line width and grayscale image gamma correction may also be changed. +% +/Color false def +/Blacktext false def +/Solid false def +/Dashlength 1 def +/Landscape false def +/Level1 false def +/Level3 false def +/Rounded false def +/ClipToBoundingBox false def +/SuppressPDFMark false def +/TransparentPatterns false def +/gnulinewidth 5.000 def +/userlinewidth gnulinewidth def +/Gamma 1.0 def +/BackgroundColor {-1.000 -1.000 -1.000} def +% +/vshift -46 def +/dl1 { + 10.0 Dashlength userlinewidth gnulinewidth div mul mul mul + Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if +} def +/dl2 { + 10.0 Dashlength userlinewidth gnulinewidth div mul mul mul + Rounded { currentlinewidth 0.75 mul add } if +} def +/hpt_ 31.5 def +/vpt_ 31.5 def +/hpt hpt_ def +/vpt vpt_ def +/doclip { + ClipToBoundingBox { + newpath 50 50 moveto 410 50 lineto 410 302 lineto 50 302 lineto closepath + clip + } if +} def +% +% Gnuplot Prolog Version 5.1 (Oct 2015) +% +%/SuppressPDFMark true def +% +/M {moveto} bind def +/L {lineto} bind def +/R {rmoveto} bind def +/V {rlineto} bind def +/N {newpath moveto} bind def +/Z {closepath} bind def +/C {setrgbcolor} bind def +/f {rlineto fill} bind def +/g {setgray} bind def +/Gshow {show} def % May be redefined later in the file to support UTF-8 +/vpt2 vpt 2 mul def +/hpt2 hpt 2 mul def +/Lshow {currentpoint stroke M 0 vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def + /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def +/DL {Color {setrgbcolor Solid {pop []} if 0 setdash} + {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def +/BL {stroke userlinewidth 2 mul setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +/AL {stroke userlinewidth 2 div setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +/UL {dup gnulinewidth mul /userlinewidth exch def + dup 1 lt {pop 1} if 10 mul /udl exch def} def +/PL {stroke userlinewidth setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +3.8 setmiterlimit +% Classic Line colors (version 5.0) +/LCw {1 1 1} def +/LCb {0 0 0} def +/LCa {0 0 0} def +/LC0 {1 0 0} def +/LC1 {0 1 0} def +/LC2 {0 0 1} def +/LC3 {1 0 1} def +/LC4 {0 1 1} def +/LC5 {1 1 0} def +/LC6 {0 0 0} def +/LC7 {1 0.3 0} def +/LC8 {0.5 0.5 0.5} def +% Default dash patterns (version 5.0) +/LTB {BL [] LCb DL} def +/LTw {PL [] 1 setgray} def +/LTb {PL [] LCb DL} def +/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def +/LT0 {PL [] LC0 DL} def +/LT1 {PL [2 dl1 3 dl2] LC1 DL} def +/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def +/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def +/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def +/LT5 {PL [4 dl1 2 dl2] LC5 DL} def +/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def +/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def +/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def +/SL {[] 0 setdash} def +/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def +/Dia {stroke [] 0 setdash 2 copy vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath stroke + Pnt} def +/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V + currentpoint stroke M + hpt neg vpt neg R hpt2 0 V stroke + } def +/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath stroke + Pnt} def +/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M + hpt2 vpt2 neg V currentpoint stroke M + hpt2 neg 0 R hpt2 vpt2 V stroke} def +/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath stroke + Pnt} def +/Star {2 copy Pls Crs} def +/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath fill} def +/TriUF {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath fill} def +/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath stroke + Pnt} def +/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath fill} def +/DiaF {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath fill} def +/Pent {stroke [] 0 setdash 2 copy gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath stroke grestore Pnt} def +/PentF {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath fill grestore} def +/Circle {stroke [] 0 setdash 2 copy + hpt 0 360 arc stroke Pnt} def +/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def +/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def +/C1 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc closepath fill + vpt 0 360 arc closepath} bind def +/C2 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C3 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C4 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 180 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C5 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc + 2 copy moveto + 2 copy vpt 180 270 arc closepath fill + vpt 0 360 arc} bind def +/C6 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C7 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C8 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 270 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C9 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 270 450 arc closepath fill + vpt 0 360 arc closepath} bind def +/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill + 2 copy moveto + 2 copy vpt 90 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C11 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 180 arc closepath fill + 2 copy moveto + 2 copy vpt 270 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C12 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 180 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C13 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc closepath fill + 2 copy moveto + 2 copy vpt 180 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C14 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 360 arc closepath fill + vpt 0 360 arc} bind def +/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto + neg 0 rlineto closepath} bind def +/Square {dup Rec} bind def +/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def +/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def +/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def +/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def +/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def +/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def +/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill + exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def +/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def +/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill + 2 copy vpt Square fill Bsquare} bind def +/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def +/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def +/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill + Bsquare} bind def +/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill + Bsquare} bind def +/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def +/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill + 2 copy vpt Square fill Bsquare} bind def +/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill + 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def +/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def +/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def +/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def +/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def +/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def +/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def +/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def +/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def +/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def +/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def +/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def +/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def +/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def +/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def +/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def +/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def +/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def +/DiaE {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath stroke} def +/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath stroke} def +/TriUE {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath stroke} def +/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath stroke} def +/PentE {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath stroke grestore} def +/CircE {stroke [] 0 setdash + hpt 0 360 arc stroke} def +/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def +/DiaW {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V Opaque stroke} def +/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V Opaque stroke} def +/TriUW {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V Opaque stroke} def +/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V Opaque stroke} def +/PentW {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + Opaque stroke grestore} def +/CircW {stroke [] 0 setdash + hpt 0 360 arc Opaque stroke} def +/BoxFill {gsave Rec 1 setgray fill grestore} def +/Density { + /Fillden exch def + currentrgbcolor + /ColB exch def /ColG exch def /ColR exch def + /ColR ColR Fillden mul Fillden sub 1 add def + /ColG ColG Fillden mul Fillden sub 1 add def + /ColB ColB Fillden mul Fillden sub 1 add def + ColR ColG ColB setrgbcolor} def +/BoxColFill {gsave Rec PolyFill} def +/PolyFill {gsave Density fill grestore grestore} def +/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def +% +% PostScript Level 1 Pattern Fill routine for rectangles +% Usage: x y w h s a XX PatternFill +% x,y = lower left corner of box to be filled +% w,h = width and height of box +% a = angle in degrees between lines and x-axis +% XX = 0/1 for no/yes cross-hatch +% +/PatternFill {gsave /PFa [ 9 2 roll ] def + PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate + PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec + TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse + clip + currentlinewidth 0.5 mul setlinewidth + /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def + 0 0 M PFa 5 get rotate PFs -2 div dup translate + 0 1 PFs PFa 4 get div 1 add floor cvi + {PFa 4 get mul 0 M 0 PFs V} for + 0 PFa 6 get ne { + 0 1 PFs PFa 4 get div 1 add floor cvi + {PFa 4 get mul 0 2 1 roll M PFs 0 V} for + } if + stroke grestore} def +% +/languagelevel where + {pop languagelevel} {1} ifelse +dup 2 lt + {/InterpretLevel1 true def + /InterpretLevel3 false def} + {/InterpretLevel1 Level1 def + 2 gt + {/InterpretLevel3 Level3 def} + {/InterpretLevel3 false def} + ifelse } + ifelse +% +% PostScript level 2 pattern fill definitions +% +/Level2PatternFill { +/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8} + bind def +/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} +>> matrix makepattern +/Pat1 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke + 0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke} +>> matrix makepattern +/Pat2 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L + 8 8 L 8 0 L 0 0 L fill} +>> matrix makepattern +/Pat3 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L + 0 12 M 12 0 L stroke} +>> matrix makepattern +/Pat4 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L + 0 -4 M 12 8 L stroke} +>> matrix makepattern +/Pat5 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L + 0 12 M 8 -4 L 4 12 M 10 0 L stroke} +>> matrix makepattern +/Pat6 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L + 0 -4 M 8 12 L 4 -4 M 10 8 L stroke} +>> matrix makepattern +/Pat7 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L + 12 0 M -4 8 L 12 4 M 0 10 L stroke} +>> matrix makepattern +/Pat8 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L + -4 0 M 12 8 L -4 4 M 8 10 L stroke} +>> matrix makepattern +/Pat9 exch def +/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def +/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def +/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def +/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def +/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def +/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def +/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def +} def +% +% +%End of PostScript Level 2 code +% +/PatternBgnd { + TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse +} def +% +% Substitute for Level 2 pattern fill codes with +% grayscale if Level 2 support is not selected. +% +/Level1PatternFill { +/Pattern1 {0.250 Density} bind def +/Pattern2 {0.500 Density} bind def +/Pattern3 {0.750 Density} bind def +/Pattern4 {0.125 Density} bind def +/Pattern5 {0.375 Density} bind def +/Pattern6 {0.625 Density} bind def +/Pattern7 {0.875 Density} bind def +} def +% +% Now test for support of Level 2 code +% +Level1 {Level1PatternFill} {Level2PatternFill} ifelse +% +/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont +dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall +currentdict end definefont pop +% +/MFshow { + { dup 5 get 3 ge + { 5 get 3 eq {gsave} {grestore} ifelse } + {dup dup 0 get findfont exch 1 get scalefont setfont + [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6 + get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq + {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5 + get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div + dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get + textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop + pop aload pop M} ifelse }ifelse }ifelse } + ifelse } + forall} def +/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def +/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse } + {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont + 6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def +/MLshow { currentpoint stroke M + 0 exch R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/MRshow { currentpoint stroke M + exch dup MFwidth neg 3 -1 roll R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/MCshow { currentpoint stroke M + exch dup MFwidth -2 div 3 -1 roll R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/XYsave { [( ) 1 2 true false 3 ()] } bind def +/XYrestore { [( ) 1 2 true false 4 ()] } bind def +Level1 SuppressPDFMark or +{} { +/SDict 10 dict def +systemdict /pdfmark known not { + userdict /pdfmark systemdict /cleartomark get put +} if +SDict begin [ + /Title (spec/tmp/multtest_plot.eps) + /Subject (gnuplot plot) + /Creator (gnuplot 5.0 patchlevel 5) +% /Producer (gnuplot) +% /Keywords () + /CreationDate (Fri Nov 22 22:28:48 2019) + /DOCINFO pdfmark +end +} ifelse +% +% Support for boxed text - Ethan A Merritt May 2005 +% +/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put + userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put + /Boxing true def } def +/ExtendTextBox { Boxing + { gsave dup false charpath pathbbox + dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse + dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse + dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse + dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse + grestore } if } def +/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M + TBx1 TBxmargin sub TBy2 TBymargin add L + TBx2 TBxmargin add TBy2 TBymargin add L + TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def +/DrawTextBox { PopTextBox stroke /Boxing false def} def +/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def +0 0 0 0 InitTextBox +/TBxmargin 20 def +/TBymargin 20 def +/Boxing false def +/textshow { ExtendTextBox Gshow } def +% +% redundant definitions for compatibility with prologue.ps older than 5.0.2 +/LTB {BL [] LCb DL} def +/LTb {PL [] LCb DL} def +end +%%EndProlog +%%Page: 1 1 +gnudict begin +gsave +doclip +50 50 translate +0.050 0.050 scale +0 setgray +newpath +(Helvetica) findfont 140 scalefont setfont +BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {BackgroundColor C 1.000 0 0 7200.00 5040.00 BoxColFill} if +1.000 UL +LTb +LCb setrgbcolor +686 448 M +63 0 V +6198 0 R +-63 0 V +stroke +602 448 M +[ [(Helvetica) 140.0 0.0 true true 0 (-20)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 1143 M +63 0 V +6198 0 R +-63 0 V +stroke +602 1143 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 1838 M +63 0 V +6198 0 R +-63 0 V +stroke +602 1838 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 20)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 2534 M +63 0 V +6198 0 R +-63 0 V +stroke +602 2534 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 40)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 3229 M +63 0 V +6198 0 R +-63 0 V +stroke +602 3229 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 60)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 3924 M +63 0 V +6198 0 R +-63 0 V +stroke +602 3924 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 80)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 4619 M +63 0 V +6198 0 R +-63 0 V +stroke +602 4619 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 100)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 448 M +0 63 V +0 4108 R +0 -63 V +stroke +686 308 M +[ [(Helvetica) 140.0 0.0 true true 0 (-10)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +2251 448 M +0 63 V +0 4108 R +0 -63 V +stroke +2251 308 M +[ [(Helvetica) 140.0 0.0 true true 0 (-5)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +3817 448 M +0 63 V +0 4108 R +0 -63 V +stroke +3817 308 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +5382 448 M +0 63 V +0 4108 R +0 -63 V +stroke +5382 308 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 5)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +6947 448 M +0 63 V +0 4108 R +0 -63 V +stroke +6947 308 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 10)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +1.000 UL +LTB +LCb setrgbcolor +686 4619 N +686 448 L +6261 0 V +0 4171 V +-6261 0 V +Z stroke +1.000 UP +1.000 UL +LTb +LCb setrgbcolor +LCb setrgbcolor +112 2533 M +currentpoint gsave translate -270 rotate 0 0 moveto +[ [(Helvetica) 140.0 0.0 true true 0 (x)] +] -46.7 MCshow +grestore +LTb +LCb setrgbcolor +3816 98 M +[ [(Helvetica) 140.0 0.0 true true 0 (sin\(x\))] +] -46.7 MCshow +LTb +LCb setrgbcolor +3816 4829 M +[ [(Helvetica) 140.0 0.0 true true 0 (Sin Wave Example)] +] -46.7 MCshow +% Begin plot #1 +4.000 UL +LTb +LCb setrgbcolor +LCb setrgbcolor +6296 4486 M +[ [(Helvetica) 140.0 0.0 true true 0 (String function)] +] -46.7 MRshow +4.000 UL +LTb +LCb setrgbcolor +6380 4486 M +399 0 V +686 1162 M +63 -6 V +63 -7 V +64 -7 V +63 -7 V +63 -6 V +63 -7 V +64 -5 V +63 -4 V +63 -3 V +63 -1 V +64 0 V +63 1 V +63 2 V +63 4 V +64 5 V +63 6 V +63 6 V +63 7 V +64 7 V +63 7 V +63 7 V +63 5 V +64 5 V +63 4 V +63 2 V +63 1 V +64 -1 V +63 -1 V +63 -4 V +63 -4 V +64 -5 V +63 -6 V +63 -7 V +63 -7 V +63 -7 V +64 -7 V +63 -6 V +63 -5 V +63 -4 V +64 -4 V +63 -1 V +63 -1 V +63 2 V +64 2 V +63 4 V +63 5 V +63 5 V +64 7 V +63 7 V +63 7 V +63 7 V +64 6 V +63 6 V +63 5 V +63 3 V +64 3 V +63 1 V +63 0 V +63 -2 V +64 -3 V +63 -4 V +63 -6 V +63 -6 V +64 -7 V +63 -6 V +63 -7 V +63 -7 V +63 -6 V +64 -6 V +63 -4 V +63 -3 V +63 -2 V +64 -1 V +63 1 V +63 3 V +63 3 V +64 5 V +63 6 V +63 6 V +63 7 V +64 7 V +63 7 V +63 6 V +63 6 V +64 5 V +63 4 V +63 3 V +63 1 V +64 0 V +63 -2 V +63 -3 V +63 -4 V +64 -5 V +63 -6 V +63 -7 V +63 -7 V +64 -7 V +63 -7 V +63 -6 V +% End plot #1 +% Begin plot #2 +1.000 UP +stroke +1.000 UL +LTb +LT1 +LCb setrgbcolor +LCb setrgbcolor +6296 4346 M +[ [(Helvetica) 140.0 0.0 true true 0 (Array data)] +] -46.7 MRshow +1.000 UP +1.000 UL +LTb +LT1 +LCb setrgbcolor +6380 4346 M +399 0 V +3817 1143 M +313 35 V +313 104 V +313 174 V +313 243 V +313 313 V +313 382 V +313 452 V +313 522 V +313 591 V +313 660 V +3817 1143 Pls +4130 1178 Pls +4443 1282 Pls +4756 1456 Pls +5069 1699 Pls +5382 2012 Pls +5695 2394 Pls +6008 2846 Pls +6321 3368 Pls +6634 3959 Pls +6947 4619 Pls +6579 4346 Pls +% End plot #2 +2.000 UL +LTb +LCb setrgbcolor +1.000 UL +LTB +LCb setrgbcolor +686 4619 N +686 448 L +6261 0 V +0 4171 V +-6261 0 V +Z stroke +1.000 UP +1.000 UL +LTb +LCb setrgbcolor +stroke +grestore +end +showpage +%%Trailer +%%DocumentFonts: Helvetica diff --git a/spec/fixtures/plots/sin_wave_plot.eps b/spec/fixtures/plots/sin_wave_plot.eps new file mode 100644 index 0000000..f30514a --- /dev/null +++ b/spec/fixtures/plots/sin_wave_plot.eps @@ -0,0 +1,862 @@ +%!PS-Adobe-2.0 EPSF-2.0 +%%Title: spec/tmp/sin_wave_plot.eps +%%Creator: gnuplot 5.0 patchlevel 5 +%%CreationDate: Fri Nov 22 22:30:52 2019 +%%DocumentFonts: (atend) +%%BoundingBox: 50 50 410 302 +%%EndComments +%%BeginProlog +/gnudict 256 dict def +gnudict begin +% +% The following true/false flags may be edited by hand if desired. +% The unit line width and grayscale image gamma correction may also be changed. +% +/Color false def +/Blacktext false def +/Solid false def +/Dashlength 1 def +/Landscape false def +/Level1 false def +/Level3 false def +/Rounded false def +/ClipToBoundingBox false def +/SuppressPDFMark false def +/TransparentPatterns false def +/gnulinewidth 5.000 def +/userlinewidth gnulinewidth def +/Gamma 1.0 def +/BackgroundColor {-1.000 -1.000 -1.000} def +% +/vshift -46 def +/dl1 { + 10.0 Dashlength userlinewidth gnulinewidth div mul mul mul + Rounded { currentlinewidth 0.75 mul sub dup 0 le { pop 0.01 } if } if +} def +/dl2 { + 10.0 Dashlength userlinewidth gnulinewidth div mul mul mul + Rounded { currentlinewidth 0.75 mul add } if +} def +/hpt_ 31.5 def +/vpt_ 31.5 def +/hpt hpt_ def +/vpt vpt_ def +/doclip { + ClipToBoundingBox { + newpath 50 50 moveto 410 50 lineto 410 302 lineto 50 302 lineto closepath + clip + } if +} def +% +% Gnuplot Prolog Version 5.1 (Oct 2015) +% +%/SuppressPDFMark true def +% +/M {moveto} bind def +/L {lineto} bind def +/R {rmoveto} bind def +/V {rlineto} bind def +/N {newpath moveto} bind def +/Z {closepath} bind def +/C {setrgbcolor} bind def +/f {rlineto fill} bind def +/g {setgray} bind def +/Gshow {show} def % May be redefined later in the file to support UTF-8 +/vpt2 vpt 2 mul def +/hpt2 hpt 2 mul def +/Lshow {currentpoint stroke M 0 vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/Rshow {currentpoint stroke M dup stringwidth pop neg vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/Cshow {currentpoint stroke M dup stringwidth pop -2 div vshift R + Blacktext {gsave 0 setgray textshow grestore} {textshow} ifelse} def +/UP {dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def + /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def} def +/DL {Color {setrgbcolor Solid {pop []} if 0 setdash} + {pop pop pop 0 setgray Solid {pop []} if 0 setdash} ifelse} def +/BL {stroke userlinewidth 2 mul setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +/AL {stroke userlinewidth 2 div setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +/UL {dup gnulinewidth mul /userlinewidth exch def + dup 1 lt {pop 1} if 10 mul /udl exch def} def +/PL {stroke userlinewidth setlinewidth + Rounded {1 setlinejoin 1 setlinecap} if} def +3.8 setmiterlimit +% Classic Line colors (version 5.0) +/LCw {1 1 1} def +/LCb {0 0 0} def +/LCa {0 0 0} def +/LC0 {1 0 0} def +/LC1 {0 1 0} def +/LC2 {0 0 1} def +/LC3 {1 0 1} def +/LC4 {0 1 1} def +/LC5 {1 1 0} def +/LC6 {0 0 0} def +/LC7 {1 0.3 0} def +/LC8 {0.5 0.5 0.5} def +% Default dash patterns (version 5.0) +/LTB {BL [] LCb DL} def +/LTw {PL [] 1 setgray} def +/LTb {PL [] LCb DL} def +/LTa {AL [1 udl mul 2 udl mul] 0 setdash LCa setrgbcolor} def +/LT0 {PL [] LC0 DL} def +/LT1 {PL [2 dl1 3 dl2] LC1 DL} def +/LT2 {PL [1 dl1 1.5 dl2] LC2 DL} def +/LT3 {PL [6 dl1 2 dl2 1 dl1 2 dl2] LC3 DL} def +/LT4 {PL [1 dl1 2 dl2 6 dl1 2 dl2 1 dl1 2 dl2] LC4 DL} def +/LT5 {PL [4 dl1 2 dl2] LC5 DL} def +/LT6 {PL [1.5 dl1 1.5 dl2 1.5 dl1 1.5 dl2 1.5 dl1 6 dl2] LC6 DL} def +/LT7 {PL [3 dl1 3 dl2 1 dl1 3 dl2] LC7 DL} def +/LT8 {PL [2 dl1 2 dl2 2 dl1 6 dl2] LC8 DL} def +/SL {[] 0 setdash} def +/Pnt {stroke [] 0 setdash gsave 1 setlinecap M 0 0 V stroke grestore} def +/Dia {stroke [] 0 setdash 2 copy vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath stroke + Pnt} def +/Pls {stroke [] 0 setdash vpt sub M 0 vpt2 V + currentpoint stroke M + hpt neg vpt neg R hpt2 0 V stroke + } def +/Box {stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath stroke + Pnt} def +/Crs {stroke [] 0 setdash exch hpt sub exch vpt add M + hpt2 vpt2 neg V currentpoint stroke M + hpt2 neg 0 R hpt2 vpt2 V stroke} def +/TriU {stroke [] 0 setdash 2 copy vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath stroke + Pnt} def +/Star {2 copy Pls Crs} def +/BoxF {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath fill} def +/TriUF {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath fill} def +/TriD {stroke [] 0 setdash 2 copy vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath stroke + Pnt} def +/TriDF {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath fill} def +/DiaF {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath fill} def +/Pent {stroke [] 0 setdash 2 copy gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath stroke grestore Pnt} def +/PentF {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath fill grestore} def +/Circle {stroke [] 0 setdash 2 copy + hpt 0 360 arc stroke Pnt} def +/CircleF {stroke [] 0 setdash hpt 0 360 arc fill} def +/C0 {BL [] 0 setdash 2 copy moveto vpt 90 450 arc} bind def +/C1 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc closepath fill + vpt 0 360 arc closepath} bind def +/C2 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C3 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C4 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 180 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C5 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc + 2 copy moveto + 2 copy vpt 180 270 arc closepath fill + vpt 0 360 arc} bind def +/C6 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C7 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 270 arc closepath fill + vpt 0 360 arc closepath} bind def +/C8 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 270 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C9 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 270 450 arc closepath fill + vpt 0 360 arc closepath} bind def +/C10 {BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill + 2 copy moveto + 2 copy vpt 90 180 arc closepath fill + vpt 0 360 arc closepath} bind def +/C11 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 180 arc closepath fill + 2 copy moveto + 2 copy vpt 270 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C12 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 180 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C13 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 0 90 arc closepath fill + 2 copy moveto + 2 copy vpt 180 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/C14 {BL [] 0 setdash 2 copy moveto + 2 copy vpt 90 360 arc closepath fill + vpt 0 360 arc} bind def +/C15 {BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill + vpt 0 360 arc closepath} bind def +/Rec {newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto + neg 0 rlineto closepath} bind def +/Square {dup Rec} bind def +/Bsquare {vpt sub exch vpt sub exch vpt2 Square} bind def +/S0 {BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare} bind def +/S1 {BL [] 0 setdash 2 copy vpt Square fill Bsquare} bind def +/S2 {BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def +/S3 {BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare} bind def +/S4 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def +/S5 {BL [] 0 setdash 2 copy 2 copy vpt Square fill + exch vpt sub exch vpt sub vpt Square fill Bsquare} bind def +/S6 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare} bind def +/S7 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill + 2 copy vpt Square fill Bsquare} bind def +/S8 {BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare} bind def +/S9 {BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare} bind def +/S10 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill + Bsquare} bind def +/S11 {BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill + Bsquare} bind def +/S12 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare} bind def +/S13 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill + 2 copy vpt Square fill Bsquare} bind def +/S14 {BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill + 2 copy exch vpt sub exch vpt Square fill Bsquare} bind def +/S15 {BL [] 0 setdash 2 copy Bsquare fill Bsquare} bind def +/D0 {gsave translate 45 rotate 0 0 S0 stroke grestore} bind def +/D1 {gsave translate 45 rotate 0 0 S1 stroke grestore} bind def +/D2 {gsave translate 45 rotate 0 0 S2 stroke grestore} bind def +/D3 {gsave translate 45 rotate 0 0 S3 stroke grestore} bind def +/D4 {gsave translate 45 rotate 0 0 S4 stroke grestore} bind def +/D5 {gsave translate 45 rotate 0 0 S5 stroke grestore} bind def +/D6 {gsave translate 45 rotate 0 0 S6 stroke grestore} bind def +/D7 {gsave translate 45 rotate 0 0 S7 stroke grestore} bind def +/D8 {gsave translate 45 rotate 0 0 S8 stroke grestore} bind def +/D9 {gsave translate 45 rotate 0 0 S9 stroke grestore} bind def +/D10 {gsave translate 45 rotate 0 0 S10 stroke grestore} bind def +/D11 {gsave translate 45 rotate 0 0 S11 stroke grestore} bind def +/D12 {gsave translate 45 rotate 0 0 S12 stroke grestore} bind def +/D13 {gsave translate 45 rotate 0 0 S13 stroke grestore} bind def +/D14 {gsave translate 45 rotate 0 0 S14 stroke grestore} bind def +/D15 {gsave translate 45 rotate 0 0 S15 stroke grestore} bind def +/DiaE {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V closepath stroke} def +/BoxE {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V closepath stroke} def +/TriUE {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V closepath stroke} def +/TriDE {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V closepath stroke} def +/PentE {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + closepath stroke grestore} def +/CircE {stroke [] 0 setdash + hpt 0 360 arc stroke} def +/Opaque {gsave closepath 1 setgray fill grestore 0 setgray closepath} def +/DiaW {stroke [] 0 setdash vpt add M + hpt neg vpt neg V hpt vpt neg V + hpt vpt V hpt neg vpt V Opaque stroke} def +/BoxW {stroke [] 0 setdash exch hpt sub exch vpt add M + 0 vpt2 neg V hpt2 0 V 0 vpt2 V + hpt2 neg 0 V Opaque stroke} def +/TriUW {stroke [] 0 setdash vpt 1.12 mul add M + hpt neg vpt -1.62 mul V + hpt 2 mul 0 V + hpt neg vpt 1.62 mul V Opaque stroke} def +/TriDW {stroke [] 0 setdash vpt 1.12 mul sub M + hpt neg vpt 1.62 mul V + hpt 2 mul 0 V + hpt neg vpt -1.62 mul V Opaque stroke} def +/PentW {stroke [] 0 setdash gsave + translate 0 hpt M 4 {72 rotate 0 hpt L} repeat + Opaque stroke grestore} def +/CircW {stroke [] 0 setdash + hpt 0 360 arc Opaque stroke} def +/BoxFill {gsave Rec 1 setgray fill grestore} def +/Density { + /Fillden exch def + currentrgbcolor + /ColB exch def /ColG exch def /ColR exch def + /ColR ColR Fillden mul Fillden sub 1 add def + /ColG ColG Fillden mul Fillden sub 1 add def + /ColB ColB Fillden mul Fillden sub 1 add def + ColR ColG ColB setrgbcolor} def +/BoxColFill {gsave Rec PolyFill} def +/PolyFill {gsave Density fill grestore grestore} def +/h {rlineto rlineto rlineto gsave closepath fill grestore} bind def +% +% PostScript Level 1 Pattern Fill routine for rectangles +% Usage: x y w h s a XX PatternFill +% x,y = lower left corner of box to be filled +% w,h = width and height of box +% a = angle in degrees between lines and x-axis +% XX = 0/1 for no/yes cross-hatch +% +/PatternFill {gsave /PFa [ 9 2 roll ] def + PFa 0 get PFa 2 get 2 div add PFa 1 get PFa 3 get 2 div add translate + PFa 2 get -2 div PFa 3 get -2 div PFa 2 get PFa 3 get Rec + TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse + clip + currentlinewidth 0.5 mul setlinewidth + /PFs PFa 2 get dup mul PFa 3 get dup mul add sqrt def + 0 0 M PFa 5 get rotate PFs -2 div dup translate + 0 1 PFs PFa 4 get div 1 add floor cvi + {PFa 4 get mul 0 M 0 PFs V} for + 0 PFa 6 get ne { + 0 1 PFs PFa 4 get div 1 add floor cvi + {PFa 4 get mul 0 2 1 roll M PFs 0 V} for + } if + stroke grestore} def +% +/languagelevel where + {pop languagelevel} {1} ifelse +dup 2 lt + {/InterpretLevel1 true def + /InterpretLevel3 false def} + {/InterpretLevel1 Level1 def + 2 gt + {/InterpretLevel3 Level3 def} + {/InterpretLevel3 false def} + ifelse } + ifelse +% +% PostScript level 2 pattern fill definitions +% +/Level2PatternFill { +/Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /YStep 8} + bind def +/KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke} +>> matrix makepattern +/Pat1 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke + 0 4 M 4 8 L 8 4 L 4 0 L 0 4 L stroke} +>> matrix makepattern +/Pat2 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 0 M 0 8 L + 8 8 L 8 0 L 0 0 L fill} +>> matrix makepattern +/Pat3 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -4 8 M 8 -4 L + 0 12 M 12 0 L stroke} +>> matrix makepattern +/Pat4 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -4 0 M 8 12 L + 0 -4 M 12 8 L stroke} +>> matrix makepattern +/Pat5 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -2 8 M 4 -4 L + 0 12 M 8 -4 L 4 12 M 10 0 L stroke} +>> matrix makepattern +/Pat6 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop -2 0 M 4 12 L + 0 -4 M 8 12 L 4 -4 M 10 8 L stroke} +>> matrix makepattern +/Pat7 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 8 -2 M -4 4 L + 12 0 M -4 8 L 12 4 M 0 10 L stroke} +>> matrix makepattern +/Pat8 exch def +<< Tile8x8 + /PaintProc {0.5 setlinewidth pop 0 -2 M 12 4 L + -4 0 M 12 8 L -4 4 M 8 10 L stroke} +>> matrix makepattern +/Pat9 exch def +/Pattern1 {PatternBgnd KeepColor Pat1 setpattern} bind def +/Pattern2 {PatternBgnd KeepColor Pat2 setpattern} bind def +/Pattern3 {PatternBgnd KeepColor Pat3 setpattern} bind def +/Pattern4 {PatternBgnd KeepColor Landscape {Pat5} {Pat4} ifelse setpattern} bind def +/Pattern5 {PatternBgnd KeepColor Landscape {Pat4} {Pat5} ifelse setpattern} bind def +/Pattern6 {PatternBgnd KeepColor Landscape {Pat9} {Pat6} ifelse setpattern} bind def +/Pattern7 {PatternBgnd KeepColor Landscape {Pat8} {Pat7} ifelse setpattern} bind def +} def +% +% +%End of PostScript Level 2 code +% +/PatternBgnd { + TransparentPatterns {} {gsave 1 setgray fill grestore} ifelse +} def +% +% Substitute for Level 2 pattern fill codes with +% grayscale if Level 2 support is not selected. +% +/Level1PatternFill { +/Pattern1 {0.250 Density} bind def +/Pattern2 {0.500 Density} bind def +/Pattern3 {0.750 Density} bind def +/Pattern4 {0.125 Density} bind def +/Pattern5 {0.375 Density} bind def +/Pattern6 {0.625 Density} bind def +/Pattern7 {0.875 Density} bind def +} def +% +% Now test for support of Level 2 code +% +Level1 {Level1PatternFill} {Level2PatternFill} ifelse +% +/Symbol-Oblique /Symbol findfont [1 0 .167 1 0 0] makefont +dup length dict begin {1 index /FID eq {pop pop} {def} ifelse} forall +currentdict end definefont pop +% +/MFshow { + { dup 5 get 3 ge + { 5 get 3 eq {gsave} {grestore} ifelse } + {dup dup 0 get findfont exch 1 get scalefont setfont + [ currentpoint ] exch dup 2 get 0 exch R dup 5 get 2 ne {dup dup 6 + get exch 4 get {textshow} {stringwidth pop 0 R} ifelse }if dup 5 get 0 eq + {dup 3 get {2 get neg 0 exch R pop} {pop aload pop M} ifelse} {dup 5 + get 1 eq {dup 2 get exch dup 3 get exch 6 get stringwidth pop -2 div + dup 0 R} {dup 6 get stringwidth pop -2 div 0 R 6 get + textshow 2 index {aload pop M neg 3 -1 roll neg R pop pop} {pop pop pop + pop aload pop M} ifelse }ifelse }ifelse } + ifelse } + forall} def +/Gswidth {dup type /stringtype eq {stringwidth} {pop (n) stringwidth} ifelse} def +/MFwidth {0 exch { dup 5 get 3 ge { 5 get 3 eq { 0 } { pop } ifelse } + {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont + 6 get Gswidth pop add} {pop} ifelse} ifelse} forall} def +/MLshow { currentpoint stroke M + 0 exch R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/MRshow { currentpoint stroke M + exch dup MFwidth neg 3 -1 roll R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/MCshow { currentpoint stroke M + exch dup MFwidth -2 div 3 -1 roll R + Blacktext {gsave 0 setgray MFshow grestore} {MFshow} ifelse } bind def +/XYsave { [( ) 1 2 true false 3 ()] } bind def +/XYrestore { [( ) 1 2 true false 4 ()] } bind def +Level1 SuppressPDFMark or +{} { +/SDict 10 dict def +systemdict /pdfmark known not { + userdict /pdfmark systemdict /cleartomark get put +} if +SDict begin [ + /Title (spec/tmp/sin_wave_plot.eps) + /Subject (gnuplot plot) + /Creator (gnuplot 5.0 patchlevel 5) +% /Producer (gnuplot) +% /Keywords () + /CreationDate (Fri Nov 22 22:30:52 2019) + /DOCINFO pdfmark +end +} ifelse +% +% Support for boxed text - Ethan A Merritt May 2005 +% +/InitTextBox { userdict /TBy2 3 -1 roll put userdict /TBx2 3 -1 roll put + userdict /TBy1 3 -1 roll put userdict /TBx1 3 -1 roll put + /Boxing true def } def +/ExtendTextBox { Boxing + { gsave dup false charpath pathbbox + dup TBy2 gt {userdict /TBy2 3 -1 roll put} {pop} ifelse + dup TBx2 gt {userdict /TBx2 3 -1 roll put} {pop} ifelse + dup TBy1 lt {userdict /TBy1 3 -1 roll put} {pop} ifelse + dup TBx1 lt {userdict /TBx1 3 -1 roll put} {pop} ifelse + grestore } if } def +/PopTextBox { newpath TBx1 TBxmargin sub TBy1 TBymargin sub M + TBx1 TBxmargin sub TBy2 TBymargin add L + TBx2 TBxmargin add TBy2 TBymargin add L + TBx2 TBxmargin add TBy1 TBymargin sub L closepath } def +/DrawTextBox { PopTextBox stroke /Boxing false def} def +/FillTextBox { gsave PopTextBox 1 1 1 setrgbcolor fill grestore /Boxing false def} def +0 0 0 0 InitTextBox +/TBxmargin 20 def +/TBymargin 20 def +/Boxing false def +/textshow { ExtendTextBox Gshow } def +% +% redundant definitions for compatibility with prologue.ps older than 5.0.2 +/LTB {BL [] LCb DL} def +/LTb {PL [] LCb DL} def +end +%%EndProlog +%%Page: 1 1 +gnudict begin +gsave +doclip +50 50 translate +0.050 0.050 scale +0 setgray +newpath +(Helvetica) findfont 140 scalefont setfont +BackgroundColor 0 lt 3 1 roll 0 lt exch 0 lt or or not {BackgroundColor C 1.000 0 0 7200.00 5040.00 BoxColFill} if +/Helvetica findfont 140 scalefont setfont +/vshift -46 def +1.000 UL +LTb +LCb setrgbcolor +686 448 M +63 0 V +6198 0 R +-63 0 V +stroke +602 448 M +[ [(Helvetica) 140.0 0.0 true true 0 (-1)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 865 M +63 0 V +6198 0 R +-63 0 V +stroke +602 865 M +[ [(Helvetica) 140.0 0.0 true true 0 (-0.8)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 1282 M +63 0 V +6198 0 R +-63 0 V +stroke +602 1282 M +[ [(Helvetica) 140.0 0.0 true true 0 (-0.6)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 1699 M +63 0 V +6198 0 R +-63 0 V +stroke +602 1699 M +[ [(Helvetica) 140.0 0.0 true true 0 (-0.4)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 2116 M +63 0 V +6198 0 R +-63 0 V +stroke +602 2116 M +[ [(Helvetica) 140.0 0.0 true true 0 (-0.2)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 2534 M +63 0 V +6198 0 R +-63 0 V +stroke +602 2534 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 2951 M +63 0 V +6198 0 R +-63 0 V +stroke +602 2951 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0.2)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 3368 M +63 0 V +6198 0 R +-63 0 V +stroke +602 3368 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0.4)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 3785 M +63 0 V +6198 0 R +-63 0 V +stroke +602 3785 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0.6)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 4202 M +63 0 V +6198 0 R +-63 0 V +stroke +602 4202 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0.8)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 4619 M +63 0 V +6198 0 R +-63 0 V +stroke +602 4619 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 1)] +] -46.7 MRshow +1.000 UL +LTb +LCb setrgbcolor +686 448 M +0 63 V +0 4108 R +0 -63 V +stroke +686 308 M +[ [(Helvetica) 140.0 0.0 true true 0 (-10)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +2251 448 M +0 63 V +0 4108 R +0 -63 V +stroke +2251 308 M +[ [(Helvetica) 140.0 0.0 true true 0 (-5)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +3817 448 M +0 63 V +0 4108 R +0 -63 V +stroke +3817 308 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 0)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +5382 448 M +0 63 V +0 4108 R +0 -63 V +stroke +5382 308 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 5)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +6947 448 M +0 63 V +0 4108 R +0 -63 V +stroke +6947 308 M +[ [(Helvetica) 140.0 0.0 true true 0 ( 10)] +] -46.7 MCshow +1.000 UL +LTb +LCb setrgbcolor +1.000 UL +LTB +LCb setrgbcolor +686 4619 N +686 448 L +6261 0 V +0 4171 V +-6261 0 V +Z stroke +1.000 UP +1.000 UL +LTb +LCb setrgbcolor +LCb setrgbcolor +112 2533 M +currentpoint gsave translate -270 rotate 0 0 moveto +[ [(Helvetica) 140.0 0.0 true true 0 (x)] +] -46.7 MCshow +grestore +LTb +LCb setrgbcolor +3816 98 M +[ [(Helvetica) 140.0 0.0 true true 0 (sin\(x\))] +] -46.7 MCshow +LTb +LCb setrgbcolor +3816 4829 M +[ [(Helvetica) 140.0 0.0 true true 0 (Sin Wave Example)] +] -46.7 MCshow +% Begin plot #1 +4.000 UL +LTb +LCb setrgbcolor +/Helvetica findfont 140 scalefont setfont +LCb setrgbcolor +6296 4486 M +(sin\(x\)) Rshow +4.000 UL +LTb +LCb setrgbcolor +6380 4486 M +399 0 V +686 3668 M +63 -374 V +63 -405 V +64 -420 V +63 -417 V +63 -397 V +63 -362 V +64 -311 V +63 -248 V +63 -175 V +63 -95 V +64 -10 V +63 74 V +63 156 V +63 231 V +64 297 V +63 350 V +63 390 V +63 414 V +64 420 V +63 411 V +63 383 V +63 341 V +64 284 V +63 216 V +63 140 V +63 57 V +64 -28 V +63 -111 V +63 -191 V +63 -262 V +64 -322 V +63 -370 V +63 -403 V +63 -419 V +63 -418 V +64 -400 V +63 -366 V +63 -317 V +63 -255 V +64 -183 V +63 -103 V +63 -19 V +63 66 V +64 147 V +63 224 V +63 291 V +63 345 V +64 387 V +63 412 V +63 421 V +63 412 V +64 387 V +63 345 V +63 291 V +63 224 V +64 147 V +63 66 V +63 -19 V +63 -103 V +64 -183 V +63 -255 V +63 -317 V +63 -366 V +64 -400 V +63 -418 V +63 -419 V +63 -403 V +63 -370 V +64 -322 V +63 -262 V +63 -191 V +63 -111 V +64 -28 V +63 57 V +63 140 V +63 216 V +64 284 V +63 341 V +63 383 V +63 411 V +64 420 V +63 414 V +63 390 V +63 350 V +64 297 V +63 231 V +63 156 V +63 74 V +64 -10 V +63 -95 V +63 -175 V +63 -248 V +64 -311 V +63 -362 V +63 -397 V +63 -417 V +64 -420 V +63 -405 V +63 -374 V +% End plot #1 +stroke +2.000 UL +LTb +LCb setrgbcolor +1.000 UL +LTB +LCb setrgbcolor +686 4619 N +686 448 L +6261 0 V +0 4171 V +-6261 0 V +Z stroke +1.000 UP +1.000 UL +LTb +LCb setrgbcolor +stroke +grestore +end +showpage +%%Trailer +%%DocumentFonts: Helvetica diff --git a/spec/integration/arrtest_spec.rb b/spec/integration/arrtest_spec.rb new file mode 100644 index 0000000..49485f4 --- /dev/null +++ b/spec/integration/arrtest_spec.rb @@ -0,0 +1,42 @@ +describe "Array Plot Example" do + let(:file_path) { 'spec/tmp/array_plot.eps' } + let(:fixture_path) { 'spec/fixtures/plots/array_plot.eps' } + + let(:file_content) do + File.read(file_path).gsub(/CreationDate.*/, "") + end + + let(:fixture_content) do + File.read(fixture_path).gsub(/CreationDate.*/, "") + end + + before do + path = file_path + + Gnuplot.open do |gp| + Gnuplot::Plot.new( gp ) do |plot| + plot.title "Array Plot Example" + plot.ylabel "x" + plot.xlabel "x^2" + plot.term "postscript eps" + plot.output path + + x = (0..50).collect(&:to_f) + y = x.collect { |v| v**2 } + + plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds| + ds.with = "linespoints" + ds.notitle + end + end + end + end + + after do + File.delete(file_path) + end + + it "plots expected file" do + expect(file_content).to eq(fixture_content) + end +end diff --git a/spec/integration/histtest_spec.rb b/spec/integration/histtest_spec.rb new file mode 100644 index 0000000..7301023 --- /dev/null +++ b/spec/integration/histtest_spec.rb @@ -0,0 +1,49 @@ +describe "Histogram Plot Example" do + let(:file_path) { 'spec/tmp/histogram_plot.eps' } + let(:fixture_path) { 'spec/fixtures/plots/histogram_plot.eps' } + + let(:file_content) do + File.read(file_path).gsub(/CreationDate.*/, "") + end + + let(:fixture_content) do + File.read(fixture_path).gsub(/CreationDate.*/, "") + end + + before do + path = file_path + RandomGenerator.seed(0.17) + + collection = (0..500).collect do + (RandomGenerator.rand - 0.5)**3 + end + + Gnuplot.open do |gp| + gp << "bin(x, s) = s*int(x/s)\n" + + Gnuplot::Plot.new( gp ) do |plot| + plot.title "Histogram" + plot.xlabel "x" + plot.ylabel "frequency" + + plot.data << Gnuplot::DataSet.new( [collection] ) do |ds| + ds.title = "smooth frequency" + ds.using = "(bin($1,.01)):(1.)" + ds.smooth = "freq" + ds.with = "boxes" + end + + plot.term "postscript eps" + plot.output path + end + end + end + + after do + File.delete(file_path) + end + + it "plots expected file" do + expect(file_content).to eq(fixture_content) + end +end diff --git a/spec/integration/multtest_spec.rb b/spec/integration/multtest_spec.rb new file mode 100644 index 0000000..3da4043 --- /dev/null +++ b/spec/integration/multtest_spec.rb @@ -0,0 +1,52 @@ +describe "Multtest Plot Example" do + let(:file_path) { 'spec/tmp/multtest_plot.eps' } + let(:fixture_path) { 'spec/fixtures/plots/multtest_plot.eps' } + + let(:file_content) do + File.read(file_path).gsub(/CreationDate.*/, "") + end + + let(:fixture_content) do + File.read(fixture_path).gsub(/CreationDate.*/, "") + end + + before do + path = file_path + + Gnuplot.open do |gp| + Gnuplot::Plot.new( gp ) do |plot| + plot.xrange "[-10:10]" + plot.title "Sin Wave Example" + plot.ylabel "x" + plot.xlabel "sin(x)" + + plot.term "postscript eps" + plot.output path + + x = (0..50).collect(&:to_f) + y = x.collect { |v| v**2 } + + plot.data = [ + Gnuplot::DataSet.new( "sin(x)" ) do |ds| + ds.with = "lines" + ds.title = "String function" + ds.linewidth = 4 + end, + + Gnuplot::DataSet.new( [x, y] ) do |ds| + ds.with = "linespoints" + ds.title = "Array data" + end + ] + end + end + end + + after do + File.delete(file_path) + end + + it "plots expected file" do + expect(file_content).to eq(fixture_content) + end +end diff --git a/spec/integration/sinwave_spec.rb b/spec/integration/sinwave_spec.rb new file mode 100644 index 0000000..c27e7f5 --- /dev/null +++ b/spec/integration/sinwave_spec.rb @@ -0,0 +1,41 @@ +describe "Sin Wave Plot Example" do + let(:file_path) { 'spec/tmp/sin_wave_plot.eps' } + let(:fixture_path) { 'spec/fixtures/plots/sin_wave_plot.eps' } + + let(:file_content) do + File.read(file_path).gsub(/CreationDate.*/, "") + end + + let(:fixture_content) do + File.read(fixture_path).gsub(/CreationDate.*/, "") + end + + before do + path = file_path + + Gnuplot.open do |gp| + Gnuplot::Plot.new( gp ) do |plot| + plot.xrange "[-10:10]" + plot.title "Sin Wave Example" + plot.ylabel "x" + plot.xlabel "sin(x)" + + plot.term "postscript eps" + plot.output path + + plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds| + ds.with = "lines" + ds.linewidth = 4 + end + end + end + end + + after do + File.delete(file_path) + end + + it "plots expected file" do + expect(file_content).to eq(fixture_content) + end +end diff --git a/spec/lib/ruby_gnuplot/data_set_spec.rb b/spec/lib/ruby_gnuplot/data_set_spec.rb new file mode 100644 index 0000000..efb96f8 --- /dev/null +++ b/spec/lib/ruby_gnuplot/data_set_spec.rb @@ -0,0 +1,89 @@ +require 'spec_helper' + +describe Gnuplot::DataSet do + subject(:data_set) { described_class.new(data) } + + let(:data) { nil } + + describe '#to_gplot' do + context 'when data is an empty array' do + let(:data) { [] } + + it do + expect(data_set.to_gplot).to eq('') + end + end + + context 'when data is an array of numbers' do + let(:data) { [1, 10.0, 2.3] } + + it 'converts to gplot format' do + expect(data_set.to_gplot).to eq("1\n10.0\n2.3") + end + end + + context 'when data is a matrix of numbers' do + let(:data) { [[1, 10.0], [0, 2]] } + + it 'converts to gplot matrix format' do + expect(data_set.to_gplot).to eq("1 0\n10.0 2\ne") + end + end + + context 'when data is a string' do + let(:data) { 'x' } + + it do + expect(data_set.to_gplot).to be_nil + end + end + + context 'when data is an instance of Matrix' do + xit 'to be implemented' + end + + context 'when data is nil' do + it do + expect(data_set.to_gplot).to be_nil + end + + it 'assigns data' do + expect(data_set.data).to eq(data) + end + end + + context 'when setting attributes in a block' do + subject(:data_set) do + described_class.new do |ds| + ds.with = 'lines' + ds.using = '1:2' + ds.data = [ [0, 1, 2], [1, 2, 5] ] + end + end + + it 'returns only the data' do + expect(data_set.to_gplot) + .to eq("0 1\n1 2\n2 5\ne") + end + end + end + + describe '#plot_args' do + context 'when setting attributes on initialize block' do + subject(:data_set) do + described_class.new do |ds| + ds.with = 'lines' + ds.using = '1:2' + ds.data = data + end + end + + let(:data) { [ [0, 1, 2], [1, 2, 5] ] } + + it 'returns plot attributes' do + expect(data_set.plot_args) + .to eq("'-' using 1:2 with lines") + end + end + end +end diff --git a/spec/lib/ruby_gnuplot/plot/style_spec.rb b/spec/lib/ruby_gnuplot/plot/style_spec.rb new file mode 100644 index 0000000..b80f845 --- /dev/null +++ b/spec/lib/ruby_gnuplot/plot/style_spec.rb @@ -0,0 +1,66 @@ +describe Gnuplot::Plot::Style do + subject(:style) { described_class.new } + + let(:index) { style.index } + + describe '#to_s' do + context "when nothing has been set" do + it 'creates an empty style' do + expect(style.to_s).to eq("set style line #{index}") + end + end + + context 'when setting the stype' do + before do + style.ls = 1 + style.lw = 2 + style.lc = 3 + style.pt = 4 + style.ps = 5 + style.fs = 6 + end + + it 'creates and indexes the style' do + expect(style.to_s).to eq( + "set style line #{index} ls 1 lw 2 lc 3 pt 4 ps 5 fs 6" + ) + end + end + + context 'when setting the stype on initialize' do + subject(:style) do + described_class.new do |style| + style.ls = 1 + style.lw = 2 + style.lc = 3 + style.pt = 4 + style.ps = 5 + style.fs = 6 + end + end + + it 'creates and indexes the style' do + expect(style.to_s).to eq( + "set style line #{index} ls 1 lw 2 lc 3 pt 4 ps 5 fs 6" + ) + end + end + + context 'when setting using the full method name' do + before do + style.linestyle = 1 + style.linewidth = 2 + style.linecolor = 3 + style.pointtype = 4 + style.pointsize = 5 + style.fill = 6 + end + + it 'creates and indexes the style' do + expect(style.to_s).to eq( + "set style line #{index} ls 1 lw 2 lc 3 pt 4 ps 5 fs 6" + ) + end + end + end +end diff --git a/spec/lib/ruby_gnuplot/plot_spec.rb b/spec/lib/ruby_gnuplot/plot_spec.rb new file mode 100644 index 0000000..49e4279 --- /dev/null +++ b/spec/lib/ruby_gnuplot/plot_spec.rb @@ -0,0 +1,216 @@ +shared_examples 'quotes value when setting in a plot for' do |field| + describe "##{field}" do + before do + plot.public_send(field, 'text') + end + + let(:expected_settings) do + [ + [:set, field.to_s, '"text"'], + [:set, field.to_s, '"new text"'] + ] + end + + it 'quotes value when setting it' do + expect(plot.to_gplot).to eq("set #{field} \"text\"\n") + end + + it 'enquees into settings' do + expect { plot.public_send(field, 'new text') } + .to change(plot, :settings) + .from([[:set, field.to_s, '"text"']]) + .to(expected_settings) + end + end +end + +describe Gnuplot::Plot do + subject(:plot) { described_class.new } + + describe '#to_gplot' do + let(:expected_string) do + [ + 'set title "Array Plot Example"', + 'set ylabel "x"', + 'set xlabel "x^2"', + 'set term postscript eps', + 'set output "file.eps"', + '' + ].join("\n") + end + + context 'when nothing has been set' do + it "returns an empty string" do + expect(plot.to_gplot).to eq('') + end + end + + context 'when titles and labels have been set' do + before do + plot.title "Array Plot Example" + plot.ylabel "x" + plot.xlabel "x^2" + plot.term "postscript eps" + plot.output "file.eps" + end + + it "wraps strings with quotes when needed" do + expect(plot.to_gplot).to eq(expected_string) + end + end + + context 'when variables are set throgh set call' do + before do + plot.set "title", "Array Plot Example" + plot.set "ylabel", "x" + plot.set "xlabel", "x^2" + plot.set "term", "postscript eps" + plot.set "output", "file.eps" + end + + it "wraps strings with quotes when needed" do + expect(plot.to_gplot).to eq(expected_string) + end + end + + context "when setting from inside initialization" do + subject(:plot) do + described_class.new do |p| + p.title "Array Plot Example" + p.ylabel "x" + p.xlabel "x^2" + p.term "postscript eps" + p.output "file.eps" + end + end + + it "wraps strings with quotes when needed" do + expect(plot.to_gplot).to eq(expected_string) + end + end + end + + it_behaves_like 'quotes value when setting in a plot for', :title + it_behaves_like 'quotes value when setting in a plot for', :output + it_behaves_like 'quotes value when setting in a plot for', :xlabel + it_behaves_like 'quotes value when setting in a plot for', :x2label + it_behaves_like 'quotes value when setting in a plot for', :ylabel + it_behaves_like 'quotes value when setting in a plot for', :y2label + it_behaves_like 'quotes value when setting in a plot for', :clabel + it_behaves_like 'quotes value when setting in a plot for', :cblabel + it_behaves_like 'quotes value when setting in a plot for', :zlabel + + describe '#unset' do + let(:expected_string) do + [ + 'set title "My Title"', + 'unset title', + '' + ].join("\n") + end + + before do + plot.title 'My Title' + end + + it 'changes value in current settings' do + expect { plot.unset 'title' } + .to change { plot['title'] } + .from('"My Title"').to(nil) + end + + it 'unsets key on output' do + plot.unset 'title' + expect(plot.to_gplot).to eq(expected_string) + end + end + + describe '#[]' do + context 'when value was never set' do + it { expect(plot['key']).to be_nil } + end + + context 'when value was only unset' do + before { plot.unset 'title' } + + it { expect(plot['title']).to be_nil } + end + + context 'when value was set only once' do + before { plot.title "My Title" } + + it "returns the value to be used (quoted when needed)" do + expect(plot['title']).to eq('"My Title"') + end + end + + context 'when value was set twice' do + before do + plot.title "My Title" + plot.title "My New Title" + end + + it "returns the last value set" do + expect(plot['title']).to eq('"My New Title"') + end + end + + context 'when value was set then unset' do + before do + plot.title "My Title" + plot.unset "title" + end + + it { expect(plot['title']).to be_nil } + end + + context 'when value was set, unset and set again' do + before do + plot.title "My Title" + plot.unset "title" + plot.title "My New Title" + end + + it "returns the last value set" do + expect(plot['title']).to eq('"My New Title"') + end + end + end + + describe 'method missing' do + it 'delegates to set call' do + expect { plot.fake_field('value') } + .to change(plot, :settings) + .from([]) + .to([[:set, 'fake_field', 'value']]) + end + + context 'when field should be quoted' do + it 'delegates to set call and quote it' do + expect { plot.output('value') } + .to change(plot, :settings) + .from([]) + .to([[:set, 'output', '"value"']]) + end + end + end + + describe '#style' do + subject(:plot) do + described_class.new do |p| + p.title 'My title' + p.style do |style| + style.ls = 1 + end + end + end + + let(:expected_output) do + /^set title "My title"\nset style line \d+ ls 1\n$/ + end + + it 'adds style to gplot output' do + expect(plot.to_gplot).to match(expected_output) + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..e2940fd --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,109 @@ +# This file was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +require 'simplecov' +SimpleCov.start do + add_filter '/spec/' +end + +require "gnuplot" + +support_files = File.expand_path('spec/support/**/*.rb') + +Dir[support_files].sort.each { |file| require file } + +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + + # This option will default to `:apply_to_host_groups` in RSpec 4 (and will + # have no way to turn it off -- the option exists only for backwards + # compatibility in RSpec 3). It causes shared context metadata to be + # inherited by the metadata hash of host groups and examples, rather than + # triggering implicit auto-inclusion in groups with matching metadata. + config.shared_context_metadata_behavior = :apply_to_host_groups + + # The settings below are suggested to provide a good initial experience + # with RSpec, but feel free to customize to your heart's content. + # # This allows you to limit a spec run to individual examples or groups + # # you care about by tagging them with `:focus` metadata. When nothing + # # is tagged with `:focus`, all examples get run. RSpec also provides + # # aliases for `it`, `describe`, and `context` that include `:focus` + # # metadata: `fit`, `fdescribe` and `fcontext`, respectively. + # config.filter_run_when_matching :focus + # + # # Allows RSpec to persist some state between runs in order to support + # # the `--only-failures` and `--next-failure` CLI options. We recommend + # # you configure your source control system to ignore this file. + # config.example_status_persistence_file_path = "spec/examples.txt" + # + # # Limits the available syntax to the non-monkey patched syntax that is + # # recommended. For more details, see: + # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ + # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + # config.disable_monkey_patching! + # + # # This setting enables warnings. It's recommended, but in some cases may + # # be too noisy due to issues in dependencies. + # config.warnings = true + # + # # Many RSpec users commonly either run the entire suite or an individual + # # file, and it's useful to allow more verbose output when running an + # # individual spec file. + # if config.files_to_run.one? + # # Use the documentation formatter for detailed output, + # # unless a formatter has already been configured + # # (e.g. via a command-line flag). + # config.default_formatter = "doc" + # end + # + # # Print the 10 slowest examples and example groups at the + # # end of the spec run, to help surface which specs are running + # # particularly slow. + # config.profile_examples = 10 + # + # # Run specs in random order to surface order dependencies. If you find an + # # order dependency and want to debug it, you can fix the order by providing + # # the seed, which is printed after each run. + # # --seed 1234 + # config.order = :random + # + # # Seed global randomization in this process using the `--seed` CLI option. + # # Setting this allows you to use `--seed` to deterministically reproduce + # # test failures related to randomization by passing the same `--seed` value + # # as the one that triggered the failure. + # Kernel.srand config.seed +end diff --git a/spec/support/models/random_generator.rb b/spec/support/models/random_generator.rb new file mode 100644 index 0000000..5ad8062 --- /dev/null +++ b/spec/support/models/random_generator.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class RandomGenerator + KAPA = 3.95578 + + class << self + def rand + @rand ||= Random.rand + + @rand = KAPA * @rand * (1 - @rand) + end + + def seed(value) + @rand = value.abs % 1 + @rand = nil if @rand.zero? + end + end +end diff --git a/spec/tmp/.keep b/spec/tmp/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/arrtest.rb b/test/arrtest.rb index 208072c..00a95a3 100644 --- a/test/arrtest.rb +++ b/test/arrtest.rb @@ -1,12 +1,12 @@ -require '../lib/gnuplot' +require 'gnuplot' Gnuplot.open do |gp| Gnuplot::Plot.new( gp ) do |plot| - + plot.title "Array Plot Example" plot.ylabel "x" plot.xlabel "x^2" - + x = (0..50).collect { |v| v.to_f } y = x.collect { |v| v ** 2 } @@ -14,8 +14,8 @@ ds.with = "linespoints" ds.notitle end - + end - + end - + diff --git a/test/histtest.rb b/test/histtest.rb index dd09e24..9207005 100644 --- a/test/histtest.rb +++ b/test/histtest.rb @@ -1,20 +1,20 @@ -require '../lib/gnuplot' +require 'gnuplot' Gnuplot.open do |gp| - gp << "bin(x, s) = s*int(x/s)\n" + gp << "bin(x, s) = s*int(x/s)\n" - Gnuplot::Plot.new( gp ) do |plot| - plot.title "Histogram" - plot.xlabel "x" - plot.ylabel "frequency" + Gnuplot::Plot.new( gp ) do |plot| + plot.title "Histogram" + plot.xlabel "x" + plot.ylabel "frequency" - x = (0..500).collect { |v| (rand()-0.5)**3 } - plot.data << Gnuplot::DataSet.new( [x] ) do |ds| - ds.title = "smooth frequency" - ds.using = "(bin($1,.01)):(1.)" - ds.smooth = "freq" - ds.with = "boxes" - end + x = (0..500).collect { |v| (rand()-0.5)**3 } + plot.data << Gnuplot::DataSet.new( [x] ) do |ds| + ds.title = "smooth frequency" + ds.using = "(bin($1,.01)):(1.)" + ds.smooth = "freq" + ds.with = "boxes" end + end end diff --git a/test/multtest.rb b/test/multtest.rb index 1aeb1d5..dcd06c1 100644 --- a/test/multtest.rb +++ b/test/multtest.rb @@ -1,31 +1,31 @@ -require '../lib/gnuplot' +require 'gnuplot' # File.open( "gnuplot.dat", "w") do |gp| Gnuplot.open do |gp| Gnuplot::Plot.new( gp ) do |plot| - + plot.xrange "[-10:10]" plot.title "Sin Wave Example" plot.ylabel "x" plot.xlabel "sin(x)" - + x = (0..50).collect { |v| v.to_f } y = x.collect { |v| v ** 2 } plot.data = [ Gnuplot::DataSet.new( "sin(x)" ) { |ds| - ds.with = "lines" - ds.title = "String function" - ds.linewidth = 4 + ds.with = "lines" + ds.title = "String function" + ds.linewidth = 4 }, - + Gnuplot::DataSet.new( [x, y] ) { |ds| - ds.with = "linespoints" - ds.title = "Array data" + ds.with = "linespoints" + ds.title = "Array data" } ] end - + end - + diff --git a/test/sinwave.rb b/test/sinwave.rb index f7e7131..78db32e 100644 --- a/test/sinwave.rb +++ b/test/sinwave.rb @@ -1,19 +1,19 @@ -require '../lib/gnuplot' +require 'gnuplot' Gnuplot.open do |gp| Gnuplot::Plot.new( gp ) do |plot| - + plot.xrange "[-10:10]" plot.title "Sin Wave Example" plot.ylabel "x" plot.xlabel "sin(x)" - + plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds| ds.with = "lines" ds.linewidth = 4 end - + end - + end - + diff --git a/test/test_gnuplot.rb b/test/test_gnuplot.rb index 8216130..19b7625 100644 --- a/test/test_gnuplot.rb +++ b/test/test_gnuplot.rb @@ -1,18 +1,26 @@ # -*- ruby -*- -require '../lib/gnuplot' -require 'test/unit' +require 'gnuplot' +require 'minitest/autorun' + +class StdDataTest < MiniTest::Test -class StdDataTest < Test::Unit::TestCase - def test_array_1d data = (0..5).to_a ds = Gnuplot::DataSet.new( data ) - + assert data == ds.data assert data.join("\n") + "\n", ds.to_gplot end + def test_empty_array + data = [] + ds = Gnuplot::DataSet.new( data ) + + assert data == ds.data + assert "" == ds.to_gplot + end + # Test a multidimensional array. @@ -20,48 +28,50 @@ def test_array_nd d1 = (0..3).to_a d2 = d1.collect { |v| 3 * v } d3 = d2.collect { |v| 4 * v } - + data = [ d1, d2, d3 ] ds = Gnuplot::DataSet.new( data ) - + assert data == ds.data assert "0 0 0\n1 3 12\n2 6 24\n3 9 36\n", ds.to_gplot end end -class DataSetTest < Test::Unit::TestCase +class DataSetTest < MiniTest::Test def test_yield_ctor ds = Gnuplot::DataSet.new do |ds| - ds.with = "lines" + ds.with = "lines" ds.using = "1:2" ds.data = [ [0, 1, 2], [1, 2, 5] ] end - + assert "lines", ds.with assert "1:2", ds.using assert nil == ds.title assert [ [0, 1, 2], [1, 2, 5] ] == ds.data assert "'-' using 1:2 with lines", ds.plot_args - assert "0 1\n1 2\n2 5\n", ds.to_gplot + assert "0 1\n1 2\n2 5\n", ds.to_gplot end - + end -class PlotTest < Test::Unit::TestCase - +class PlotTest < MiniTest::Test + def test_no_data plot = Gnuplot::Plot.new do |p| p.set "output", "'foo'" p.set "terminal", "postscript enhanced" + p.unset "border" end - assert( plot.sets == - [ ["output", "'foo'"], - ["terminal", "postscript enhanced"] ] ) - + assert( plot.settings == + [ [:set, "output", "'foo'"], + [:set, "terminal", "postscript enhanced"], + [:unset, "border"] ] ) + assert( plot.to_gplot, \ "set output 'foo'\nset terminal postscript enhanced\n" ) @@ -78,11 +88,49 @@ def test_set assert "'foo'", plot["title"] end + def test_unset + plot = Gnuplot::Plot.new do |p| + p.unset "title" + end + assert_nil plot["title"] + + plot.unset "title" + assert_nil plot["title"] + end + + def test_style + plot = Gnuplot::Plot.new do |p| + s1 = p.style do |s| + s.ls = 1 + s.lt = 1 + s.lc = 1 + s.pt = 1 + s.ps = 1 + end + assert s1.to_s == "set style line 1 ls 1 lt 1 lc 1 pt 1 ps 1", "correct style definition" + assert s1.index == 1, "set index correctly" + + s2 = p.style do |s| + s.ls = 2 + end + assert s2.to_s == "set style line 2 ls 2", "correct style definition" + assert s2.index == 2, "index must be incremented" + + ds = Gnuplot::DataSet.new do |ds| + ds.with = "lines" + ds.linestyle = s1 + ds.data = [ [0, 1, 2], [1, 2, 5] ] + end + + assert ds.plot_args == "'-' with lines linestyle 1", "convert linestyle to index" # index of s1 + end + end + end require 'rbconfig' -CONFIG = Config::MAKEFILE_CONFIG +CONFIG = RbConfig::MAKEFILE_CONFIG # This attempts to test the functions that comprise the gnuplot package. Most # of the bug reports that I get for this package have to do with finding the @@ -94,7 +142,7 @@ class GnuplotModuleTest def test_which # Put the spaces around the command to make sure that it gets stripped - # properly. + # properly. assert( CONFIG["SHELL"], Gnuplot::which(" sh " ) ) assert( CONFIG["SHELL"], Gnuplot::which( CONFIG["SHELL"] ) ) end @@ -111,10 +159,10 @@ def test_gnuplot # name (one that is in the path) then I should get the shell name as the # result of the gnuplot call. - ENV["RB_GNUPLOT"] = "sh" + ENV["RB_GNUPLOT"] = "sh" assert( CONFIG["SHELL"], Gnuplot.gnuplot(false) ) end - + end