Hello,
I'm trying to learn how lisp-stat plotting works and I'm running into a lot of difficulty. As a simple test, I thought I would try to plot some time-series S&P 500 data. I have a .csv containing daily Open, High, Low, and Closing prices for the S&P 500 index going back to 1990.
I note in particular the following passage:
"Writing data
For larger data sets, you probably want to save the data to a file or
network location and use the Vega-Lite ‘url’ property in the
specification. You can write data frames to streams or strings in
Vega-Lite format using the dfio:df-to-vl function. You can also use
the inverse of this function: dfio:vl-to-df to read a Vega-Lite data
array into a data-frame. This is useful for obtaining sample data
sets from the Vega-Lite ecosystem."
Seems pretty straightforward, so I created a data file for the plot like so:
(with-open-file (s #P"./spx.json" :direction :output
:if-exists :overwrite
:if-does-not-exist :create)
(dfio:df-to-vl spx s))
I can check that file and it's some 900kB of json gobbledegook, looks good so far. The next section says we need to use vglt:save-plot to save the plot grammar and then call the browser to view it, and here's where I run into trouble.
Following along with the docs it seems we should render the plot like so:
(plot:plot-from-file (vglt:save-plot (vglt:scatter-plot #P"./spx.json" "SPXDATE" "CLOSE")))
Where "SPXDATE" is the date column, and "CLOSE" is the daily closing price. However, I tried for several hours and no matter what I've tried I receive the following error:
There is no applicable method for the generic function
#<STANDARD-GENERIC-FUNCTION YASON:ENCODE (13)>
when called with arguments
(#P"./spx.json"
#<SB-SYS:FD-STREAM for "file /var/folders/bq/9ngn0wj96zn26hfj1rmypxvm0000gn/T/plot/g995.html" {10053A03C3}>).
[Condition of type SB-PCL::NO-APPLICABLE-METHOD-ERROR]
I'm assuming there's some problem with the way I specify the file path, but the hyperspec is vague on what a filespec actually needs to look like so I'm at a complete dead end. Hoping someone can shine some light on this situation!
N