6

I'm trying to plot a graph and individual dots together with Python within a Google Colab document, and I don't see much change in the size of the plot.

It may be that I don't know how to declare a plot or figure, and when to call it, or that the fact that I'm overlapping plots interferes. There is a post with almost identical content, but doesn't solve my problem in here.

This is my code:

import numpy as np
import matplotlib.pyplot as plt

plt.figure(figsize=(800,100)) 

s = np.random.normal(0,1,500)
x = np.arange(0,len(s))

f, ax = plt.subplots(1)

plt.plot(x,s, color='k', LineWidth=.8)

x_vals = np.linspace(0,500,20)
y_vals = [0] * len(x_vals)

plt.scatter(x_vals,y_vals, marker='.',color='red')
2

1 Answer 1

4

Just including the size within the figure, ax = plt.subplots(1):

import numpy as np
import matplotlib.pyplot as plt

s = np.random.normal(0,1,500)
x = np.arange(0,len(s))

f, ax = plt.subplots(1, figsize=(10,8))

plt.plot(x,s, color='k', LineWidth=.8)

x_vals = np.linspace(0,500,20)
y_vals = [0] * len(x_vals)

plt.scatter(x_vals,y_vals, marker='.',color='red')
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.