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

  • SEARCH
  • Home
  • 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 7666255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:47:15+00:00 2026-05-31T14:47:15+00:00

I am given some points and some centroids representing the centers of some clusters

  • 0

I am given some points and some centroids representing the centers of some clusters of points. I am asked to determine what cluster each point belongs to and then plot it (using scatter3), and each cluster of points should be colored differently.

How can I generate an initial cluster_colors matrix of size Cx3, where C is the number of clusters/ centroids? It doesn’t really matter what the colors are, but they should be easily distinguishable. Also, I don’t know the number of clusters beforehand.

  • 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-05-31T14:47:17+00:00Added an answer on May 31, 2026 at 2:47 pm

    To color the points with SCATTER3 you actually need Nx1 matrix (CLR in the example below), there N is the number of points. This matrix can contain the cluster number, for example.

    scatter3(X,Y,Z,[],CLR)
    

    The colors will be used from the current colormap. To set the colormap you do need a Cx3 matrix. You can get it from any existing colormap. See COLORMAP for more details.

    For example,

    colormap(jet(C))
    

    Actually the number of colors in the colormap don’t have to be equal to the number of clusters.

    You can also create your own colormap using MATLAB colormap editor. Or find many nice colormaps on the FileExchange, like this one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have some set of points (each point has its X and Y) and
When reading a post some points were given without example : To implement IEnumerable
Given a succession of points describing a polygon, is there some easy way of
I have a class C(Of T). I want to determine if some given value
Given some data of shape 20x45, where each row is a separate data set,
Given a point list (A1, A2, A3, ...., AN), each point Ai has Ai_x,
Given some (English) word that we shall assume is a plural , is it
Given some typical search form, I can't construct this form action when submitting a
Given some arbitrary SQL I would like to get the data types of the
I have been given some matlab code compiled using the .net compiler. I can

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.