Dave's Brain

Browse - Programming Tips - gnuplot: make a simple line graph

Date: 2018apr15
Product: gnuplot

Q.  gnuplot: make a simple line graph

A.  Install gnuplot with your distro's package manager

dnf install gnuplot (On RedHat/Fedora/CentOS)
Gather your data into a text file of x,y pairs. water_level.data
2001 132 2002 141 2003 144 2004 143 2005 126 2006 133 2007 358 2008 350 2009 357 2010 371 2011 375 2012 361 2013 384 2014 387 2015 400 2016 410 2017 417
Make a .gp file. water_level.gp
set terminal pngcairo size 800,800 enhanced font 'Verdana,10'; set output 'water_level.png'; set title 'Water Levels; set xlabel 'Year'; set ylabel 'Centimetres'; plot 'water_level.data' with lines lw 2 title ''; print 'Done';
Run it:
gnulot < water_level.gp
Look at water_level.png

Add a comment

Sign in to add a comment
Copyright © 2008-2018, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.