Skip to content
Advertisement

Graphing Inequalities in python

I’m looking to create a program that will randomly generate lines (that are inequalities) and that will show the area that satisfies the constraints.

I don’t mind which libraries are used so feel free to use sympy, numpy etc

I will show my current code but this just fills the area between 2 lines and doesn’t use inequalities at all.

If possible a legend would be nice but I can always add one myself.

JavaScript

Advertisement

Answer

You can combine multiple sympy plots via show=False and appending plots. This can be used to add lines:

JavaScript

multiple plot_implicit plots together

Alternatively, you could make use of the markers= parameter to add lines or points. annotations= can be used to add text.

JavaScript

plot_implicit with annotations and markers

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement