Skip to content

Colormap/palette for lineplot's hue #10674

@Luluser

Description

@Luluser

Is your feature request related to a problem?

hue argument works for xr.plot.line() but there is no way to control in the function call the colormap.
Right now, one has to manually create an axis, modify its cycler and then pass the ax to the plot function.
Hence one cannot create the axis with the plot function there one cannot use the "size" argument of the plot function for example, and one has to manually pick the number of colorlevels needed :

fig,ax = plt.subplots(figsize=(8,5))

ds2plot = ...
ax.set_prop_cycle(cycler(color=plt.get_cmap('magma_r')(np.linspace(0.15, 1, len(ds2plot.time)))))

ds2plot.plot(y="altitude", hue = "time", ax =ax)

Describe the solution you'd like

ds2plot.plot(y="altitude", hue = "time", cmap="magma_r")
And why not colormap arguments (i.e min, max for the color coding like in my previous functioning example).

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions