0

In matplotlib 3d-plotting the function plot_wireframe takes parameters - rcount, ccount, rstride and cstride respectively. I went through the documentation for them in the matplotlib documentation but it was not very clear what they did. I played around changing the parameter values of rcount and ccount a bit and have a sense that it has to do with how many rows and columns from the meshgrids X and Y are used for placing the wires (X and Y are the meshgrids input to plot_wireframe). I guess a clear understanding of rstride and cstride will follow after understanding rcount and ccount. Hence I request a better explanation of this with an example maybe.

Here is my code for reference (ran in Jupyter notebook)-

    import numpy as np
    import matplotlib.pyplot as plt
    
    # Because I would want to rotate the plots manually
    %matplotlib notebook

    x = np.linspace(-3,3,7)
    y = np.linspace(-3,3,7)
    X,Y = np.meshgrid(x,y)
    Z = X**2 + Y**2
    fig = plt.figure()
    ax = fig.add_subplot(projection='3d')
    ax.plot_wireframe(X,Y,Z,rcount=3, ccount=5)
    ax.set_xlabel('x')
    ax.set_ylabel('y')
    ax.set_zlabel('z')
Anirban Chakraborty
  • 539
  • 1
  • 5
  • 15

1 Answers1

2

Two ways of saying the same thing. Let's say you have 1000x1000 points. If you specify rcount=10 and ccount=50, it will downsample the data so it plots 10 rows and 50 columns. If instead you say rstride=10 and cstride=50, that will take every 10th point in the rows, and every 50th point in the columns.

So, for 1000x1000, rcount=10 is the same as rstride=100. They are mutually exclusive, and clearly, you don't really need both.

Tim Roberts
  • 48,973
  • 4
  • 21
  • 30