From 011c43bd02463b5bf3c4ab957c7eac0126d708b7 Mon Sep 17 00:00:00 2001 From: Alfredo Canziani Date: Thu, 29 May 2014 14:01:01 -0400 Subject: Update README.md Fixed typos and alignment --- README.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index fe7967f..5899432 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ specified. The possible entries of format string can be * custom string, one can also pass custom strings to use full capability of gnuplot. ```lua -x=torch.linspace(-2*math.pi,2*math.pi) +x = torch.linspace(-2*math.pi,2*math.pi) gnuplot.plot('Sin',x/math.pi,torch.sin(x),'|') ``` ![](doc/plot_xyf.png) @@ -162,7 +162,7 @@ gnuplot.plot('Sin',x/math.pi,torch.sin(x),'|') To plot multiple curves at a time, one can pass each plot struct in a table. ```lua -x=torch.linspace(-2*math.pi,2*math.pi) +x = torch.linspace(-2*math.pi,2*math.pi) gnuplot.plot({'Cos',x/math.pi,torch.cos(x),'~'},{'Sin',x/math.pi,torch.sin(x),'|'}) ``` ![](doc/plot_sincos.png) @@ -171,12 +171,12 @@ One can pass data with multiple columns and use custom gnuplot style strings too is used, the first column is assumed to be the `x` values and the rest of the columns are separate `y` series. ```lua -x=torch.linspace(-5,5) -y=torch.sin(x) +x = torch.linspace(-5,5) +y = torch.sin(x) yp = y+0.3+torch.rand(x:size())*0.1 ym = y-(torch.rand(x:size())*0.1+0.3) -yy=torch.cat(x,ym,2) -yy=torch.cat(yy,yp,2) +yy = torch.cat(x,ym,2) +yy = torch.cat(yy,yp,2) gnuplot.plot({yy,' filledcurves'},{x,yp,'lines ls 1'},{x,ym,'lines ls 1'},{x,y,'lines ls 1'}) ``` ![](doc/plot_filled.png) @@ -195,7 +195,7 @@ interactive capabilities is being used by `Gnuplot` backend (like `x11` or Plot surface ` z ` in 3D. ```lua -x=torch.linspace(-1,1) +x = torch.linspace(-1,1) xx = torch.Tensor(x:size(1),x:size(1)):zero():addr(1,x,x) xx = xx*math.pi*6 gnuplot.splot(torch.sin(xx)) @@ -209,7 +209,7 @@ to be the same shape as `z`. One can also display multiple surfaces at a time. ```lua -x=torch.linspace(-1,1) +x = torch.linspace(-1,1) xx = torch.Tensor(x:size(1),x:size(1)):zero():addr(1,x,x) xx = xx*math.pi*2 gnuplot.splot({torch.sin(xx)},{torch.sin(xx)+2}) @@ -230,7 +230,7 @@ used, however, one can also use any color palette available in `Gnuplot`. ```lua -x=torch.linspace(-1,1) +x = torch.linspace(-1,1) xx = torch.Tensor(x:size(1),x:size(1)):zero():addr(1,x,x) xx = xx*math.pi*6 gnuplot.imagesc(torch.sin(xx),'color') @@ -377,8 +377,8 @@ hidden. Only supported for gnuplot version 4.4 and above. ### gnuplot.movelegend(hloc,vloc) ### -Set the location of legend key. `hloc` can be '''left', 'right' or -'center`'. `vloc` can be `'top', 'bottom' or 'middle'''. Only +Set the location of legend key. `hloc` can be `left`, `right` or +`center`. `vloc` can be `top`, `bottom` or `middle`. Only supported for gnuplot version 4.4 and above. @@ -390,11 +390,10 @@ Sets the properties of axis for the current plot. * `image` : scales the axis aspect ratio so that a circle is drawn as circle. * `equal` : same as `image`. * `fill` : resets the aspect ratio of the plot to original values so that it fills up the canvas as good as possible. - * {xmin,xmax,ymin,ymax} : Sets the limits of x and y axes. Use an empty string (2 apostophes in a row) if you want to keep the current value. + * `{xmin,xmax,ymin,ymax}` : Sets the limits of x and y axes. Use an empty string (2 apostophes in a row) if you want to keep the current value. ### gnuplot.raw(command) ### This command is useful for advanced users of gnuplot. `command` is directly passed to gnuplot without any formatting. - -- cgit v1.2.3 From 3673ac5e5591dcaae413b6c365cb5f6eb210d5b2 Mon Sep 17 00:00:00 2001 From: Alfredo Canziani Date: Thu, 29 May 2014 14:04:41 -0400 Subject: Added example for --- README.md | 17 +++++++++++++++-- doc/plot_raw.png | Bin 0 -> 36271 bytes 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 doc/plot_raw.png diff --git a/README.md b/README.md index 5899432..c348925 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ provides a free form interface to gnuplot. ## Customizing Gnuplot Defaults ## The default styles of gnuplot can be customized using a personal `.gnuplot` file -located in the users home directory. A sample file is given below as a sample. You can -paste the contents into `$HOME/.gnuplot` file and gnuplot will use the styles +located in the users home directory. A sample file is given below as a sample. You can +paste the contents into `$HOME/.gnuplot` file and gnuplot will use the styles specified in this file. ``` @@ -397,3 +397,16 @@ Sets the properties of axis for the current plot. This command is useful for advanced users of gnuplot. `command` is directly passed to gnuplot without any formatting. +Let's see an example, by plotting labels for the `xtic` + +```lua +LondonTemp = torch.Tensor{{9, 10, 12, 15, 18, 21, 23, 23, 20, 16, 12, 9}, + {5, 5, 6, 7, 10, 13, 15, 15, 13, 10, 7, 5}} +gnuplot.plot({'High [°C]',LondonTemp[1]},{'Low [°C]',LondonTemp[2]}) +gnuplot.raw('set xtics ("Jan" 1, "Feb" 2, "Mar" 3, "Apr" 4, "May" 5, "Jun" 6, "Jul" 7, "Aug" 8, "Sep" 9, "Oct" 10, "Nov" 11, "Dec" 12)') +gnuplot.plotflush() +gnuplot.axis{0,13,0,''} +gnuplot.grid(true) +gnuplot.title('London average temperature') +``` +![](doc/plot_raw.png) diff --git a/doc/plot_raw.png b/doc/plot_raw.png new file mode 100644 index 0000000..90ab6aa Binary files /dev/null and b/doc/plot_raw.png differ -- cgit v1.2.3 From 88ac2e98ae1d95de6afb5eb0e7723236ec1e71fe Mon Sep 17 00:00:00 2001 From: Alfredo Canziani Date: Thu, 29 May 2014 17:18:48 -0400 Subject: Update README.md Fixing fomatting --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c348925..173f02c 100644 --- a/README.md +++ b/README.md @@ -142,15 +142,15 @@ gnuplot.plot(torch.sin(x)) ``` ![](doc/plot_x.png) -In more general form, plot vector ` y vs x ` using the format +In more general form, plot vector `y` vs `x` using the format specified. The possible entries of format string can be - * '.' for dots - * '+' for points - * '-' for lines - * '+-' for points and lines - * '~' for using smoothed lines with cubic interpolation - * '|' for using boxes - * 'v' for drawing vector fiels. (In this case, x and y have to be two column vectors (x,xdelta),(y,ydelta)) + * `.` for dots + * `+` for points + * `-` for lines + * `+-` for points and lines + * `~` for using smoothed lines with cubic interpolation + * `|` for using boxes + * `v` for drawing vector fiels. (In this case, `x` and `y` have to be two column vectors `(x, xdelta)`, `(y, ydelta)`) * custom string, one can also pass custom strings to use full capability of gnuplot. ```lua -- cgit v1.2.3 From 28e40b0aec88a316b499f7a9e15a33b097fd1280 Mon Sep 17 00:00:00 2001 From: Alfredo Canziani Date: Thu, 29 May 2014 17:22:40 -0400 Subject: Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 173f02c..7a0378d 100644 --- a/README.md +++ b/README.md @@ -397,6 +397,7 @@ Sets the properties of axis for the current plot. This command is useful for advanced users of gnuplot. `command` is directly passed to gnuplot without any formatting. + Let's see an example, by plotting labels for the `xtic` ```lua -- cgit v1.2.3