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 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'm trying to plot a step chart with the following properties: x-axis: Time (ms)
I have the following data set that I am trying to plot with ggplot2,
I am trying to change the size of each plot on the following chart
So I'm trying to create some graphs using Core Plot, but for the following
I am trying to plot the following numbers on a log scale as a
I am trying to plot side by side the following datasets dataset1=data.frame(obs=runif(20,min=1,max=10)) dataset2=data.frame(obs=runif(20,min=1,max=20)) dataset3=data.frame(obs=runif(20,min=5,max=10))
I'm trying to plot heatmap in ggplot2 using csv data following casbon's solution in
I am trying to plot the following equation in MATLAB: ratio = sqrt(1+1/(kr)^2) With
I am trying to output multiple density plot from a function, by dividing the

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.