Skip to content

How to label axes #199

Description

@jimka2001

I asked this elsewhere but with no answer, so please allow me to ask it here.

I have a clojure function, series-format-plot-data, defined here https://github.com/jimka2001/clojurein-student/blob/ce1e21511a04d17f851a294f39fcf7b457f4427e/clojurein-source-code/src/lecture/vega_plot.clj#L8
which creates a plot using oz. I can't figure out how to set the label on the x and y axes.
Can someone help?

When I call the function, sample-plot-2, defined here https://github.com/jimka2001/clojurein-student/blob/ce1e21511a04d17f851a294f39fcf7b457f4427e/clojurein-source-code/src/lecture/baby_name_plot.clj#L98
I get a graphs looking like the following which has x and y axis labels as "x" and "y" rather than "Year" and "Percentage"
as requested.
Baby Names 44427929273960329145

I'm basically returning a data structure such as the following:

    {:data {:values polished-data} // polished-data computed elsewhere.
     :title {:text chart-title}
     :description chart-title
     :axes [{:orient "bottom"
             ;; TODO this is NOT setting the label
             :title x-label}
            {:orient "left"
             ;; TODO this is NOT setting the label
             :title y-label}]
     :encoding {:x {:field "x" ;; x-label
                    :type "quantitative"}
                :y {:field "y" ;; y-label
                    :type "quantitative"}
                :color {:field "series"
                        :type "nominal"}}
     :mark "line"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions