Makie returning empty plots

Viewed 53

I am new to julia, I want plot a simple scatterplot from a dataframe where the colors are coded as String7 hexadecimal code, a snapshot,

 Row │ x      y      ncv_color 
     │ Int64  Int64  String7   
─────┼─────────────────────────
   1 │   120   4180  #005529
   2 │   120   3890  #004903
   3 │   110   4670  #004E66
   4 │   120   8270  #004A99
   5 │   120   9620  #005C5A

when I use the following code to draw a scatterplot, it works.

scatter(df.x, df.y)

scatter plot

Although when I use As suggested by @ginkul using this

scatter(df2, df2, color=df.ncv_color)

I get FigureAxisPlot() as output and no plot is shown.

Any help would be appreciated.

versioninfo

Julia Version 1.6.3
Commit ae8452a9e0 (2021-09-23 17:34 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD EPYC 7542 32-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver2)

1 Answers

The problem is that you're passing ncv_color as a Symbol. You can actually pass Symbol as color, for example :red, but since there is no such color as ncv_color nothing can be displayed. scatter doesn't know that you're implying a column of df. You need to pass your array explicitly.

scatter(df.x, df.y, color = df.ncv_color)
Related