Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8467695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:43:04+00:00 2026-06-10T15:43:04+00:00

Suppose I have three data sets: X = [1,2,3,4] Y1 = [4,8,12,16] Y2 =

  • 0

Suppose I have three data sets:

X = [1,2,3,4]
Y1 = [4,8,12,16]
Y2 = [1,4,9,16]

I can scatter plot this:

from matplotlib import pyplot as plt
plt.scatter(X,Y1,color='red')
plt.scatter(X,Y2,color='blue')
plt.show()

How can I do this with 10 sets?

I searched for this and could find any reference to what I’m asking.

Edit: clarifying (hopefully) my question

If I call scatter multiple times, I can only set the same color on each scatter. Also, I know I can set a color array manually but I’m sure there is a better way to do this.
My question is then, “How can I automatically scatter-plot my several data sets, each with a different color.

If that helps, I can easily assign a unique number to each data set.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:43:06+00:00Added an answer on June 10, 2026 at 3:43 pm

    I don’t know what you mean by ‘manually’. You can choose a colourmap and make a colour array easily enough:

    import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.cm as cm
    
    x = np.arange(10)
    ys = [i+x+(i*x)**2 for i in range(10)]
    
    colors = cm.rainbow(np.linspace(0, 1, len(ys)))
    for y, c in zip(ys, colors):
        plt.scatter(x, y, color=c)
    

    Matplotlib graph with different colors

    Or you can make your own colour cycler using itertools.cycle and specifying the colours you want to loop over, using next to get the one you want. For example, with 3 colours:

    import itertools
    
    colors = itertools.cycle(["r", "b", "g"])
    for y in ys:
        plt.scatter(x, y, color=next(colors))
    

    Matplotlib graph with only 3 colors

    Come to think of it, maybe it’s cleaner not to use zip with the first one neither:

    colors = iter(cm.rainbow(np.linspace(0, 1, len(ys))))
    for y in ys:
        plt.scatter(x, y, color=next(colors))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the /data directory of solr, suppose, I have three folders named as index,
Suppose I have a string like this: one two three four five six seven
Suppose that we have previously instantiated three objects A, B, C from class D
Suppose i have input array byte A[50]; i have put three diffrent data types
Suppose I have a Singleton class (any class can get the instance): class data
I can think of three ways of filling a std::vector Suppose we have vector<int>
Suppose one would like to plot 2 sets of data with unequal number of
Suppose I have three projects in my sln. (1) xyz.a{Class Lib}{no reference added} (2)
Suppose I have three lists: list1 = a, c, d, r, t list2 =
suppose I have a simple container which have three element: <div> <span>hello world</span> <input

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.