# HG changeset patch # User Rik # Date 1635372472 25200 # Node ID 20fd3c03fd741514dd39987b303d10dfb0d89ec9 # Parent 774d6edb4caea723ce0f6bb7adc513004dc8264d Add new plot marker styles '|' and '_' (bug #61350) * NEWS: Announce addition. * gl-render.cc (make_marker_list): Add instructions for drawing '|' and '_' markers. * graphics.cc (radio_values::radio_values): Add special case in constructor from string of options to parse '|||' and return value '|'. * graphics.in.h (line, patch, scatter, surface): Add '|' and '_' to marker property for graphics objects which have this property. * __pltopt__.m: Add '|' and '_' to list of possible markers in input validation. * __gnuplot_draw_axes__.m: Add FIXME note about implementing these two markers in gnuplot. There doesn't seem to be an easy way to do this as it is not one of the defined point styles. diff -r 774d6edb4cae -r 20fd3c03fd74 NEWS --- a/NEWS Wed Oct 27 15:02:20 2021 -0400 +++ b/NEWS Wed Oct 27 15:07:52 2021 -0700 @@ -129,6 +129,9 @@ `"interpreter"` property and axes objects' `"ticklabelinterpreter"`. Type `doc "latex interpreter"` for further info. +- The `"Marker"` property for plot objects now accepts `|` which draws +a vertical line or `_` which draws a horizontal line. + - The `FMT` format argument for plot commands now accepts long forms for color names which may be more understandable than the existing one-letter codes. For example, the RGB value `[0 0 0]` can now be diff -r 774d6edb4cae -r 20fd3c03fd74 libinterp/corefcn/gl-render.cc --- a/libinterp/corefcn/gl-render.cc Wed Oct 27 15:02:20 2021 -0400 +++ b/libinterp/corefcn/gl-render.cc Wed Oct 27 15:07:52 2021 -0700 @@ -4687,7 +4687,8 @@ char c = marker[0]; - if (filled && (c == '+' || c == 'x' || c == '*' || c == '.')) + if (filled && (c == '+' || c == 'x' || c == '*' || c == '.' + || c == '|' || c == '_')) return 0; unsigned int ID = m_glfcns.glGenLists (1); @@ -4711,6 +4712,18 @@ m_glfcns.glVertex2d (0, sz/2); m_glfcns.glEnd (); break; + case '|': + m_glfcns.glBegin (GL_LINES); + m_glfcns.glVertex2d (0, -sz/2); + m_glfcns.glVertex2d (0, sz/2); + m_glfcns.glEnd (); + break; + case '_': + m_glfcns.glBegin (GL_LINES); + m_glfcns.glVertex2d (-sz/2, 0); + m_glfcns.glVertex2d (sz/2, 0); + m_glfcns.glEnd (); + break; case 'x': m_glfcns.glBegin (GL_LINES); m_glfcns.glVertex2d (-sz/2, -sz/2); diff -r 774d6edb4cae -r 20fd3c03fd74 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Wed Oct 27 15:02:20 2021 -0400 +++ b/libinterp/corefcn/graphics.cc Wed Oct 27 15:07:52 2021 -0700 @@ -1315,7 +1315,14 @@ std::string t = opt_string.substr (beg, end-beg); - // Might want more error checking here... + // Special case for '|' symbol itself + if (t.empty () && opt_string[beg] == '|') + { + t = '|'; + end++; + } + + // Might want more error checking on parsing default value... if (t[0] == '{') { t = t.substr (1, t.length () - 2); diff -r 774d6edb4cae -r 20fd3c03fd74 libinterp/corefcn/graphics.in.h --- a/libinterp/corefcn/graphics.in.h Wed Oct 27 15:02:20 2021 -0400 +++ b/libinterp/corefcn/graphics.in.h Wed Oct 27 15:07:52 2021 -0700 @@ -4400,7 +4400,7 @@ radio_property linejoin , "{round}|miter|chamfer" radio_property linestyle , "{-}|--|:|-.|none" double_property linewidth , 0.5 - radio_property marker , "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram" + radio_property marker , "{none}|+|o|*|.|x|||_|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram" color_property markeredgecolor , color_property (radio_values ("{auto}|none"), color_values (0, 0, 0)) color_property markerfacecolor , color_property (radio_values ("auto|{none}"), color_values (0, 0, 0)) double_property markersize , 6 @@ -4991,7 +4991,7 @@ array_property facevertexcdata u , Matrix () radio_property linestyle , "{-}|--|:|-.|none" double_property linewidth , 0.5 - radio_property marker , "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram" + radio_property marker , "{none}|+|o|*|.|x|||_|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram" color_property markeredgecolor , color_property (radio_values ("none|{auto}|flat"), color_values (0, 0, 0)) color_property markerfacecolor , color_property (radio_values ("{none}|auto|flat"), color_values (0, 0, 0)) double_property markersize , 6 @@ -5251,7 +5251,7 @@ double_property linewidth , 0.5 array_property longitudedata , Matrix () string_property longitudedatasource , "" - radio_property marker , "{o}|+|*|.|x|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram|none" + radio_property marker , "{o}|+|*|.|x|||_|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram|none" double_property markeredgealpha , 1.0 color_property markeredgecolor , color_property (radio_values ("{flat}|none"), color_values (0, 0, 0)) double_property markerfacealpha , 1.0 @@ -5487,7 +5487,7 @@ radio_property facenormalsmode u , "{auto}|manual" radio_property linestyle , "{-}|--|:|-.|none" double_property linewidth , 0.5 - radio_property marker , "{none}|+|o|*|.|x|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram" + radio_property marker , "{none}|+|o|*|.|x|||_|s|square|d|diamond|^|v|>|<|p|pentagram|h|hexagram" color_property markeredgecolor , color_property (radio_values ("none|{auto}|flat"), color_values (0, 0, 0)) color_property markerfacecolor , color_property (radio_values ("{none}|auto|flat"), color_values (0, 0, 0)) double_property markersize , 6 diff -r 774d6edb4cae -r 20fd3c03fd74 scripts/plot/util/__pltopt__.m --- a/scripts/plot/util/__pltopt__.m Wed Oct 27 15:02:20 2021 -0400 +++ b/scripts/plot/util/__pltopt__.m Wed Oct 27 15:07:52 2021 -0700 @@ -84,6 +84,8 @@ ## @itemx @qcode{"*"} ## @itemx @qcode{"."} ## @itemx @qcode{"x"} +## @itemx @qcode{"|"} +## @itemx @qcode{"_"} ## @itemx @qcode{"s"} ## @itemx @qcode{"d"} ## @itemx @qcode{"^"} @@ -165,7 +167,7 @@ have_linestyle = true; options.linestyle = topt; ## Markers - elseif (any (topt == "+o*.xsd^v>