Latex Tikzpictures multiple entries [closed] - latex

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 6 years ago.
Improve this question
I've got a problem with tikzpicture. I've made my cv in Latex but one thing isn't working fine. In a skill graph I got multiple entries. Here's the code.
\documentclass[]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{center}
\begin{tikzpicture}[thick,scale=0.8, every node/.style={scale=0.8},every node/.style={font=\sffamily}]
\begin{axis}[title = \textbf{Sprachen},
xbar,
y axis line style = { opacity = 0 },
axis x line = none,
tickwidth = 0pt,
%enlarge y limits={abs=1cm},
enlarge x limits = 0.02,
symbolic y coords = { Französisch, Englisch, Deutsch},
%nodes near coords,
xmin=0,
xmax=1,
]
\addplot coordinates {
(1,Deutsch)
(0.65,Englisch)
(0.3,Französisch)
};
%\legend{Topics}
\end{axis}
\node[text width=3cm] at (1.5,-0.5)
{Grundkennt.};
\node[text width=3cm] at (5.25,-0.5)
{gut};
\node[text width=3cm] at (7.4,-0.5)
{sehr gut};
\draw (2.5,0.1) -- (2.5, 5.5);
\draw (5,0.1) -- (5, 5.5);
\end{tikzpicture}
\end{center}
\end{document}
Multiple entries
Example
I hope one of you could help me.
Greetz Michi

