Skip to content

how to set the default color cycle #200

@syrte

Description

@syrte

I went through the ultraplot document, but failed to find a clear explanation on how to set the default color cycle to a custom color sequence.

The configuration page mentioned rc['cycle'].
The Color cycles page mentioned how to define a cycle with uplt. Cycle, but this cycle can not be passed to rc actually.
These are all relevant info that I found.

I don't know what's the recommended practice with ultraplot.
I found a workaround using a mixture of uplt and mpl.

from matplotlib import pyplot as plt
import matplotlib as mpl
import ultraplot as uplt
import numpy as np


ctab = ["#5790fc", "#f89c20", "#e42536", "#964a8b", "#9c9ca1", "#7a21dd"]
uplt.rc['axes.prop_cycle'] = mpl.cycler(color=ctab)
# uplt.rc['cycle'] = mpl.cycler(color=ctab)  # does not work

for i in range(6):
    plt.plot(np.arange(10) + i)

Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions