#How to specify axes limits in CetZ

11 messages · Page 1 of 1 (latest)

languid estuary
#

?r

#import "@preview/cetz:0.2.1": canvas, chart, draw

#let data = (
  ([neutral], 15),
  ([happy], 68),
  ([angry], 3),
  ([sad], 1),
  ([fear], 0),
  ([surprise], 5),
  ([disgust], 1),
  ([contempt], 7),
)
#figure(
  canvas({
    chart.barchart(mode: "basic",
                   size: (7, 4),
                   value-key: 1,
                   bar-width: 0.6,
                   data)
  }),
  caption: [Sample model output distribution]
) <emotion_dist>

I want the x axis to go from 0 to 100.

shy bolt
#

You can set x-max, x-min, etc.

languid estuary
#

makes sense

#

i couldnt find it anywhere in the cetz manual

shy bolt
#

All plot attributes also work on barchart and columnchar functions, as they are only wrappers for the plot function.

#

Page 62 says: "You can use any plot or axes related style keys, too. The barchart function is a wrapper of the plot API. Arguments passed to ..plot-args are passed to
the plot.plot function."

languid estuary
#

issue is i dont see x-max documented in the manual

#

its in some of the sample code

shy bolt
#

It is documented under "Options" on page 44.

languid estuary
#

ohhhh ok