Range = 2.0 #Range for the absolute jiggle Set title 'Check this out! XKCD in Gnuplot' Execute the following script and you should see something very similar to the previous figure: set arrow from graph 0,1 to graph 0,1.1 filled set arrow from graph 1,0 to graph 1.1,0 filled set tmargin 5 set rmargin 20 set border 3 set tics nomirror set grid plot sin (x)/x lw 2. Set arrow from first 0, graph 0.95 to first 0, graph 1 size 2,3 front Arbitrary arrows can be placed on a plot using the set arrow command. Set arrow from graph 0.95, first 0 to graph 1, first 0 size 2,3 front Set style line 2 lt 1 lc rgbcolor "#0000ff" lw 4 #blue Set style line 1 lt 1 lc rgbcolor "#ff0000" lw 4 #red Set style line 11 lt 1 lc rgbcolor "#000000" lw 4 #black Set style line 10 lt 1 lc rgbcolor "#ffffff" lw 15 #thick white Set term postscript eps font 'HumorSans' fontfile 'Humor-Sans.pfa' 22 # Since I already did that, you can just use the file included in this git repository. # To use it in the eps terminal, you have to convert it to a postscript pfa format # You can download the HumorSans font from here: # gnuplot, but this is way beyond the time that I can use on this. Right now, after setting arrows, I need to give something to plot, since without that arrows don't get plotted. # The proper way to do this would be to write a xkcd terminal for In gnuplot, we draw arrow as: set arrow from 0,0 to 1,1 I want to make a plot with just arrows and no other data. For datapoints, one can do the jiggling on both # Also, when plotting functions, the jiggling can only be done in # Not a proper rendition, as the axis are still straight lines # Gnuplot file that plots a couple of functions in the xkcd style This doesn't attempt to be anywhere close to how sophisticated some of those other attempts were, as gnuplot offers much less in terms of programmability or access to the graphics pipeline than some of them, but the end result is not too bad! Also, it can certainly be improved :) It seems that all the rage these days is to get xkcd-style plots out of every plotting alternative out there.Īfter seeing the renditions of the same idea in Mathematica, Matplotlib, R and even in LaTeX!, gnuplot also deserved a shot. How to plot xkcd-style functions with gnuplot!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |