This repository has been archived by the owner on Dec 24, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
105 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
require_relative '../../lib/grruby' | ||
g = Rubyplot::Figure.new() | ||
This comment has been minimized.
Sorry, something went wrong. |
||
g.title = 'This is Scatter' | ||
g.title = 'This is a Fancy Graph' | ||
@x1 = [1, 2, 3, 4, 5] | ||
@y1 = [10, 29, 30, 40, 50] | ||
@x2 = [2, 16, 4] | ||
@y2 = [10, -5, -10] | ||
g.text_font = :BOOKMAN_LIGHT_ITALIC | ||
g.line! @x1, @y1, line_width: 3, line_color: :RED, | ||
line_type: :LONG_SHORT_DASH, | ||
marker_size: 2, marker_type: :SOLID_HGLASS, marker_color: :BLUE | ||
g.scatter! @x2, @y2, marker_color: :GREEN, marker_size: 2, | ||
marker_type: :SOLID_TRI_UP | ||
g.text_font = :bookman_light_italic | ||
g.line! @x1, @y1, line_width: 2, | ||
line_color: :red, line_type: :long_short_dash, | ||
marker_size: 2 | ||
g.scatter! @x2, @y2, marker_color: :green, | ||
marker_size: 2, marker_type: :solid_tri_left | ||
g.save("scatter.bmp") | ||
g.view |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,106 +252,106 @@ def call | |
# Will define color index, fonts, marker types and other constants | ||
# color index between 1 to 1256. map all prominent ones here | ||
GR_COLOR_INDEX = { | ||
BLACK: 80, | ||
BLUE: 257, | ||
GREEN: 477, | ||
RED: 367 | ||
black: 1, | ||
blue: 257, | ||
green: 477, | ||
red: 367 | ||
}.freeze | ||
|
||
GR_FONTS = { | ||
TIMES_ROMAN: 101, | ||
TIMES_ITALIC: 102, | ||
TIMES_BOLD: 103, | ||
TIMES_BOLD_ITALIC: 104, | ||
HELVETICA: 105, | ||
HELVETICA_OBLIQUE: 106, | ||
HELVETICA_BOLD: 107, | ||
HELVETICA_BOLD_OBLIQUE: 108, | ||
COURIER: 109, | ||
COURIER_OBLIQUE: 110, | ||
COURIER_BOLD: 111, | ||
COURIER_BOLD_OBLIQUE: 112, | ||
SYMBOL: 113, | ||
BOOKMAN_LIGHT: 114, | ||
BOOKMAN_LIGHT_ITALIC: 115, | ||
BOOKMAN_DEMI: 116, | ||
BOOKMAN_DEMI_ITALIC: 117, | ||
NEWCENTURYSCHLBK_ROMAN: 118, | ||
NEWCENTURYSCHLBK_ITALIC: 119, | ||
NEWCENTURYSCHLBK_BOLD: 120, | ||
NEWCENTURYSCHLBK_BOLD_ITALIC: 121, | ||
AVANTGARDE_BOOK: 122, | ||
AVANTGARDE_BOOK_OBLIQUE: 123, | ||
AVANTGARDE_DEMI: 124, | ||
AVANTGARDE_DEMI_OBLIQUE: 125, | ||
PALATINO_ROMAN: 126, | ||
PALATINO_ITALIC: 127, | ||
PALATINO_BOLD: 128, | ||
PALATINO_BOLD_ITALIC: 129, | ||
ZAPFCHANCERY_MEDIUM_ITALIC: 130, | ||
ZAPFDINGBATS: 131 | ||
times_roman: 101, | ||
times_italic: 102, | ||
times_bold: 103, | ||
times_bold_italic: 104, | ||
helvetica: 105, | ||
helvetica_oblique: 106, | ||
helvetica_bold: 107, | ||
helvetica_bold_oblique: 108, | ||
courier: 109, | ||
courier_oblique: 110, | ||
courier_bold: 111, | ||
courier_bold_oblique: 112, | ||
symbol: 113, | ||
bookman_light: 114, | ||
bookman_light_italic: 115, | ||
bookman_demi: 116, | ||
bookman_demi_italic: 117, | ||
newcenturyschlbk_roman: 118, | ||
This comment has been minimized.
Sorry, something went wrong. |
||
newcenturyschlbk_italic: 119, | ||
newcenturyschlbk_bold: 120, | ||
newcenturyschlbk_bold_italic: 121, | ||
avantgarde_book: 122, | ||
avantgarde_book_oblique: 123, | ||
avantgarde_demi: 124, | ||
avantgarde_demi_oblique: 125, | ||
palatino_roman: 126, | ||
palatino_italic: 127, | ||
palatino_bold: 128, | ||
palatino_bold_italic: 129, | ||
zapfchancery_medium_italic: 130, | ||
zapfdingbats: 131 | ||
}.freeze | ||
|
||
GR_FONT_PRECISION = { | ||
TEXT_PRECISION_STRING: 0, | ||
TEXT_PRECISION_CHAR: 1, | ||
TEXT_PRECISION_STROKE: 2 | ||
text_precision_string: 0, | ||
text_precision_char: 1, | ||
text_precision_stroke: 2 | ||
}.freeze | ||
|
||
# Marker types | ||
GR_MARKER_SHAPES = { | ||
This comment has been minimized.
Sorry, something went wrong.
translunar
|
||
DOT: 1, | ||
PLUS: 2, | ||
ASTERISK: 3, | ||
CIRCLE: 4, | ||
DIAGONAL_CROSS: 5, | ||
SOLID_CIRCLE: -1, | ||
TRIANGLE_UP: -2, | ||
SOLID_TRI_UP: -3, | ||
TRIANGLE_DOWN: -4, | ||
SOLID_TRI_DOWN: -5, | ||
SQUARE: -6, | ||
SOLID_SQUARE: -7, | ||
BOWTIE: -8, | ||
SOLID_BOWTIE: -9, | ||
HGLASS: -10, | ||
SOLID_HGLASS: -11, | ||
DIAMOND: -12, | ||
SOLID_DIAMOND: -13, | ||
STAR: -14, | ||
SOLID_STAR: -15, | ||
TRI_UP_DOWN: -16, | ||
SOLID_TRI_RIGHT: -17, | ||
SOLID_TRI_LEFT: -18, | ||
HOLLOW_PLUS: -19, | ||
SOLID_PLUS: -20, | ||
PENTAGON: -21, | ||
HEXAGON: -22, | ||
HEPTAGON: -23, | ||
OCTAGON: -24, | ||
STAR_4: -25, | ||
STAR_5: -26, | ||
STAR_6: -27, | ||
STAR_7: -28, | ||
STAR_8: -29, | ||
VLINE: -30, | ||
HLINE: -31, | ||
OMARK: -32 | ||
dot: 1, | ||
plus: 2, | ||
asterisk: 3, | ||
circle: 4, | ||
diagonal_cross: 5, | ||
solid_circle: -1, | ||
triangle_up: -2, | ||
solid_tri_up: -3, | ||
triangle_down: -4, | ||
solid_tri_down: -5, | ||
square: -6, | ||
solid_square: -7, | ||
bowtie: -8, | ||
solid_bowtie: -9, | ||
hglass: -10, | ||
solid_hglass: -11, | ||
diamond: -12, | ||
solid_diamond: -13, | ||
star: -14, | ||
solid_star: -15, | ||
tri_up_down: -16, | ||
solid_tri_right: -17, | ||
solid_tri_left: -18, | ||
hollow_plus: -19, | ||
solid_plus: -20, | ||
pentagon: -21, | ||
hexagon: -22, | ||
heptagon: -23, | ||
octagon: -24, | ||
star_4: -25, | ||
star_5: -26, | ||
star_6: -27, | ||
star_7: -28, | ||
star_8: -29, | ||
vline: -30, | ||
hline: -31, | ||
omark: -32 | ||
}.freeze | ||
|
||
GR_LINE_TYPES = { | ||
SOLID: 1, | ||
DASHED: 2, | ||
DOTTED: 3, | ||
DASHED_DOTTED: 4, | ||
DASH_2_DOT: -1, | ||
DASH_3_DOT: -2, | ||
LONG_DASH: -3, | ||
LONG_SHORT_DASH: -4, | ||
SPACED_DASH: -5, | ||
SPACED_DOT: -6, | ||
DOUBLE_DOT: -7, | ||
TRIPLE_DOT: -8 | ||
solid: 1, | ||
dashed: 2, | ||
dotted: 3, | ||
dashed_dotted: 4, | ||
dash_2_dot: -1, | ||
dash_3_dot: -2, | ||
long_dash: -3, | ||
long_short_dash: -4, | ||
spaced_dash: -5, | ||
spaced_dot: -6, | ||
double_dot: -7, | ||
triple_dot: -8 | ||
}.freeze | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I had specifically mentioned to you the conventions to follow when naming files in Ruby. Why are these simple things so difficult for you to follow?