Home > other >  Hide the axes failure
Hide the axes failure

Time:09-28

Every time run the following code cannot hide axes, but each time the second run axis can hide success,
 
The import matplotlib. Pyplot as PLT

The from randow_walk import RandomWalk

# as long as the program is active, have been simulated random walk
While True:
# to create a RandWalk instance, map points and include them out
Rw=RandomWalk ()
Rw. Fill_walk ()

Point_numbers=list (range (rw. Num_points))
PLT. Scatter (rw) x_values [0], rw. Y_values [0], s=50 edgecolors="none", c="red")
PLT. Scatter (rw) x_values [1], rw. Y_values [1], s=50 edgecolors="none", c="blue")
PLT. Scatter (rw) x_values, rw. Y_values, s=1, c=point_numbers, cmap=PLT) cm. YlGn, edgecolors="none")
PLT. The show ()

# hidden axes
PLT. Axes (.) get_xaxis () set_visible (False)
PLT. Axes (.) get_yaxis () set_visible (False)


Keep_running=input (" Make another walk? (y/n) : ")
If keep_running=="n" :
Break

However, after I added this code, axis can't hide, want to ask next bosses is this why?
 
# set the size of the graphics window
PLT. Figure (dpi=136, figsize=(14.03, 7.89))

Generate figure is as follows:

CodePudding user response:

do you want to achieve this kind of style:


is a kind of style:
  • Related