'Is there a way to visualize the feasible region for a set of linear inequalities in plotly in 2d? in 3d?
Is there a way to visualize the feasible region for a set of linear inequalities in plotly in 2d? in 3d?
Say I have the inequalities:
How can I visualize the feasible region in Plotly? What about if my region is in 3d? I know that we can do this in other libraries (e.g. matplotlib), but I specifically want to do this in plotly.
Solution 1:[1]
Unfortunately, I don't think so.
A few months ago I stumbled on the same problem as I was developing a new plotting module for SymPy. After testing different things, these are my conclusions:
- Matplotlib offers at least two ways to achieve that: either with
ax.contour(and setting the contour levels) or withax.fill. - Plotly's
go.Contourdoesn't currently support setting contour levels (see issue 4503). This results in difficult to read plots. Here is a comparison of the first inequality that you posted with Matplotlib (blue region is where the inequality is true) and Plotly (yellow region is where the inequality is true).
- Plotly doesn't implement a feature similar to
ax.fill. - Plotly exposes the
go.Heatmap, but it is not suitable for this application.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Davide_sd |



