Gnu plot plotting box plot with error bar

26 Views Asked by At

I am trying to plot box plot with error bar for each of the data in the following file this code doesn’t work:

file = 'question8.txt'
header = system('head -1 ' . file)
array = ''
split(header, array)
start_year = 2000
end_year = 2015

set xtics ('' 1)
set for [i=start_year:end_year] xtics add (word(array, i - start_year + 1) i)

set style data boxplot
unset key

plot for [i=start_year:end_year] file using i:i with yerrorbars

This is the data:

Year:  Avg Temperature:  Max Temperature:  Min Temperature:
1850              7.90              8.95             -2.44
1851              8.18              8.47             -2.76
1852              8.10              8.97             -2.82
1853              8.04              8.79             -3.55
1854              8.21              8.22             -3.12
1855              8.11              7.30             -3.73
1856              8.00              6.64             -5.41
1857              7.76              9.04             -2.69
1858              8.10              8.07             -2.70
1859              8.25              9.77             -2.06
1860              7.96              7.74             -3.26
1861              7.85              7.36             -4.11
1862              7.56              8.46             -1.77
1863              8.11              7.07             -3.85
1864              7.98              8.84             -3.21
1865              8.18              8.19             -2.92
1866              8.29              8.14             -3.31
1867              8.44              7.61             -3.48
1868              8.25              8.21             -3.17
1869              8.43              8.53             -3.31
1870              8.20              7.96             -2.94
1871              8.12              8.23             -3.23
1872              8.19              8.28             -3.44
1873              8.35              7.38             -3.76
1874              8.43              6.68             -4.72
1875              7.86              7.33             -3.33
1876              8.08              8.08             -3.16
1877              8.54              8.28             -3.08
1878              8.83              8.56             -3.31
1879              8.17              7.88             -3.37
1880              8.12              7.34             -3.69
1881              8.27              8.39             -3.02
1882              8.13              7.06             -4.52
1883              7.98              7.57             -4.12
1884              7.77              6.42             -4.62
1885              7.92              7.02             -3.76
1886              7.95              6.86             -4.68
1887              7.91              6.69             -4.30
1888              8.09              7.38             -4.05
1889              8.32              7.65             -4.24
1890              7.97              7.59             -4.01
1891              8.02              7.68             -3.93
1892              8.07              5.90             -5.34
1893              8.06              7.41             -4.04
1894              8.16              6.96             -4.32
1895              8.15              7.92             -3.41
1896              8.21              7.41             -3.57
1897              8.29              8.35             -2.88
1898              8.18              8.44             -3.26
1899              8.40              7.19             -4.10
1900              8.50              8.00             -3.49
1901              8.54              8.80             -3.03
1902              8.30              8.41             -3.19
1903              8.22              7.08             -3.86
1904              8.09              8.02             -3.32
1905              8.23              8.09             -3.64
1906              8.38              7.90             -3.87
1907              7.95              8.12             -3.55
1908              8.19              7.12             -4.30
1909              8.18              8.10             -3.27
1910              8.22              7.13             -3.97
1911              8.18              7.91             -3.31
1912              8.17              7.66             -3.66
1913              8.30              8.82             -2.33
1914              8.59              7.90             -3.42
1915              8.59              8.31             -2.93
1916              8.23              7.85             -3.78
1917              8.02              7.55             -3.80
1918              8.13              7.65             -3.40
1919              8.38              8.44             -2.94
1920              8.36              8.74             -2.71
1921              8.57              7.60             -3.43
1922              8.41              8.21             -3.19
1923              8.42              7.91             -3.50
1924              8.51              7.48             -3.18
1925              8.53              8.78             -2.22
1926              8.73              7.93             -3.51
1927              8.52              8.29             -2.63
1928              8.63              7.48             -3.66
1929              8.24              7.67             -3.17
1930              8.63              8.06             -2.90
1931              8.72              9.16             -2.05
1932              8.71              7.38             -3.45
1933              8.34              7.99             -3.13
1934              8.63              7.74             -3.62
1935              8.52              7.81             -3.53
1936              8.55              7.88             -3.22
1937              8.70              8.42             -2.60
1938              8.86              8.53             -2.77
1939              8.76              7.94             -3.35
1940              8.76              8.35             -3.01
1941              8.77              8.72             -2.61
1942              8.73              8.02             -3.28
1943              8.76              9.04             -1.93
1944              8.85              8.13             -2.91
1945              8.58              8.48             -2.55
1946              8.68              8.11             -2.99
1947              8.80              9.14             -2.35
1948              8.75              8.84             -2.43
1949              8.59              7.61             -3.62
1950              8.37              7.77             -3.52
1951              8.63              8.66             -2.58
1952              8.64              8.54             -2.63
1953              8.87              7.67             -3.58
1954              8.56              8.91             -2.03
1955              8.63              7.91             -3.06
1956              8.28              8.01             -2.97
1957              8.73              8.98             -1.77
1958              8.77              8.39             -2.41
1959              8.73              8.22             -2.62
1960              8.58              8.38             -2.38
1961              8.80              8.66             -2.51
1962              8.75              8.67             -2.68
1963              8.86              8.38             -2.55
1964              8.41              8.42             -2.53
1965              8.53              8.05             -3.04
1966              8.60              8.40             -2.87
1967              8.70              7.87             -3.06
1968              8.52              7.23             -3.30
1969              8.60              8.29             -2.58
1970              8.70              8.53             -2.53
1971              8.60              7.39             -3.55
1972              8.50              8.49             -2.31
1973              8.95              7.46             -2.89
1974              8.47              8.48             -2.26
1975              8.74              8.40             -2.45
1976              8.35              7.76             -2.65
1977              8.85              8.01             -2.52
1978              8.69              8.07             -2.62
1979              8.73              8.47             -2.46
1980              8.98              9.27             -1.30
1981              9.17              8.09             -2.78
1982              8.64              8.75             -1.65
1983              9.03              8.34             -2.23
1984              8.69              8.39             -2.22
1985              8.66              8.82             -2.01
1986              8.83              8.70             -2.34
1987              8.99              8.86             -1.80
1988              9.20              8.10             -2.60
1989              8.92              8.56             -1.94
1990              9.23              8.51             -1.91
1991              9.18              8.91             -1.65
1992              8.84              8.67             -1.92
1993              8.87              8.34             -2.27
1994              9.04              8.90             -1.77
1995              9.35              8.35             -2.51
1996              9.04              8.59             -2.13
1997              9.20              8.56             -1.78
1998              9.52              8.88             -1.73
1999              9.29              8.35             -2.32
2000              9.20              8.83             -2.08
2001              9.41              9.46             -1.32
2002              9.57              9.56             -1.48
2003              9.53              8.90             -1.65
2004              9.32              9.03             -1.38
2005              9.70              8.62             -1.94
2006              9.53              10.08             -0.82
2007              9.73              8.15             -2.38
2008              9.43              9.18             -1.76
2009              9.51              9.24             -1.68
2010              9.70              8.72             -2.03
2011              9.52              8.69             -2.23
2012              9.51              9.26             -1.73
2013              9.61              9.33             -1.75
2014              9.57              9.43             -1.52
2015              9.83              10.73             0.29

The code isn’t giving any output

I am expecting that I have gnuplot for this data any help would be nice. I am trying to read only from 2000-2015 and post box plot with error bar for each of the data

0

There are 0 best solutions below