Skip to content Skip to sidebar Skip to footer

Trim Data Outside 3d Plot In Matplotlib

I have a set of PDF that I need to plot for a certain section of the PDF domain. However, when I plot my lines on a 3d plot I get tails for each PDF, Is there a clean way to not p

Solution 1:

Masking the data with nan in the way you're doing it is a good and practical solution.

Since matplotlib 3D plots are projections into 2D space, it would be hard to implement automatic clipping. While I do think it would be possible, I'm not convinced that it's worth the effort. First, because you would need to treat different kinds of plots differently, second, because at least in some cases it would probably turn out that masking the data is still the best choice. Now, doing a complex subclassing of the plotting objects just to do the same thing that can be manually done in one or two lines is probably overkill.

My clear recommendation would therefore be to use the solution you already have. Especially since it does not seem to have any drawbacks so far.

Post a Comment for "Trim Data Outside 3d Plot In Matplotlib"