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 plot the tails that happen outside my plot limits? I know I can change the data to NaNs to achieve the same effect but I want to do this in matplotlib. Here is my current workaround code,
`# trim the data y = np.ones(PDF_x.shape)*PDF_x y[y>95]= np.nan y[y<75]= np.nan # plot the data fig = plt.figure() ax = fig.gca(projection='3d') for i in range(PDF_capacity.shape[1]): ax.plot(life[i]*np.ones((PDF_x.shape)),y,PDF_capacity[:,i], label='parametric curve') # set the axis limits ax.set_ylim(75,95) # add axis labels ax.set_xlabel('charge cycles to failure point of 75% capacity') ax.set_ylabel('capacity at 100 charge cycles') ax.set_zlabel('probability')` After trimming I can make the following plot,



nans you already have (y[y>95]= np.nan). "I want to" is not a very good argument for convincing someone to put a lot of effort into something that already has a drawback-free one-liner solution.ax.set_ylim(75,95)to restrict the plot to the stated limits, however, this does not trim the data to between these limits.