diff --git a/tools/plot_Ascan.py b/tools/plot_Ascan.py index cabeeb98..badad769 100644 --- a/tools/plot_Ascan.py +++ b/tools/plot_Ascan.py @@ -103,7 +103,7 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False): ax1.set_xlabel('Time [s]') ax1.set_ylabel(outputtext + ' field strength [V/m]') ax1.set_xlim([0, np.amax(time)]) - ax1.grid() + ax1.grid(which='both', axis='both', linestyle='-.') # Plot frequency spectra markerline, stemlines, baseline = ax2.stem(freqs[pltrange], power[pltrange], '-.') @@ -113,7 +113,7 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False): line2 = ax2.plot(freqs[pltrange], power[pltrange], 'r', lw=2) ax2.set_xlabel('Frequency [Hz]') ax2.set_ylabel('Power [dB]') - ax2.grid() + ax2.grid(which='both', axis='both', linestyle='-.') # Change colours and labels for magnetic field components or currents if 'H' in outputs[0]: @@ -137,7 +137,7 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False): line = ax.plot(time, outputdata, 'r', lw=2, label=outputtext) ax.set_xlim([0, np.amax(time)]) # ax.set_ylim([-15, 20]) - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') if 'H' in output: plt.setp(line, color='g') @@ -214,7 +214,7 @@ def mpl_plot(filename, outputs=Rx.defaultoutputs, fft=False): ax.set_ylabel(outputtext + ', current [A]') for ax in fig.axes: ax.set_xlim([0, np.amax(time)]) - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Save a PDF/PNG of the figure # fig.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_rx' + str(rx) + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1) diff --git a/tools/plot_Bscan.py b/tools/plot_Bscan.py index 1029ba34..ad4223d3 100644 --- a/tools/plot_Bscan.py +++ b/tools/plot_Bscan.py @@ -49,7 +49,11 @@ def mpl_plot(filename, outputdata, dt, rxnumber, rxcomponent): plt.xlabel('Trace number') plt.ylabel('Time [s]') # plt.title('{}'.format(filename)) - plt.grid() + + # Grid properties + ax = fig.gca() + ax.grid(which='both', axis='both', linestyle='-.') + cb = plt.colorbar() if 'E' in rxcomponent: cb.set_label('Field strength [V/m]') diff --git a/tools/plot_antenna_params.py b/tools/plot_antenna_params.py index dfbafbc6..18bd303e 100644 --- a/tools/plot_antenna_params.py +++ b/tools/plot_antenna_params.py @@ -188,7 +188,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, ax.set_xlabel('Time [s]') ax.set_ylabel('Voltage [V]') ax.set_xlim([0, np.amax(time)]) - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot frequency spectra of incident voltage ax = plt.subplot(gs1[0, 1]) @@ -200,7 +200,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, ax.set_title('Incident voltage') ax.set_xlabel('Frequency [Hz]') ax.set_ylabel('Power [dB]') - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot incident current ax = plt.subplot(gs1[1, 0]) @@ -209,7 +209,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, ax.set_xlabel('Time [s]') ax.set_ylabel('Current [A]') ax.set_xlim([0, np.amax(time)]) - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot frequency spectra of incident current ax = plt.subplot(gs1[1, 1]) @@ -221,7 +221,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, ax.set_title('Incident current') ax.set_xlabel('Frequency [Hz]') ax.set_ylabel('Power [dB]') - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot total voltage ax = plt.subplot(gs1[2, 0]) @@ -230,7 +230,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, ax.set_xlabel('Time [s]') ax.set_ylabel('Voltage [V]') ax.set_xlim([0, np.amax(time)]) - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot frequency spectra of total voltage ax = plt.subplot(gs1[2, 1]) @@ -242,7 +242,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, ax.set_title('Total (incident + reflected) voltage') ax.set_xlabel('Frequency [Hz]') ax.set_ylabel('Power [dB]') - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot total current ax = plt.subplot(gs1[3, 0]) @@ -251,7 +251,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, ax.set_xlabel('Time [s]') ax.set_ylabel('Current [A]') ax.set_xlim([0, np.amax(time)]) - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot frequency spectra of total current ax = plt.subplot(gs1[3, 1]) @@ -263,7 +263,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, ax.set_title('Total (incident + reflected) current') ax.set_xlabel('Frequency [Hz]') ax.set_ylabel('Power [dB]') - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot reflected (reflected) voltage # ax = plt.subplot(gs1[4, 0]) @@ -272,7 +272,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, # ax.set_xlabel('Time [s]') # ax.set_ylabel('Voltage [V]') # ax.set_xlim([0, np.amax(time)]) - # ax.grid() + # ax.grid(which='both', axis='both', linestyle='-.') # Plot frequency spectra of reflected voltage # ax = plt.subplot(gs1[4, 1]) @@ -284,7 +284,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, # ax.set_title('Reflected voltage') # ax.set_xlabel('Frequency [Hz]') # ax.set_ylabel('Power [dB]') - # ax.grid() + # ax.grid(which='both', axis='both', linestyle='-.') # Plot reflected (reflected) current # ax = plt.subplot(gs1[5, 0]) @@ -293,7 +293,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, # ax.set_xlabel('Time [s]') # ax.set_ylabel('Current [A]') # ax.set_xlim([0, np.amax(time)]) - # ax.grid() + # ax.grid(which='both', axis='both', linestyle='-.') # Plot frequency spectra of reflected current # ax = plt.subplot(gs1[5, 1]) @@ -305,7 +305,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, # ax.set_title('Reflected current') # ax.set_xlabel('Frequency [Hz]') # ax.set_ylabel('Power [dB]') - # ax.grid() + # ax.grid(which='both', axis='both', linestyle='-.') # Figure 2 # Plot frequency spectra of s11 @@ -322,7 +322,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, ax.set_ylabel('Power [dB]') # ax.set_xlim([0, 5e9]) # ax.set_ylim([-25, 0]) - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot frequency spectra of s21 if s21 is not None: @@ -337,7 +337,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, ax.set_ylabel('Power [dB]') # ax.set_xlim([0.88e9, 1.02e9]) # ax.set_ylim([-25, 50]) - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot input resistance (real part of impedance) ax = plt.subplot(gs2[1, 0]) @@ -352,7 +352,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, # ax.set_xlim([0.88e9, 1.02e9]) ax.set_ylim(bottom=0) # ax.set_ylim([0, 300]) - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot input reactance (imaginery part of impedance) ax = plt.subplot(gs2[1, 1]) @@ -366,7 +366,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, ax.set_ylabel('Reactance [Ohms]') # ax.set_xlim([0.88e9, 1.02e9]) # ax.set_ylim([-300, 300]) - ax.grid() + ax.grid(which='both', axis='both', linestyle='-.') # Plot input admittance (magnitude) # ax = plt.subplot(gs2[2, 0]) @@ -380,7 +380,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, # ax.set_ylabel('Admittance [Siemens]') # ax.set_xlim([0.88e9, 1.02e9]) # ax.set_ylim([0, 0.035]) - # ax.grid() + # ax.grid(which='both', axis='both', linestyle='-.') # Plot input admittance (phase) # ax = plt.subplot(gs2[2, 1]) @@ -394,7 +394,7 @@ def mpl_plot(filename, time, freqs, Vinc, Vincp, Iinc, Iincp, Vref, Vrefp, Iref, # ax.set_ylabel('Phase [degrees]') # ax.set_xlim([0.88e9, 1.02e9]) # ax.set_ylim([-40, 100]) - # ax.grid() + # ax.grid(which='both', axis='both', linestyle='-.') # Save a PDF/PNG of the figure # fig1.savefig(os.path.splitext(os.path.abspath(filename))[0] + '_tl_params.png', dpi=150, format='png', bbox_inches='tight', pad_inches=0.1) diff --git a/tools/plot_source_wave.py b/tools/plot_source_wave.py index 7de50d56..ad7eb0b9 100644 --- a/tools/plot_source_wave.py +++ b/tools/plot_source_wave.py @@ -136,7 +136,7 @@ def mpl_plot(w, timewindow, dt, iterations, fft=False): ax1.set_xlabel('Time [s]') ax1.set_ylabel('Amplitude') - [ax.grid() for ax in fig.axes] # Turn on grid + [ax.grid(which='both', axis='both', linestyle='-.') for ax in fig.axes] # Turn on grid # Save a PDF/PNG of the figure # fig.savefig(os.path.dirname(os.path.abspath(__file__)) + os.sep + w.type + '.pdf', dpi=None, format='pdf', bbox_inches='tight', pad_inches=0.1)