1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How to plot a one to many function on matplotlib in python

Discussão em 'Python' iniciado por Stack, Outubro 2, 2024 às 11:12.

  1. Stack

    Stack Membro Participativo

    Very simple, if I plot x^2+y^2=z it makes this shape on python it will make this shape:

    [​IMG]

    When I would like to plot it this way:

    [​IMG]

    Below is my code, I am new so I copied it from the internet and have changed the line with the function to plot.

    import matplotlib.pyplot as plt
    import numpy as np
    x = np.linspace(-4*np.pi,4*np.pi,50)
    y = np.linspace(-4*np.pi,4*np.pi,50)
    z = x**2+y**2
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.plot(x,y,z)
    plt.show()


    Also, how do I make it more high definition and smooth, this is a graph of z=sin(x)

    [​IMG]

    Continue reading...

Compartilhe esta Página