Christian Feuersaenger | 1 Feb 2010 16:38
Picon
Favicon

Re: using pgfplots to modify columns before plotting

Hello Paul,

If I understand correctly, the following snippet might help:

\begin{tikzpicture}
\begin{axis}[options]
  \addplot [plot_options]
    table [x = colname1, y expr=\thisrow{colname2} * -1] {datafile.dat}
\end{axis}
\end{tikzpicture}

It sets y by an expression where `\thisrow{<colname>}' refers to the
actual row of the input table.

Best regards

Christian

Original message:
I'm trying to plot a set of data from a file containing columns of space
separated numbers with headings. I can plot the data really nicely using
pgfplots, but I would like to multiply all the data in a particular column
by -1 on-the-fly beforehand. I've been trying to use something like the
snippet below, but with no particular success!

\begin{tikzpicture}
	\begin{axis}[options]
		\addplot [plot_options]   table [x = colname1, y=colname2,
columns/colname2/.append style={multiply -1}] {datafile.dat}
	\end{axis}
(Continue reading)

Christian Feuersaenger | 1 Feb 2010 20:43
Picon
Favicon

Re: PGFplots and \foreach command

Hello azoun, (and  Sebastián and Daniel),

I can reveal the mysteries of expansion problems which occur in

foreach \x / \y in {1/green,2/red,3/brown,4/orange,5/yellow}
	\addplot[color=\y,line width=2pt]  table[x index=0,y index=\x]{grafici/array.dat};

and also why the alternative suggestion
     \foreach \p in {1,2,3,4,5}{
                \addplot table[x index=0, yindex=\p] {grafici/array.dat};
            }

works correctly. I can also provide a solution which works.

The reason is as follows: \addplot doesn't visualize anything. It performs a survey over every
coordinate, some sort of preprocessing step (in which it mainly calculates the data ranges). During the
preprocessing step, everything which involves data is expanded. Thus, it is safe to use local macros
(like loop arguments) for this purpose. Examples are
- \addplot table[y index=\p] ...

- \foreach \x in {0,1,2} {
	\addplot table {mytable_\p.dat}
}
- ...
The actual visualization is performed in \end{axis}: \end{axis} starts the visualization phase. Now,
the drawing color (and other visualization related attributes) are used and validated. And color=\y is
undefined because now, '\y' is no longer known. The solution must insert the *value* of \y instead.

TeX provides three main methods to control expansion, and one of them should be used here.
I suggest using
(Continue reading)

Sebastian Koke | 1 Feb 2010 22:45
Picon

custom tree edges + edge shadows

Dear pgf/tikz-community,

I am currently trying to make a tree-like diagram, where the thickness 
of nodes increases and the edges from the childs "flow into the parent" 
node, indicating that some quantity adds up.

Since my description may not be very clear I attached two examples for 
such a diagram: the top diagram comes close to what I would like to have 
(except the shadow problem at the arrow stemming from the fact that this 
is a node and everything als just a fill).  However coding this is not 
very comfortable as you see. This is why I started coding it using the 
trees package.

Doing this I encounter the following questions:
1. How can I reproduce the shadows correctly? (This may already be 
solved here:

http://old.nabble.com/successive-creation-of-tikz-mindmap-in-beamer-td22478489.html#a22516097 
. Unfortunately, I don't understand what I exactly have to change in 
order to get it right...)
2. Why do the edge's paths weave slightly to the outside when using the 
trees code compared to the other picture?
3. Is there a (tikz-)command to extract any information about which node 
edge I am currently drawing in order to calculate the appropiate corners 
for my custom edge path?

Thanks very much in advance,
Sebastian

------------------------------------------------------------------------
(Continue reading)

Mark Wibrow | 2 Feb 2010 00:06

Re: custom tree edges + edge shadows

Hi,

Unfortuantely you cannot put any old macro inside a path, particularly
not something defined using \newcommand. However, \pgfextra{<code>}
allows you to `escape' to normal TeX code in the middle of a path. The
key is to define a macro which defines a macro containing the path and
then insert the second macro into the path for TikZ to parse:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{tikz}
\usetikzlibrary{trees,shadows,shapes.arrows,calc}

\begin{document}

