Skip to content

Set up proportions of each colour #159

Answered by koenderks
yiqi171717 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @yiqi171717,

Sounds like a cool idea! I think a good attempt would be to first create a vector of colors that has the appropriate proportions in it, like is shown below. In the vector colors, the color blue occurs (approximately) 30%, red occurs 20%, and yellow occurs 50% of the times.

set.seed(1)
colors <- sample(c("blue", "red", "yellow"), size = 1000, prob = c(0.3, 0.2, 0.5), replace = TRUE)

Next, you can use this color vector in one of the functions. For example:

aRtsy::canvas_flow(colors = colors, lwd = 0.5)

Hope this helps! :)

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@yiqi171717
Comment options

@koenderks
Comment options

@yiqi171717
Comment options

@koenderks
Comment options

@yiqi171717
Comment options

Answer selected by yiqi171717
Comment options

You must be logged in to vote
1 reply
@koenderks
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants