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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:13:53+00:00 2026-05-14T04:13:53+00:00

I am trying to plot the following ! from numpy import * from pylab

  • 0

I am trying to plot the following !

from numpy import *
from pylab import *
import random

for x in range(1,500):
    y = random.randint(1,25000)
    print(x,y)   
    plot(x,y)

show()

However, I keep getting a blank graph (?). Just to make sure that the program logic is correct I added the code print(x,y), just the confirm that (x,y) pairs are being generated.

(x,y) pairs are being generated, but there is no plot, I keep getting a blank graph.

Any help ?

  • 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-14T04:13:53+00:00Added an answer on May 14, 2026 at 4:13 am

    First of all, I have sometimes had better success by doing

    from matplotlib import pyplot
    

    instead of using pylab, although this shouldn’t make a difference in this case.

    I think your actual issue might be that points are being plotted but aren’t visible. It may work better to plot all points at once by using a list:

    xPoints = []
    yPoints = []
    for x in range(1,500):
        y = random.randint(1,25000)
        xPoints.append(x)
        yPoints.append(y)
    pyplot.plot(xPoints, yPoints)
    pyplot.show()
    

    To make this even neater, you can use generator expressions:

    xPoints = range(1,500)
    yPoints = [random.randint(1,25000) for _ in range(1,500)]
    pyplot.plot(xPoints, yPoints)
    pyplot.show()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use core-plot and I followed the instruction from the following
I am trying to plot the following numbers on a log scale as a
I have the following data set that I am trying to plot with ggplot2,
I have the following code from mathematica and trying to do it with matlab
I am trying to recreate the following plot with R. Minitab describes this as
I have the following problem when trying to plot some 3D data in Mathematica.
I'm trying to plot a graph in matplotlib using numpy and meshgrid. I want
i am trying to download core-plot by following command http://core-plot.googlecode.com/hg/ core-plot but its give
I have write following code to show bar plot annotation. Annotations are shown but
Trying to make a MySQL-based application support MS SQL, I ran into the following

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.