Skip to content

marker symbols #54

@sheckman16

Description

@sheckman16

It would be nice to be able to set marker symbols, not just color and size. I think this is a 6 line change:

$ git diff
diff --git a/src/plotly/api.nim b/src/plotly/api.nim
index 413850f..f4a3f8f 100644
--- a/src/plotly/api.nim
+++ b/src/plotly/api.nim
@@ -379,6 +379,11 @@ func `%`*(m: Marker): JsonNode =
     fields["color"] = % m.colorVals
     fields["colorscale"] = serializeColormap(m.colormap, m.customColormap)
     fields["showscale"] = % true
+  if m.symbol.len > 0:
+    if m.symbol.len == 1:
+      fields["symbol"] = % m.symbol[0]
+    else:
+      fields["symbol"] = % m.symbol
 
   result = JsonNode(kind: JObject, fields: fields)
 
diff --git a/src/plotly/plotly_types.nim b/src/plotly/plotly_types.nim
index e44bb99..4970e56 100644
--- a/src/plotly/plotly_types.nim
+++ b/src/plotly/plotly_types.nim
@@ -153,6 +153,7 @@ type
   Marker*[T: SomeNumber] = ref object
     size*: seq[T]
     color*: seq[Color]
+    symbol*: seq[int]
     # alternatively use sequence of values defining color based on one of
     # the color maps
     colorVals*: seq[T]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions