Here, In my code x axis='Time' and y='Random Number'. so, I just want to plot graph with these variables using real time matplotlib.

```import matplotlib.pyplot as plt
import datetime
import numpy as np
import time

def GetRandomIntNumber(Data):
timerCounter=0
x=[]
y=[]
while timerCounter < 5000:
NewNumber = Data * np.random.randomint(5)
x.append(datetime.datetime.now())
y.append(NewNumber)
plt.plot(x,y)
plt.show()
time.sleep(10)

a = 10
GetRandomIntNumber(a)```
May 24, 2019 in Python 1,312 views

## 1 answer to this question.

Hi Sucheta,

The error I can see in your code that is because there is no function called randomint .

You can check out this code to remove your error.

```import matplotlib.pyplot as plt
import datetime
import numpy as np
import time

def GetRandomIntNumber(Data):
timerCounter=0
x=[]
y=[]
while timerCounter < 5000:
NewNumber = Data * np.random.randint(5)
x.append(datetime.datetime.now())
y.append(NewNumber)
plt.plot(x,y)
plt.show()
time.sleep(10)

a = 10﻿
GetRandomIntNumber(a)```

I hope it will help you, just let me know if it works.

• 1,120 points

## How to get the current time in Python

FOLLOWING WAY TO FIND CURRENT TIME IN ...READ MORE

## How to get the current time in Python

>>> import datetime >>> datetime.datetime.now() datetime(2018, 25, ...READ MORE

## Get the Current time in Python

To get the current date and time ...READ MORE

## Time delay in Python

The following code will delay it for ...READ MORE

+1 vote

## How to create plots using python matplotlib in IPython notebook?

I think you should try: I used %matplotlib inline in ...READ MORE

+1 vote

## How to handle Real-Time Matplotlib Plotting

To draw a continuous set of random ...READ MORE