reinforcement-learning-an-introduction icon indicating copy to clipboard operation
reinforcement-learning-an-introduction copied to clipboard

A simpler draw function

Open rohitdavas opened this issue 5 years ago • 2 comments

In chapter03 draw_image function, I think the function can be better wrote as :

![example](https://user-images.githubusercontent.com/52150408/96678148-b6e9ee00-138e-11eb-8fe7-419d1245fbe7.png)
def drawTable(matrix):
    data = np.asarray(matrix, str) 
    _, axes = plt.subplots()
    axes.set_axis_off()
    
    table(ax = axes,
          cellText=data, 
          cellLoc='center',
          bbox=[0,0,1,1], 
          edges='closed',
          )
    
    plt.savefig ("./example.png")
    plt.close() 

example

rohitdavas avatar Oct 21 '20 05:10 rohitdavas

But this method seems to ignore the markers A, B? Maybe we can add another function parse_matrix and then write the code like

def drawTable(matrix):
    data = parse_matrix(matrix)

And move the logic of adding markers A into the function parse_matrix

Michael1015198808 avatar Dec 08 '20 06:12 Michael1015198808

Yes. The purpose of this is to draw any matrix. I didn’t pass A,B annotated matrix to draw, otherwise it would have plotted so.

rohitdavas avatar Jan 17 '21 09:01 rohitdavas