#Cetz stuff

16 messages ยท Page 1 of 1 (latest)

jovial shard
#

@shut crow lets move the conversation here as you suggested

#
  cetz.draw.set-style(
    axes: (
      stroke: (thickness: 0.5pt, cap: "square"),
      grid: (stroke: 0pt),
      tick: (
        stroke: (thickness: 0.5pt, cap: "square", dash: none),
        label: (angle: 45deg)
      ),
    ),
    error: (whisker-size: 0.25),
    // grid: (stroke: none),
    // bar-width: 1,
    // legend: (stroke: (thickness: 0.5pt, cap: "square")),
    // axes: (tick: (length: 0), grid: (stroke: none)),
  )
  cetz.chart.columnchart(
    axis-style: "scientific",
    size: (10, 6),
    mode: "clustered",
    label-key: "cmpd",
    value-key: ("GTAverage", "Maverage"),
    error-key: ("GTSTDev", "MSTDev"),
    low
  )
})```
#

This is my code so far

#

which yields

#

The things I'd like to change: y-axis tick labels in scientific notation and not rotated (ideally, the exponent on the very top)

#

no horizontal dashed grid lines (seems to be tied to the axis stroke)

#

change anchor of labels

#

and, for some reason, the error bars aren't showing

#

here is the excel version I'm aiming for:

shut crow
#

Uh, maybe errors are not in 0.2.2 ๐Ÿ™„ Sorry.

#

For the rest:

#

?r t=l

#import "@preview/cetz:0.2.2"
#import cetz: canvas, draw, plot, chart, coordinate, palette, tree, vector
#set page(width: auto, height: auto, margin: .5cm)


#cetz.canvas({
  let data = (
    (cmpd: [Long label], GTAverage: 10, Maverage: 3, GTSTDev: 2, MSTDev: 4),
    (cmpd: [2], GTAverage: 30, Maverage: 9, GTSTDev: 2, MSTDev: 1),
    (cmpd: [3], GTAverage: 14, Maverage: 2, GTSTDev: 5, MSTDev: 3),
  )
  cetz.draw.set-style(
    axes: (
      stroke: (thickness: 0.5pt, cap: "square"),
      grid: (stroke: 0pt),
      bottom: (
        tick: (
          stroke: (thickness: 0.5pt, cap: "square", dash: none),
          label: (
            angle: 45deg,
            anchor: "north-east",
          )
        ),
      ),
      left: (
        tick: (
          label: (
            angle: 0deg,
            anchor: "east",
          )
        )
      )
    ),
    error: (whisker-size: 0.25),
    // bar-width: 1,
    // legend: (stroke: (thickness: 0.5pt, cap: "square")),
    // axes: (tick: (length: 0), grid: (stroke: none)),
  )
  
  cetz.chart.columnchart(
    axis-style: "scientific",
    size: (10, 6),
    mode: "clustered",
    label-key: "cmpd",
    value-key: ("GTAverage", "Maverage"),
    error-key: ("GTSTDev", "MSTDev"),
    y-grid: false,
    y-format: v => { /* Your formatting code here */ [#v]; },
    data
  )
})
shut crow
#

There seems to be a bug setting the tick label anchor for all axes at once. But it works when specifying a single axis.

jovial shard