uncomment the
enlarge y limits={abs=1cm},
and it should work, or do you want to have different distances? Then try this code:
\documentclass[]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[thick,every node/.style={font=\sffamily}]
\begin{axis}[ title=\textbf{Sprachen},
xbar,
width=12cm, height=3.5cm, enlarge y limits=0.5,
y axis line style = { opacity = 0 },
axis x line = none,
tickwidth = 0pt,
%xlabel={\#participants},
symbolic y coords={Französisch, Englisch, Deutsch},
ytick=data,
%nodes near coords,
nodes near coords align={horizontal}, ]
\addplot coordinates {(1,Deutsch) (0.65,Englisch) (0.3,Französisch)};
\end{axis}
\node[text width=3cm] at (1.5,-0.5)
{Grundkennt.};
\node[text width=3cm] at (5.25,-0.5)
{gut};
\node[text width=3cm] at (7.4,-0.5)
{sehr gut};
\draw (2.5,0.1) -- (2.5, 1.95);
\draw (5,0.1) -- (5, 1.95);
\end{tikzpicture}
\end{document}
I had to recode it and use an example from this page as template. I still don't know what caused this repeated language labels. But this solution should solve it and have decreased distances.
By the way, if you are looking for a good template for CV's in LaTeX look on Overleaf (I like moderncv).

Related

pgfplots "Soft clip" of "Fill between" not working with loglogaxis

I am struggling with soft clipping a fill between when using a loglogaxis. The soft-clip domain seems to be completely off; i.e. setting soft clip={domain=1:1} yields the same result as no domain at all.
Yet a domain soft clip={domain=0:10000000000} results in a horizontal clip:
The pgfplots manual doesn't give an example for clipping on a loglogaxis, might it be it's simply not supported? If it is, can anyone point me on how to clip to soft clip={domain=3.7E4:5.5E5} ?
My MWE:
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\def\xmin{1E4}
\def\xmax{1E7}
\begin{loglogaxis}[
xmin=\xmin,xmax=\xmax,
ymin=1E-2,ymax=1000,
xlabel={Re [-]},
small,
height=4cm,
width=15cm,
xtick={1E4,1E5,1E6,1E7},
extra x ticks={3.7E4,5.5E5},
extra x tick labels ={3.7E4,5.5E5},
extra x tick style={
tickwidth=\pgfkeysvalueof{/pgfplots/minor tick length},
tick label style={yshift=-0.5mm}
},
ytick={1E-2,1E-1,1,10},
yticklabels={,,1},
extra y ticks={1E-2,1E-1},
grid=major,
domain=1E4:1E7,
]
\def\D{1.4}
\def\yplus{30}
\addplot[name path = C,thick,domain=1E4:1E7] {\yplus/((1/2*(2*log10(x)-0.65)^(-2.3)*(x/\D)^2)^(1/2)/1000)};
\def\yplus{300}
\addplot[name path = D,thick,domain=1E4:1E7] {\yplus/((1/2*(2*log10(x)-0.65)^(-2.3)*(x/\D)^2)^(1/2)/1000)};
\addplot [gray!30] fill between[of=C and D, soft clip={domain=3.7E4:5.5E5}];
\end{loglogaxis}
\end{tikzpicture}%
\end{document}
You could use the following technique to clip it:
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\def\xmin{1E4}
\def\xmax{1E7}
\begin{loglogaxis}[
xmin=\xmin,xmax=\xmax,
ymin=1E-2,ymax=1000,
xlabel={Re [-]},
small,
height=4cm,
width=15cm,
xtick={1E4,1E5,1E6,1E7},
extra x ticks={3.7E4,5.5E5},
extra x tick labels ={3.7E4,5.5E5},
extra x tick style={
tickwidth=\pgfkeysvalueof{/pgfplots/minor tick length},
tick label style={yshift=-0.5mm}
},
ytick={1E-2,1E-1,1,10},
yticklabels={,,1},
extra y ticks={1E-2,1E-1},
grid=major,
domain=1E4:1E7,
]
\def\D{1.4}
\def\yplus{30}
\addplot[name path = C,thick,domain=1E4:1E7] {\yplus/((1/2*(2*log10(x)-0.65)^(-2.3)*(x/\D)^2)^(1/2)/1000)};
\def\yplus{300}
\addplot[name path = D,thick,domain=1E4:1E7] {\yplus/((1/2*(2*log10(x)-0.65)^(-2.3)*(x/\D)^2)^(1/2)/1000)};
\draw [
help lines,
name path=clippath]
(3.7E4,1E-2) rectangle (5.5E5,1E3);
\addplot [gray!30] fill between[of=C and D,soft clip={clippath}];
\end{loglogaxis}
\end{tikzpicture}%
\end{document}

Getting the x and y coordinates from TikZ

For the following
\node (formula) [] {$2x+3y$};
\draw[-latex,red] ($(formula.north west)$) arc
How could I extract the x coordinate. That is, I'm assuming that formula.north west is in the form (x,y), how can I get the x and y coordinates separately?
I'm using \tikzmath and want to do something like
\x1 = (formula.north west).x
if that makes sense?
You can use the let operation to assign the coordinate to a point register:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\node (formula) [] {$2x+3y$};
\draw[red] let \p1 = (formula.north west)
in (\x1,\y1) circle [radius=0.1];
\end{tikzpicture}
\end{document}

Graph in Latex using Tikz and PGFplots

How to draw this graph in LaTeX? I have used TikZ but I can't get it done exactly.
This is what I have tried so far:
\begin{tikzpicture}
\tkzInit[xmax=6,ymax=6,xmin=-6,ymin=-1]
\tkzAxeXY
\draw[thick] (6,3) -- (-4,5);
\filldraw[black] (6,3) circle (2pt) node[anchor=west] {A(6,3)};
\filldraw[black] (-4,5) circle (2pt) node[anchor=east] {B(-4,5)};
\end{tikzpicture}
Using regular pgfplots you could do the following: Draw the line with the points you choose and label them with nodes. Then draw the additional distance markers using \draw in the axis coordinate system (The concrete positions of all elements may have to be adjusted).
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\tiny
\begin{axis}[
width = 6cm,
height = 4cm,
ymajorgrids = true,
ymin=-1,
ymax=7,
xmin=-6,
xmax=6,
xtick distance=1,
ytick distance=1,
axis y line*=center,
axis x line*=center,
enlarge x limits=.12
]
\addplot+[sharp plot] coordinates {(6,3) (1,4) (-4,5) } node[below=1mm, pos=0] {A(6,3)}
node[pos=0.45,below=1mm] {P(x,y)}
node[pos=1,below=1mm] {B(-4,5)};
\draw[|-|] (axis cs:1.2,5) -- node [above, rotate=-10] {m=13} (axis cs:6.3,3.9);
\draw[|-|] (axis cs:-3.8,6) -- node [above, rotate=-10, pos=.3] {n=2} (axis cs:1.2,5);
\end{axis}
\end{tikzpicture}
\end{document}
Output:

How do you use both curved and straight voltages in LaTeX with circuitikz package? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
Currently I am using:
\usepackage[european,straightvoltages]{circuitikz}
and in the body I have only:
\begin{circuitikz}
\draw
(0,0) to[R = $R_6$, v = $U_{R6}$] (1.5,0)
to[R = $R_6$, v = $U_{R6}$] (3,0)
;
\end{circuitikz}
Please do not care about the naming. I just need to have both straight and curved voltage in the same file in LaTeX.
There is the whole code if it helps:
\documentclass[a4paper,11pt]{article}
\usepackage[european,straightvoltages]{circuitikz}
\begin{document}
\section{My header}
\begin{circuitikz}
\draw
(0,0) to[R = $R_6$, v = $U_{R6}$] (1.5,0)
to[R = $R_6$, v = $U_{R6}$] (3,0)
;
\end{circuitikz}
\end{document}
You can use voltage=straight to change the style of individual elements:
\documentclass[a4paper,11pt]{article}
\usepackage[european]{circuitikz}
\begin{document}
\section{My header}
\begin{circuitikz}
\draw
(0,0) to[R = $R_6$, v = $U_{R6}$] (1.5,0)
to[R = $R_6$, v = $U_{R6}$, voltage=straight] (3,0)
;
\end{circuitikz}
\end{document}

Multiple horizontal bar-charts in a row in latex

I have three horizontal bar-charts that I created using both the Tikz package and PGF plots package in latex. I am using Overleaf. The three horizontal bar-charts look like the following:
Is there a way to nest these horizontal bar-charts in a row in a latex document? I need this in order to save space for a paper I am working on. So what I am looking for is this (note: this 2nd image is meant to illustrate what I am looking for exactly):
This is the set up currently:
\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage{tabularx,booktabs}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{sfmath}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{algorithm, algorithmic}
\usepackage{makeidx}
\usepackage{soul}
\usepackage{color}
\usepackage{colortbl}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{amsthm,amssymb,amsmath}
\begin{document}
\pgfplotsset{width=5cm,compat=1.15}
\begin{center}
\begin{figure}[h]
\begin{tikzpicture}
\begin{axis}[title = \textbf{2016 Data-set Results: Parameters for a Successful game},
xbar,
y axis line style = { opacity = 0 },
axis x line = none,
tickwidth = 0pt,
ytick = data,
enlarge y limits = 0.05,
enlarge x limits = 0.02,
width=0.3\textwidth,
bar width=2mm,
symbolic y coords = {User Count, Critic Count, Critic Score, User Score, Platform, Genre, Rating},
nodes near coords,
]
\addplot coordinates { (100,User Count) (93,Critic Count) (57,Critic Score) (20,User Score) (10.5,Platform) (2.3,Genre) (4.52,Rating) };
\end{axis}
\end{tikzpicture}
\caption{Results for the 2016 Dataset on what parameters make a successful game.}
\end{figure}
\end{center}
\pgfplotsset{width=5cm,compat=1.15}
\begin{center}
\begin{figure}[h]
\begin{tikzpicture}
\begin{axis}[title = \textbf{2017 Data-set Results: Parameters for a Successful game},
xbar,
y axis line style = { opacity = 0 },
axis x line = none,
tickwidth = 0pt,
ytick = data,
enlarge y limits = 0.05,
enlarge x limits = 0.02,
width=0.3\textwidth,
bar width=2mm,
symbolic y coords = {User Count, Critic Count, Critic Score, User Score, Platform, Genre, Rating},
nodes near coords,
]
\addplot coordinates { (100,User Count) (80,Critic Count) (56,Critic Score) (20,User Score) (8.47,Platform) (2.35,Genre) (3.675,Rating) };
\end{axis}
\end{tikzpicture}
\caption{Results for the 2017 Dataset on what parameters make a successful game.}
\end{figure}
\end{center}
\pgfplotsset{width=5cm,compat=1.15}
\begin{center}
\begin{figure}[h]
\begin{tikzpicture}
\begin{axis}[title = \textbf{2019 Data-set Results: Parameters for a Successful game},
xbar,
y axis line style = { opacity = 0 },
axis x line = none,
tickwidth = 0pt,
ytick = data,
enlarge y limits = 0.05,
enlarge x limits = 0.02,
width=0.3\textwidth,
bar width=2mm,
symbolic y coords = {User Count, Critic Count, Critic Score, User Score, Platform, Genre, Rating},
nodes near coords,
]
\addplot coordinates { (99.8,User Count) (73.6,Critic Count) (71.3,Critic Score) (21,User Score) (9.58,Platform) (2.35,Genre) (4,Rating) };
\end{axis}
\end{tikzpicture}
\caption{Results for the 2019 Dataset on what parameters make a successful game.}
\end{figure}
\end{center}
\end{document}

Resources