[Python] How to plot crosss-sections using plot_implicit in SymPy

Discussão em 'Python' iniciado por Stack, Julho 17, 2025.

  1. Stack

    Stack Membro Participativo

    I want to plot cross-sections of some equations using plot_implicit in SymPy.

    Below is my sample code. There are three equations(I,J,K) and as you can see by plotting this code, there are some cross-sections.

    For example, can I plot only one cross-section of I,J,K by modifing this code? I want to analyze the area of this section for example.

    Can anyone answer my quations?

    from sympy import *

    x, y = symbols("x y")

    I = (x - 30)**2 + (y - 30)**2 -400
    J = y + 2*x -60
    K = (x - 10)**2 + (y - 20)**2 -200

    p1 = plot_implicit(I, (x, 0,100), (y, 0,100), show=False, line_color='g')
    p2 = plot_implicit(J, (x, 0,100), (y, 0,100), show=False, line_color='b')
    p3 = plot_implicit(K, (x, 0,100), (y, 0,100), show=False, line_color='r')

    p1.extend(p2)
    p1.extend(p3)
    p1.show()

    Continue reading...

Compartilhe esta Página