I have a frivolous question. Is there any way to use an image in lieu of points in gnuplot? For example, if I was plotting data about pasta consumption or something, I would have pictures of pasta (instead of usual gnuplot points).
Another option is to find a dingbats type of font with a suitable glyph. Then you can use "plot with labels" using that glyph as the label string. See for example the 5th plot in the demo
http://gnuplot.sourceforge.net/demo/stringvar.html
I haven't played around with this feature at all myself, however, there is:
http://gnuplot.sourceforge.net/demo/barchart_art.html
Which shows the use of png files on a bar chart (Note, that this feature was added in Gnuplot 4.5 -- I think). With a little creativity, it seems like you could use that feature to do what you're asking -- although it would require a whole bunch of plot commands so it might be useful to write a script to generate the gnuplot script (or use iteration depending on your dataset) -- Obviously your image files would have to be in a format that your version of gnuplot understands as well ...
A possible strategy may be the plot with rgbimage option in gnuplot.
See the second example over here: http://www.gnuplot.info/demo_4.2/image.html
If you relate the center option with your data points, this may be possible.
Related
I want to plot a figure like this one:
but with only sketched data curves. The x and y axes should not be sketched.
Is this possible using Gnuplot?
I think you may find this link useful, since it's exactly what you are asking for :)
http://rfonseca.github.io/xkcd-gnuplot/
Essentially, it applies a function to jiggle the line and make it pseudo-hand-drawn:
jiggle(x) = x*(1+(2*rand(0)-0.5)*0.015)
plot jiggle(sin(x))
And this is the result:
You may also want to increase samples with set samples 1000 to have better results avoiding spikes in jiggled lines.
(As a curiosity, that page is inspired by a StackExchange answer, that contains a very advanced (and amazing, IMHO) approach to this problem, unfortunately only for Mathematica users.)
What is the difference between AquaTerm and gnuplot.
Also is it true that Octave uses AquaTerm instead of X11?
I know AquaTerm might be more rendering of the actual graphic and gnuplot is probably the engine but what does that means?
AquaTerm is a graphics renderer. Basically, it is a library with an API with allows various programming languages to display graphics on the screen. gnuplot is a plotting utility. In a lot of ways, gnuplot functions like a special purpose programming language used for creating plots. It is able to write those plots to a whole bunch of different devices ("terminals"). examples of some devices are files (png, pdf, postscript) printers and graphics libraries (X11, AquaTerm). Ultimately, any graph that you can make with gnuplot + AquaTerm for the display on the backend could be made without gnuplot. Gnuplot's purpose is to abstract the details of the output device away from the user as much as possible so that if you make a plot and display it using AquaTerm, you can then easily save that plot to a png file for future reference. In reality, there are always some terminal dependent behaviours, but most of the time it doesn't actually matter.
I'm trying to present data in a boxplot with a few additions.
On top of the boxplot, i want to also print all the data points, since there aren't that many.
There will be many boxplots side by side, and the data points will correspond, so each data point in one plot will be represented in another boxplot, however their order can change. That's why I want to color the points.
I got this so far:
plot data using (1):($1) with boxplot,\
data using (1):($1) with points lc variable
[more plots...]
This needs an extra column in each datafile, that specifies the linecolor. Which works fine, if I had such a column, or if I could care to add it.
Is there another way to iterate through the linestyles (or colors), so it plots the first point with style 1, the second with style 2 etc.?
It seems like a real easy problem, that's either solved by some command I can't seem to find, or maybe by taking the linestyles from a different file, which would be the same for all plots (if that works in gnuplot).
Furthermore, I'd like to know if the boxplot command has the additional feature of being able to plot the average as well (or do I absolutely need the stats command from gnuplot 4.6, or some kind of hack).
Sometimes it's just nice to be able to simply add the average in a boxplot.
Is there another way to iterate through the linestyles (or colors), so it plots the first point with style 1, the second with style 2 etc.?
Yes. Gnuplot provides a number of pseudo-columns. To get more information, see
help datafile using pseudocolumn
But the gist of it is that you can use column(0) for this. I believe that iteration starts at 0 though. Since there isn't a ls 0, you'll need to add 1.
plot data using (1):($1) with boxplot,\
data using (1):($1):(column(0)+1) with points lc variable
Furthermore, I'd like to know if the boxplot command has the additional feature of being able to plot the average as well (or do I absolutely need the stats command from gnuplot 4.6, or some kind of hack).
I believe that you need either gnuplot 4.6 or some kind of hack. One such hack (which will work using gnuplot 4.4, but not earlier) could be:
sum=0.0
npt=0
compute_sum_npt(x)=(npt=npt+1,sum=sum+x,NaN)
set term unknown
plot data u 1:(compute_sum_npt($1))
avg=sum/npt
set term ...
set output ...
plot data using (1):($1) with boxplot,\
data using (1):($1):(column(0)+1) with points lc variable,\
avg w lines ls -1
If your version of gnuplot is earlier than 4.4, you'll need to use a shell command to compute the average. Something like awk should suffice.
I want to draw the following implicit function with gnuplot
x**2+y**2+(z-1)**3-2
I know that maple or matlab can to this very simple but I want to use gnuplot.
Up to know I have no idea so I can't provide a starting point.
sorry
Here the result plotted with maple
According to the Gnuplot FAQ, this is not directly possible. There is a workaround for 2D-functions, but I don't see how this method can be applied to 3D graphs. I'd recommend solving the equation in Octave or some similar program and outputting the solutions to a file, which you can then feed into GnuPlot.
I'm looking for some tool/library that is able to draw simple 2d geometries from text file or programatically. I already found List of interactive geometry software but that not quite what I'm looking for. I would prefer something more similar in usage to graphviz or gnuplot. I already wrote some scripts for gnuplot but this tool has been designed for different purposes. Required functionality:
support for different kind of 2D geometries: points, segments, lines, circles, polygons
simple input type format maybe similar to postgis Well Known Text
support for objects additional data like tags and colors definition
output in common image format or some kind of interactive GUI (with zoom in/out and select object)
configurable grid
autoscale or draw in defined area
I will use it for testing geometry algorithms and don't want to reinvent the wheel.
Matplotlib. I'm not familiar with all the aspects of this Python library but I've heard it is pretty good.
To quote their introduction,
matplotlib is a python 2D plotting
library which produces publication
quality figures in a variety of
hardcopy formats and interactive
environments across platforms.
matplotlib can be used in python
scripts, the python and ipython shell
(ala MATLAB®* or Mathematica®†), web
application servers, and six graphical
user interface toolkits.
matplotlib tries to make easy things
easy and hard things possible. You can
generate plots, histograms, power
spectra, bar charts, errorcharts,
scatterplots, etc, with just a few
lines of code. For a sampling, see the
screenshots, thumbnail gallery, and
examples directory
(source: sourceforge.net)
>
For example, using "ipython -pylab" to
provide an interactive environment, to
generate 10,000 gaussian random
numbers and plot a histogram with 100
bins, you simply need to type
x = randn(10000)
hist(x, 100)
For the power user, you have full
control of line styles, font
properties, axes properties, etc, via
an object oriented interface or via a
set of functions familiar to MATLAB
users. The pylab mode provides all of
the pyplot plotting functions listed
below, as well as non-plotting
functions from numpy and
matplotlib.mlab.
Maybe dia, with it's SVG output option is what you're looking for? It can be scripted in Python.