4

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')
JAP
  • 405
  • 2
  • 11
  • 1
    Does this answer your question? [How do you change the size of figures drawn with Matplotlib?](https://stackoverflow.com/questions/332289/how-do-you-change-the-size-of-figures-drawn-with-matplotlib) – Jody Klymak Jan 28 '22 at 06:37

1 Answers1

2

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')
JAP
  • 405
  • 2
  • 11