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 7841369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:05:08+00:00 2026-06-02T16:05:08+00:00

This is my first matplotlib program, so sorry for my ignorance. I’ve two arrays

  • 0

This is my first matplotlib program, so sorry for my ignorance.

I’ve two arrays of string. say, A = ['test1','test2'] and B = ['test3','test4'].
If any correlation exists between A and B element, their corr value will be set to 1.

        test1 | test2
test3 |   1   |   0

test4 |   0   |   1

Now, I want to draw a scatter diagram where my X axis will be elements of A, Y axis will be elements of B and if correlation value is 1, it’ll be marked in the scattered plot. how to do that?

  • 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-02T16:05:11+00:00Added an answer on June 2, 2026 at 4:05 pm

    Maybe something like this:

    import matplotlib.pyplot
    import pylab
    
    x = [1,2,3,4]
    y = [3,4,8,6]
    
    matplotlib.pyplot.scatter(x,y)
    
    matplotlib.pyplot.show()
    

    EDIT:

    Let me see if I understand you correctly now:

    You have:

           test1 | test2 | test3
    test3 |   1   |   0  |  1
    
    test4 |   0   |   1  |  0
    
    test5 |   1   |   1  |  0
    

    Now you want to represent the above values in in a scatter plot, such that value of 1 is represented by a dot.

    Let’s say you results are stored in a 2-D list:

    results = [[1, 0, 1], [0, 1, 0], [1, 1, 0]]
    

    We want to transform them into two variables so we are able to plot them.

    And I believe this code will give you what you are looking for:

    import matplotlib
    import pylab
    
    
    results = [[1, 0, 1], [0, 1, 0], [1, 1, 0]]
    
    x = []
    y = []
    
    for ind_1, sublist in enumerate(results):
        for ind_2, ele in enumerate(sublist):
            if ele == 1:
                x.append(ind_1)
                y.append(ind_2)       
    
    
    matplotlib.pyplot.scatter(x,y)
    
    matplotlib.pyplot.show()
    

    Notice that I do need to import pylab, and you would have play around with the axis labels. Also this feels like a work around, and there might be (probably is) a direct method to do this.

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

Sidebar

Related Questions

i have two arrays like this first array Array ( [0228] => Array (
Using Dozer to map two objects, I have: /** /* This first class uses
Code first: '''this is main structure of my program''' from twisted.web import http from
This is the first time I am using matplotlib and numpy. Here goes the
There are two parts to this: first compute the start date. Then compute the
Let's say I have this: first \n\n\n second I want to display that on
This first bit works: $my_id = 617; $post_id_7 = get_post($my_id); $title = $post_id_7->post_excerpt; echo
#include <iostream> using namespace std; // This first class contains a vector and a
this my first shot at this awesome new (to me) programmers site, I hope
I did this: [User.first, User.last].to_xml and got this: <users type=array> <user> <created-at type=datetime>2010-03-16T06:40:51Z</created-at> <id

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.