diff options
Diffstat (limited to 'Tutorial02-Plots')
-rw-r--r-- | Tutorial02-Plots/Data/README.md | 1 | ||||
-rw-r--r-- | Tutorial02-Plots/Data/Tut2_data1.csv | 15 | ||||
-rw-r--r-- | Tutorial02-Plots/Problems/README.md | 1 | ||||
-rw-r--r-- | Tutorial02-Plots/Problems/Tut2.pdf | bin | 0 -> 29099 bytes | |||
-rw-r--r-- | Tutorial02-Plots/Problems/Tut2Problem.csv | 15 | ||||
-rw-r--r-- | Tutorial02-Plots/README.md | 1 | ||||
-rw-r--r-- | Tutorial02-Plots/Scilab_code/README.md | 1 | ||||
-rw-r--r-- | Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce | 28 | ||||
-rw-r--r-- | Tutorial02-Plots/Scilab_code/Tutotial2_multi_plotting.sce | 38 | ||||
-rw-r--r-- | Tutorial02-Plots/Scilab_code/Tutotial2_plot_save.sce | 32 | ||||
-rw-r--r-- | Tutorial02-Plots/Scilab_code/Tutotial2_plot_save_func.sce | 27 | ||||
-rw-r--r-- | Tutorial02-Plots/Scilab_code/Tutotial2_plotting.sce | 16 | ||||
-rw-r--r-- | Tutorial02-Plots/Scilab_code/change_plot_attribs.sci | 10 |
13 files changed, 185 insertions, 0 deletions
diff --git a/Tutorial02-Plots/Data/README.md b/Tutorial02-Plots/Data/README.md new file mode 100644 index 0000000..a8e89e2 --- /dev/null +++ b/Tutorial02-Plots/Data/README.md @@ -0,0 +1 @@ +# Data for scientific plotting diff --git a/Tutorial02-Plots/Data/Tut2_data1.csv b/Tutorial02-Plots/Data/Tut2_data1.csv new file mode 100644 index 0000000..974af87 --- /dev/null +++ b/Tutorial02-Plots/Data/Tut2_data1.csv @@ -0,0 +1,15 @@ +1,3.33333333333333E-05,3.33333333333333E-06,3.33333333333333E-06,0.0036866667 +2,7.33333333333333E-05,0,3.33333333333333E-06,0.0038966667 +3,2.33333333333333E-05,0,3.33333333333333E-06,0.00365 +4,0.00003,0,6.66666666666667E-06,0.0036866667 +5,3.33333333333333E-05,0,3.33333333333333E-06,0.0037333333 +6,3.33333333333333E-05,0,3.33333333333333E-06,0.0037933333 +7,0.00004,0,3.33333333333333E-06,0.00385 +8,0.00004,3.33333333333333E-06,0.00001,0.0038766667 +9,0.00005,3.33333333333333E-06,3.33333333333333E-06,0.0041033333 +10,4.66666666666667E-05,0.00001,6.66666666666667E-06,0.0039433333 +11,0.00004,3.33333333333333E-06,6.66666666666667E-06,0.00392 +12,0.00005,0.00001,0.00001,0.0040733333 +13,5.66666666666667E-05,0.00001,0.00001,0.0040966667 +14,6.33333333333333E-05,6.66666666666667E-06,1.66666666666667E-05,0.0042166667 +15,5.66666666666667E-05,6.66666666666667E-06,0.00001,0.00409 diff --git a/Tutorial02-Plots/Problems/README.md b/Tutorial02-Plots/Problems/README.md new file mode 100644 index 0000000..5a77a1e --- /dev/null +++ b/Tutorial02-Plots/Problems/README.md @@ -0,0 +1 @@ +# Problems for scientific plotting diff --git a/Tutorial02-Plots/Problems/Tut2.pdf b/Tutorial02-Plots/Problems/Tut2.pdf Binary files differnew file mode 100644 index 0000000..ddc5da8 --- /dev/null +++ b/Tutorial02-Plots/Problems/Tut2.pdf diff --git a/Tutorial02-Plots/Problems/Tut2Problem.csv b/Tutorial02-Plots/Problems/Tut2Problem.csv new file mode 100644 index 0000000..53ce715 --- /dev/null +++ b/Tutorial02-Plots/Problems/Tut2Problem.csv @@ -0,0 +1,15 @@ +1,1.05E-14,1E-23,8.68735727748734E-16,3.06988472271084E-16 +2,1.05E-14,1E-23,8.68735727748734E-16,3.06988472271084E-16 +3,1.00E-14,3.70119513918373E-17,2.79736087695949E-15,2.80391266864912E-16 +4,3.70E-14,5.65E-14,1.04559200525073E-14,7.3865291428153E-16 +5,3.70E-14,1.4571218255213E-18,7.01651859869889E-15,8.11719142528036E-16 +6,1.00E-15,1.17015966442439E-18,7.7095815167149E-15,2.05292485680238E-13 +7,3.70E-15,3.80212541554568E-19,2.15320675526335E-14,1.19013817278563E-14 +8,3.70E-15,5.85059486105432E-20,1.54664178302948E-14,8.79191968097034E-13 +9,1.11E-14,3.76606511037024E-17,3.26447099775275E-14,7.32859431036281E-13 +10,3.70074341541719E-17,2.42958520611185E-19,3.81298644807883E-14,4.28588268926054E-12 +11,1E-23,1.78899096261478E-18,1.35509320162881E-13,1.01359319772089E-12 +12,1E-23,2.42863790449231E-19,1.71955664104378E-13,3.2126484715214E-13 +13,1.11022302462516E-16,1.68809380852638E-16,6.08815500389293E-13,7.94331887098062E-14 +14,1.11022302462516E-16,3.40508595605121E-16,3.84924467610673E-13,4.54796283179633E-15 +15,1.57009245868378E-16,3.78577179124018E-16,5.2850172570156E-13,1.20783040520019E-11 diff --git a/Tutorial02-Plots/README.md b/Tutorial02-Plots/README.md new file mode 100644 index 0000000..f99bc98 --- /dev/null +++ b/Tutorial02-Plots/README.md @@ -0,0 +1 @@ +# Scientific plotting diff --git a/Tutorial02-Plots/Scilab_code/README.md b/Tutorial02-Plots/Scilab_code/README.md new file mode 100644 index 0000000..150fc44 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/README.md @@ -0,0 +1 @@ +# Scilab code for scientific plotting diff --git a/Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce b/Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce new file mode 100644 index 0000000..9acc3a6 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutorial2_semilog.sce @@ -0,0 +1,28 @@ +//This script demonstrate multi-plotting in Scilab +clear +clc +exec change_plot_attribs.sci; + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); + +//Segregate the data into variables +y = Data(:,1); +x = [Data(:,4) Data(:,5)] + +//Style of plot +style_plot = [1,2] + +//Figure 1 is a semilog plot +fig1 = scf(); +plot2d(y,x,[1,2],logflag="nl") +legends(['Length of x1','Length of x3'],style_plot,opt="ur",font_size=1); +change_plot_attribs('Time','Data','Sample semi-log plot',5,5,3) + + +//Figure 2 is a loglog plot +fig2 = scf(); +plot2d(y,x,style_plot,logflag="ll") +legends(['Length of x1','Length of x3'],style_plot,opt="ur",font_size=1); +change_plot_attribs('Time','Data','Figure2 (loglog)',5,5,3) + diff --git a/Tutorial02-Plots/Scilab_code/Tutotial2_multi_plotting.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_multi_plotting.sce new file mode 100644 index 0000000..ec5b193 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutotial2_multi_plotting.sce @@ -0,0 +1,38 @@ +//This script demonstrates multi-plotting in Scilab +clear +clc +exec change_plot_attribs.sci; + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); + +//Segregate the data into variables +t = Data(:,1); +x = [Data(:,2:4)] + +//Style of plot +style_plot = [1,2,4] + +//Fixing the range of plot +//Range is defined by [xmin,ymin,xmax,ymax] +range_of_plot = [1,-1e-5,15,8e-05]; + +//Plotting y versus two data sets +//plot2d(t,x,style_plot); +plot2d(t,x,style_plot,rect=range_of_plot); + +//Font size and labels for legends +//For legends "ur" for upper right +legends(['x1','x2', 'x3'],style_plot,opt="ur",font_size=2); + +//Call function to change plot attributes +change_plot_attribs('Time','Data','Data versus Time',5,5,3) + +//For thickness of the plots +attrib = gcf(); +attrib.children(2).children(1).children.thickness = 3; + + + + + diff --git a/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save.sce new file mode 100644 index 0000000..a3da8f3 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save.sce @@ -0,0 +1,32 @@ +//This script demonstrate exporting plots to svg/pdf files +clear +clc + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); + +//Segregate the data into variables +t = Data(:,1); +x = Data(:,2) + +//Ploting the figure. Name of the figure is fig1; +//Use the field Linewidth to specify thickness of the plot +fig1 = scf(1); +plot(t,x,'Linewidth',3); + +//Adding title, xlabels and ylabels +//Changing thickness and textsize in plot +attrib_axes = gca(); //Attributes of axes of active handle +attrib_axes.x_label.text = 'Time'; //X-label +attrib_axes.y_label.text = 'Data'; //Y-label +attrib_axes.title.text = 'x versus t'; //Title of the plot +attrib_axes.x_label.font_size = 5; //X_label font size +attrib_axes.y_label.font_size = 5; //Y_label font size +attrib_axes.title.font_size = 5; //Title font size +attrib_axes.font_size = 4; //Font size of x-axis and y-axis + +//Export Figure 1 as svg file +xs2svg(fig1,'plot_y_versus_x1'); + +//Export Figure 2 as pdf file +xs2pdf(fig1,'plot_y_versus_x1'); diff --git a/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save_func.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save_func.sce new file mode 100644 index 0000000..d8f9963 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutotial2_plot_save_func.sce @@ -0,0 +1,27 @@ +//This script demonstrate exporting plots to svg/pdf files +clear +clc + +exec change_plot_attribs.sci; + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); + +//Segregate the data into variables +t = Data(:,1); +x = Data(:,2) + +//Ploting the figure. Name of the figure is fig1; +//Use the field Linewidth to specify thickness of the plot +fig1 = scf(1); +plot(t,x,'Linewidth',3); + +//Call function to change plot attributes +//Arguments (x_label,y_label,title,label_size,title_size,fontsize) +change_plot_attribs('Time','Data','x versus t',7,6,3) + +//Export Figure 1 as svg file +xs2svg(fig1,'plot_y_versus_x1'); + +//Export Figure 2 as pdf file +xs2pdf(fig1,'plot_y_versus_x1'); diff --git a/Tutorial02-Plots/Scilab_code/Tutotial2_plotting.sce b/Tutorial02-Plots/Scilab_code/Tutotial2_plotting.sce new file mode 100644 index 0000000..5494863 --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/Tutotial2_plotting.sce @@ -0,0 +1,16 @@ +//This script demonstrate basic plot command in Scilab +clear +clc + +//Import data from file +Data = csvRead('/home/chayan/Documents/scilab-tutorials/Tutorial2_Plot/Data/Tut2_data1.csv'); + +//Segregate the data into variables +t = Data(:,1); +x = Data(:,2); + +//Plotting x versus t +plot(t,x); + +xtitle('A x versus t plot','Time','Data') + diff --git a/Tutorial02-Plots/Scilab_code/change_plot_attribs.sci b/Tutorial02-Plots/Scilab_code/change_plot_attribs.sci new file mode 100644 index 0000000..68a04bd --- /dev/null +++ b/Tutorial02-Plots/Scilab_code/change_plot_attribs.sci @@ -0,0 +1,10 @@ +function change_plot_attribs(xlab,ylab,caption,labelsize,capsize,fontsize) + attrib_axes = gca(); //Attributes of axes of active handle + attrib_axes.x_label.text = xlab; //X-label + attrib_axes.y_label.text = ylab; //Y-label + attrib_axes.title.text = caption; //Title of the plot + attrib_axes.x_label.font_size = labelsize; //X_label font size + attrib_axes.y_label.font_size = labelsize; //Y_label font size + attrib_axes.title.font_size = capsize; //Title font size + attrib_axes.font_size = fontsize; //Font size of x-axis and y-axis +endfunction |