Clean up plot attributes #4206
Replies: 5 comments
-
We should also clean up the Attribute handling in recipes. Currently some recipes inherit attributes, some don't, some are probably missing attributes and passing them along is often very explicit. For example In that context it might also be good to cleanup/change |
Beta Was this translation helpful? Give feedback.
-
Maybe we can use the default_attributes = @documented_attributes begin
"Turns a plot in/visible. "
visible = true
...
end
default_3D_attributes = @documented_attributes begin
default_attributes
"Sets the brightness of ambient light. The components of this vector act as multipliers to the red, green and blue color values of the plot."
ambient = Vec3f0(0.55)
...
end
@recipe(Mesh, mesh) do scene
@documented_attributes begin
default_3d_attributes(scene)
"Sets the flat color, vertex color or texture of the mesh depending on the passed type (color type, Vector or Matrix of colors respectively)."
color = :black
...
end
end to generate a docstring like this:
|
Beta Was this translation helpful? Give feedback.
-
Yeah something like that would be good. I've been cleaning up in that MakieLayout code a bit in my layoutables PR, and we can definitely share some of that code with the recipe code that Simon is refactoring. What would be a good way to access help for attributes? Currently I dump everything into one large docstring but that gets pretty difficult to read after a while. |
Beta Was this translation helpful? Give feedback.
-
I think in some cases nesting attributes could be helpful. More specifically for axis.grid = Attributes(
color = (RGBA(0,0,0,0.12), RGBA(0,0,0,0.12)),
style = (nothing, nothing),
visible = (true, true),
width = (1.0, 1.0)
) and document as - `grid = Attributes(...)`: Holds onto various grid attributes.
- `color = (RGBA(0,0,0,0.12), RGBA(0,0,0,0.12))`: The color (x, y) grid lines.
- `style = (nothing, nothing)`: The linestyle of (x, y) grid lines.
- `axis.grid.visible = (true, true)`: Controls if the (x, y) grid lines are visible.
- `width = (1.0, 1.0)`: The width of the (x, y) grid lines. I think for plots it's probably fine to just dump all that information as is. Scatter has 30 attributes, compared to ~120 from Axis, and some of them shouldn't be there (lighting stuff) or are backend attributes (uv_offset_width? distancefield?) which don't need to appear in a docstring. |
Beta Was this translation helpful? Give feedback.
-
checked off some points here (none were checked before) |
Beta Was this translation helpful? Give feedback.
-
color
(e.g. colormap)high_clip
, etc)alpha
keyword arg #84material
Related issues:
#1230
#879
#744
#84
#545
Beta Was this translation helpful? Give feedback.
All reactions