PtyLab / PtyLab.py

Python implementation of ptylab
Other
18 stars 8 forks source link

Bug under `ObjectProbeErrorPlot()` #49

Closed ShantanuKodgirwar closed 9 months ago

ShantanuKodgirwar commented 1 year ago

Hi everyone,

This line causes an error when ObjectProbeErrorPlot() is called, which is pretty much every time you do mPIE.reconstruct(). The line is:

self.ax_error_metric.grid(
    b=True, which="minor", color="#999999", linestyle="-", alpha=0.2
)

I am using Matplotlib 3.7.2 (latest) and the error message is as follows:

ValueError: keyword grid_b is not recognized; valid keywords are 'size', 'width', 'color', 'tickdir', 'pad', 'labelsize', 'labelcolor', 
'zorder', 'gridOn', 'tick1On', 'tick2On', 'label1On', 'label2On', 'length', 'direction', 'left', 'bottom', 'right', 'top', 'labelleft', 
'labelbottom', 'labelright', 'labeltop', 'labelrotation', 'grid_agg_filter', 'grid_alpha', 'grid_animated', 'grid_antialiased', 
'grid_clip_box', 'grid_clip_on', 'grid_clip_path', 'grid_color', 'grid_dash_capstyle', 'grid_dash_joinstyle', 'grid_dashes', 'grid_data', 
'grid_drawstyle', 'grid_figure', 'grid_fillstyle', 'grid_gapcolor', 'grid_gid', 'grid_in_layout', 'grid_label', 'grid_linestyle', 'grid_linewidth', 
'grid_marker', 'grid_markeredgecolor', 'grid_markeredgewidth', 'grid_markerfacecolor', 'grid_markerfacecoloralt', 
'grid_markersize', 'grid_markevery', 'grid_mouseover', 'grid_path_effects', 'grid_picker', 'grid_pickradius', 'grid_rasterized', 
'grid_sketch_params', 'grid_snap', 'grid_solid_capstyle', 'grid_solid_joinstyle', 'grid_transform', 'grid_url', 'grid_visible', 'grid_xdata', 
'grid_ydata', 'grid_zorder', 'grid_aa', 'grid_c', 'grid_ds', 'grid_ls', 'grid_lw', 'grid_mec', 'grid_mew', 'grid_mfc', 'grid_mfcalt', 'grid_ms'

I am not sure what was the usage of the argument b=True here, however, as suggested by the error, it is not recognized. Is there a specific matplotlib version where this works, which should perhaps be specified?

Another option is to simply remove this argument or replace it with another argument. My guess was to use animated=True which works for me. So my fix was simply:

self.ax_error_metric.grid(
    animated=True, which="minor", color="#999999", linestyle="-", alpha=0.2
)
dboonz commented 9 months ago

Hi Shantanu, well spotted, I just ran into this as well. Feel free to fix.

ShantanuKodgirwar commented 9 months ago

Sure!