Raster positioning #2313
roelandschoukens
started this conversation in
General
Replies: 1 comment
-
related to https://talk.observablehq.com/t/axis-color-bar/10344/3 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I was trying to rasterize some color bar in 1 dimension and display it as a raster mark. The aim was eventually to have a raster with a width matching the plot, a small height (set to 3 pixels in the example, but could be 1 pixel), and correct alignment of data points on the X axis.
How is the positioning of raster marks determined? I’m starting with the documentation page at Observable: (https://observablehq.com/plot/marks/raster#raster-options).
And I don't think the behavior exactly matches the documentation:
examples here: https://observablehq.com/d/8084ece3d437fd56
In example 1,
width
andheight
are specified. The documentation suggests the first sentence applies, however the behavior matches the next sentence (the raster covers the entire frame).Example 2 omits
width
. This does not affect the positioning but gives us a raster of the desired resolution.Example 3 omits
y
. Compared to example 1, this affects the extent of the raster on the Y axis, and it now covers the (0, 3) interval (i.e. 0 andheight
) as suggested by the documentation.Example 4 omits both
y
andwidth
. Compare to example 2 which specifiesy
and omitswidth
. It is a bit surprising that omittingy
affects the positioning on the X axis. Although I think it would be fair enough to argue thaty
should be specified ifdata
is given.Beta Was this translation helpful? Give feedback.
All reactions