\newcommand\createConnectionPath[4]{%
	\def\connectionPath{
  (#1) .. controls +($1/2*(0,0 -| #2)-1/2*(0,0 -| #1)$) and
+($-1/2*(0,0 -| #2)+1/2*(0,0 -| #1)$) .. (#2) --
  (#3) .. controls +($1/2*(0,0 -| #4)-1/2*(0,0 -| #3)$) and
+($-1/2*(0,0 -| #4)+1/2*(0,0 -| #3)$) .. (#4) --
  (#1)}
}

\begin{tikzpicture}
[
  grow=left,
  edge from parent path={
		\pgfextra{
		\createConnectionPath{\tikzchildnode.south east}
(Continue reading)

azoun | 2 Feb 2010 09:04
Picon
Favicon

Re: PGFplots and \foreach command


WOW, with my little problem i didn't think to open so serious problem.

I am a LaTeX user, but more i go on and more i see that if you want to use
very well LaTeX, you have to learn PlainTeX so i bought The TeXbook so i
hope to get better in this way.

Many thanks Christian Feuersaenger for you answer and for PGFplots package.

Azoun
--

-- 
View this message in context: http://old.nabble.com/PGFplots-and-%5Cforeach-command-tp27378942p27416672.html
Sent from the pgf-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
Daniel Alonso Alemany | 2 Feb 2010 15:23

Re: PGFplots and \foreach command

Excerpts from Christian Feuersaenger's message of dl feb 01 20:43:15 +0100 2010:
> Hello azoun, (and  Sebastián and Daniel),

Hey Christian.

> I can reveal the mysteries of expansion problems which occur in
> 
> foreach \x / \y in {1/green,2/red,3/brown,4/orange,5/yellow}
>     \addplot[color=\y,line width=2pt]  table[x index=0,y index=\x]{grafici/array.dat};
> 
> and also why the alternative suggestion
>      \foreach \p in {1,2,3,4,5}{
>                 \addplot table[x index=0, yindex=\p] {grafici/array.dat};
>             }
> 
> works correctly. I can also provide a solution which works.
> 
> The reason is as follows: \addplot doesn't visualize anything. It performs a survey over every
coordinate, some sort of preprocessing step (in which it mainly calculates the data ranges). During the
preprocessing step, everything which involves data is expanded. Thus, it is safe to use local macros
(like loop arguments) for this purpose. Examples are
> - \addplot table[y index=\p] ...
> 
> - \foreach \x in {0,1,2} {
>     \addplot table {mytable_\p.dat}
> }
> - ...
> The actual visualization is performed in \end{axis}: \end{axis} starts the visualization phase. Now,
the drawing color (and other visualization related attributes) are used and validated. And color=\y is
undefined because now, '\y' is no longer known. The solution must insert the *value* of \y instead.
(Continue reading)

Alexis Wilhelm | 2 Feb 2010 18:24
Picon

Changing pgfkeys' default path in a scope

Hi.

I would like to define styles for UML diagrams and be able to use them
in UML diagrams only. I am using the code below:

       \tikzset{
       uml/.style={uml/.cd},
       uml/class/.style={draw},
       }

       \begin{tikzpicture}[uml]
       \node [class] {MyClass};
       \end{tikzpicture}

I want the key /tikz/uml/class to be available in every scope styled
with /tikz/uml. In the example above, the node should look like a
class. But I get this error:

       ! Package pgfkeys Error: I do not know the key '/tikz/class'
       and I am going to ignore it. Perhaps you misspelled it.

pgfkeys seems to switch back to /tikz before the node is rendered. How
may I get the behavior I originally expected?

Thanks,
Alexis Wilhelm

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
(Continue reading)

Malte Vesper | 2 Feb 2010 23:27
Picon

Matrix column seperation problem

Hi,
I am Trying to include a matrix in my Image and I want NO spacing
between rows, or columns, however without the added negative margin (see
almost minimal example below),
I aways get a slight gap after the second row. While the workarround
works for me, I was wondering weather this is a bug or just a lack of
knowledge on my behalf.

Greetings Malte

P.S.: the extra libs are in there since I need thos for other pictures
in my document.

Example:

\documentclass{scrreprt}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc,matrix}
\begin{document}
\begin{tikzpicture}

\tikzset{every node/.style={minimum height=3em,minimum width=3em}};

\matrix[matrix of math nodes, nodes=draw, row sep={0cm,between borders}]{
     a_0 & a_4 & a_8 & a_{12} \\
     a_1 & a_5 & a_9 & a_{13} \\[-0.01cm,between borders] %bug??
     a_2 & a_6 & a_{10} & a_{14} \\
     a_3 & a_7 & a_{11} & a_{15} \\
};
\end{tikzpicture}
(Continue reading)

Wilfred van Rooijen | 3 Feb 2010 00:54
Picon
Favicon

Re: Matrix column seperation problem

Hello Malte,

I don't understand. In your example, TikZ draws a border around each individual matrix element. Thus, the
"internal borders" are all twice as thick as the "outer borders" (check your output with 400%
magnification). If you add the negative space, then the internal border between rows 2 and 3 becomes
artificially thin, and I think that that is not what you want.

I think you are chasing a ghost: you PDF reader needs to "readjust" the material so that it can be translated
into pixels for display on the screen. Thus, the borders in your example are sometimes translated to 1
pixel, sometimes 2 pixels. If you print on a high-resolution printer, you would probably see that in your
example, one line is "thinner" than the others.

Regards,
Wilfred van Rooijen

--- On Wed, 3/2/10, Malte Vesper <m_v_ <at> gmx.net> wrote:

> From: Malte Vesper <m_v_ <at> gmx.net>
> Subject: [Pgf-users] Matrix column seperation problem
> To: pgf-users <at> lists.sourceforge.net
> Date: Wednesday, 3 February, 2010, 7:27 AM
> Hi,
> I am Trying to include a matrix in my Image and I want NO
> spacing
> between rows, or columns, however without the added
> negative margin (see
> almost minimal example below),
> I aways get a slight gap after the second row. While the
> workarround
> works for me, I was wondering weather this is a bug or just
(Continue reading)

Malte Vesper | 3 Feb 2010 10:37
Picon

Placing Arrows midway

Hi,
Is there a convienient way to place an arrow midwy on a path like so:

----------------->-------------------
A                      B                            C

without the need to draw to paths (one from A to B with arrow, and one 
from B to C without arrow)

Greetings Malte

P.S.: I am sorry to bother you but googeling for arrows tikz and midway 
turned up everything but an uitable example

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

Gmane