//  [python]
def save_stress_as_fig(Fig,Ax,Figure_name,Xdata,Ydata,Zdata,Limits,Tick_details,Directory,Colorbar_label):
    print('1')
    Colorbar_label_fontsize=17
    Colorbar_ticklabel_size=13
    Ticklabel_size=13
    padding=0.1
    #Fig=plt.figure()
    #Ax=Fig.add_subplot(1,1,1,projection='polar')
    if not Tick_details:    use_format=None                                     #if Tick_details were not explicitly provided in PLOT_LIMITS then a default value is assumed 
    else:  use_format=OOMFormatter(Tick_details[0], mathText=True)
    Xdata=[(3.14/180)*i for i in Xdata]
    Ydata=[float(i) for i in Ydata]                         #since 'POSITION_SENSORS' radial stations are stored as strings
    f = scipy.interpolate.interp2d(Ydata, Xdata, Zdata, kind='linear')    
    Xdata=np.linspace(min(Xdata), max(Xdata), 10*len(Xdata),endpoint=True)                            
    Ydata=np.linspace(min(Ydata), max(Ydata), 10*len(Ydata),endpoint=True)   
    r,theta=np.meshgrid(Ydata, Xdata) 
    Zdata=f(Ydata,Xdata)      
    print('1')
    
####    Colorbar extension based on the fact that the prescribed limits don not sufficiently cover the entire range of Zdata    
    extension='neither'
    if Limits:
        if np.amax(Zdata)>Limits[1]:    extension='max'
        if np.amin(Zdata)<Limits[0]:    extension='min'
        if np.amax(Zdata)>Limits[1] and np.amin(Zdata)<Limits[0]:    extension='both'
    print('1')

    if Figure_name=='ALPHA': extension='both'
    if Limits:
        norm = mpl.colors.Normalize(vmin=Limits[0],vmax=Limits[1])
        pcm=Ax.pcolormesh(theta,r,Zdata,cmap='jet',shading='gouraud',vmin=Limits[0],vmax=Limits[1])
        cb=Fig.colorbar(pcm, ax=Ax,norm=norm, format=use_format, pad=padding,extend=extension)
    else:
        pcm=Ax.pcolormesh(theta,r,Zdata,cmap='jet',shading='gouraud')
        cb=Fig.colorbar(pcm, ax=Ax, format=use_format, pad=padding,extend=extension)
    print('1')
    
    if '[deg]' in  Colorbar_label:    
        cb_ticks = cb.ax.get_yticklabels()                  #returns a list of objects (not float or str)
        cb_ticks = [tick.get_text() for tick in cb_ticks]
        cb_ticks_new=[tick+r"$^\circ$" for tick in cb_ticks] #Adding degrees symbol to the colorbar ticks
        cb.ax.set_yticklabels(cb_ticks_new)
        Colorbar_label=Colorbar_label.replace(' [deg]','')    #removing '[deg]' from colorbar label
    cb.ax.tick_params(labelsize=Colorbar_ticklabel_size) 
#    if Tick_details: cb.ax.yaxis.offsetText.set(size=Colorbar_ticklabel_size)
    if 'MINUS_BASELINE' in Directory: 
        if '+' in Figure_name:
            Colorbar_label=r'$\Delta$'+'('+Colorbar_label+')'
        elif Figure_name=='FLAP_DEFLECTION_ANGLE':                  #when generating plot for flap deflection angle just keep the colorlabel without adding delta
            pass
        else:
            Colorbar_label=r'$\Delta$'+Colorbar_label                    #Adding a delta symbol to the label if the plot corrresponds to a delta quantity    
    cb.set_label(Colorbar_label,fontsize=Colorbar_label_fontsize)#,fontweight='bold')
    
    #Ax.set_xticks([0,90,180,270])
    #Ax.set_xticklabels([r'$0^\circ$',r'$90^\circ$',r'$180^\circ$',r'$270^\circ$'])
    Ax.tick_params(axis='x', labelsize=Ticklabel_size)
    Ax.set_yticklabels([])                                #Removing the radial ticks
    Fig.savefig(Directory+'/'+Figure_name+'.png')
    #print(Figure_name)
    plt.close(Fig)