Mittwoch, 4. März 2015

plot an image transparently with gnuplot

The standard way to plot a image in gnuplot is the following:
plot x
plot 'test.png' binary filetype=png with rgbimage 



with several filetypes, like jpg, png and so on. But if you want to have this image transparent you need to choose rgbalpha instead of rgbimage and use u 1:2:3:(alpha-value) with the alpha-value ranging between 0:255 as follows:

plot x
replot 'test.png' u 1:2:3:($4*0.5) binary filetype=png with rgbalpha 


Mittwoch, 25. Februar 2015

group of transparent objects tikz

if you have a group of overlaying objects and want them to be transparent, a standard procedure is that you set the transparency for each object.
But this may lead to a overlap of these transparent object and that you see the underlying whereas you actually just want to have the full combined object transparent.

You can simply solve that by placing the group of objects in a scope and set the group properties to transparent in the following way:

\begin{scope}[transparency group, opacity=0.5]
% group of objects
% more objects
\end{scope} 

Samstag, 17. Januar 2015

plot color of data point with z-value

To plot a x,y,z data file with the z-value being the color value of the x,y data point use "with linespoints palette" as following:

plot 'test.dat' u 1:2:3 with linespoints palette 

An example is shown below:

Donnerstag, 15. Januar 2015

gnuplot use figure with alpha channel

Sometimes it is desirable to plot data on top of a figure or a figure on top of a graph. In the latter case the figure has to be transparent so that the plotted data is still shown. This can be achieved via the "with rgbalpha" option as shown in the following:
plot "partly_transparent_figure.png" binary filetype=png  with rgbalpha

round numbers in tikz with pgfmath

To round numbers using pgfplots in the tikzpicture environment use \pgfmathparse to calculate the desired value and then print it to with \pgfmathprintnumber or print it to a variable with \pgfmathprintnumberto and use the optional parameter precision, as shown in the following:
\pgfmathparse{10.042/1.54}
\pgfmathprintnumberto[precision=2]{\pgfmathresult}{\value}
\value

Mittwoch, 17. Dezember 2014

layers in tikz in latex

To define a layer in tikz you would first in the preamble define a new layer with a defined name (here i chose "layer") and then set the order of the layers especially in comparison to the standard "main" layer.

\pgfdeclarelayer{layer}    % declare layer
\pgfsetlayers{layer,main}  % set the order of the layers (main is the standard layer)

in the plotting step you can then explicitly plot on a different layer by using the pgfonlayer environment

\begin{pgfonlayer}{layer}
      \draw[ultra thick] (0.0,0.0) -- ++ (1.0,0.0);
\end{pgfonlayer}

Freitag, 14. November 2014

latex trim image

to cut an image in latex you can simply use the trim option and then define then use the clip option as follow:

\includegraphics[trim={left low right top},clip]{./test.png}