Skip to content

colorrange is an invalid attribute for contourf #4016

@asinghvi17

Description

@asinghvi17
  • are you running newest version (version from docs) ?
  • can you reproduce the bug with a fresh environment ? (]activate --temp; add Makie)
  • What platform + GPU are you on?

MWE:

contourf(randn(10, 10); colorrange = (0, 1))

It looks like the color attributes are specified explicitly (instead of using the new mixin functions). We could change this to use eg MakieCore.mixin_colormap_attributes()... instead. The implementation would have to be updated to pass all of the color attributes through to the color determining function as well.

@recipe Contourf begin
"""
Can be either
- an `Int` that produces n equally wide levels or bands
- an `AbstractVector{<:Real}` that lists n consecutive edges from low to high, which result in n-1 levels or bands
If `levels` is an `Int`, the contourf plot will be rectangular as all `zs` values will be covered edge to edge.
This is why `Axis` defaults to tight limits for such contourf plots.
If you specify `levels` as an `AbstractVector{<:Real}`, however, note that the axis limits include the default margins because the contourf plot can have an irregular shape.
You can use `tightlimits!(ax)` to tighten the limits similar to the `Int` behavior.
"""
levels = 10
"""
Determines how the `levels` attribute is interpreted, either `:normal` or `:relative`.
In `:normal` mode, the levels correspond directly to the z values.
In `:relative` mode, you specify edges by the fraction between minimum and maximum value of `zs`.
This can be used for example to draw bands for the upper 90% while excluding the lower 10% with `levels = 0.1:0.1:1.0, mode = :relative`.
"""
mode = :normal
colormap = @inherit colormap
colorscale = identity
"""
In `:normal` mode, if you want to show a band from `-Inf` to the low edge,
set `extendlow` to `:auto` to give the extension the same color as the first level,
or specify a color directly (default `nothing` means no extended band).
"""
extendlow = nothing
"""
In `:normal` mode, if you want to show a band from the high edge to `Inf`, set `extendhigh`
to `:auto` to give the extension the same color as the last level, or specify a color directly
(default `nothing` means no extended band).
"""
extendhigh = nothing
# TODO, Isoband doesn't seem to support nans?
nan_color = :transparent
MakieCore.mixin_generic_plot_attributes()...

Metadata

Metadata

Assignees

No one assigned

    Labels

    (tri)contour(f)not 3D contour, that's volumeAttributesPlot, Block and Scene AttributesMakieBackend independent issues (Makie core)bugcolorscolor, colormap, colorrange, alpha, etcgood first issueThis should come with some instructions!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions