Created
October 17, 2019 15:22
-
-
Save ansemjo/87f341a04816b3579ebc8fa5cefb22a3 to your computer and use it in GitHub Desktop.
gnuplot script to plot data from Google Trends for embedding in LaTeX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/gnuplot -c | |
# Plot data from Google Trends. Optimized for multiple year timespan. | |
# Download the desired data as CSV and delete the first two lines. | |
# Maybe edit the column headers to remove your locality. USAGE: | |
# $ sed -i 1,2d multiTimeline.csv | |
# $ chmod +x trends.gnuplot | |
# $ ./trends.gnuplot multiTimeline.csv "Interest in ..." | |
# data format | |
DATA = ARG1 | |
set datafile separator "," | |
set xdata time | |
set timefmt "%Y-%m" | |
# axes and labels | |
set title sprintf("%s\nData source: Google Trends (https://www.google.com/trends)", ARG2) | |
set format x "%Y" | |
set xlabel "Year" offset 0,0.3 | |
set ylabel "Interest" offset 1.7,0 | |
set ytics 25 | |
set xtics 31536000 | |
set grid | |
# output format | |
set monochrome | |
set terminal pdfcairo size 15cm,5cm dl 0.5 | |
set output sprintf("%s.pdf", DATA) | |
# legend format | |
set key autotitle columnhead | |
set key top left | |
plot for [col=2:*] DATA using 1:col with line |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: