pgfplot | tikzpicture | 更改长度+蜱的宽度

Johnny Canuck 05/29/2015. 1 answers, 4.636 views
tikz-pgf pgfplots ticks

虽然有任何关于如何用tick标签或tick标签或tick颜色(从拉丁文)拨动的帖子,但我一直无法找到任何东西(在工作示例或文档中),如何改变蜱自身的长度和宽度。 也许我只是没有找到正确的搜索短语。

无论如何,这个问题可能不需要MWE,但是为了提供一个简单的“示范回答”,下面是一个简单的图表,我想减小长度(从刻度线顶部到轴线的距离)通过(比如说)50%,相对于默认长度。 非常感谢。

  \ {的DocumentClass文章}  \ usepackage {pgfplots}   \ {开始}文件   \ {开始} tikzpicture      \开始{轴}        [width = 190pt,axis x line = middle,axis y line = center,        剔对齐=外部,        XMIN = 0.3,XMAX = 7.7,YMIN = 0.44,YMAX = 1.05,        xlabel = {\ emph {x轴标签}},ylabel = {\ emph {y轴标签}},        XTICK = {1,2,3,4,5,6,7},ytick = {0.5,0.6,0.7,0.8,0.9,1.0}        x label style = {at = {(axis description cs:0.5,-0.1)},anchor = north},        y标签style = {at = {(axis description cs:-0.1,.5)},rotate = 90,anchor = south},       每个tick / .style = {black,semithick,height = 1cm},        ylabel style = {yshift = 0.2cm},xlabel style = {yshift = -0.2cm}]          \ addplot + [mark = none,smooth,thick] plot coordinates {              (1,1)              (2,0.75)              (3,0.666)              (4,0.625)              (5,0.6)              (6,0.5833)              (7,0.571)          };          \ addplot [red,dashed,no markers,thick] coordinates {(0.3,0.5)(7.7,0.5)};      \ {端轴}  \ {端} tikzpicture  \ {端文档} 

1 Answers


Heiko Oberdiek 04/13/2017.

可以通过选项major tick length (或者别名滴答滴答长度)来配置major tick lengthminor tick length可以配置选项minor tick length (或者subtickwidth minor tick length ),在这种情况下,我们只有大滴答,默认值是subtickwidth ,可以派生通过\pgfkeysvalueof{/pgfplots/major tick length} 。我在pgfplots 手册的“4.15.4滴答微调”部分找到了选项名称。

例如,将tick长度设置为默认值的50%:

\documentclass{article}
\usepackage{pgfplots}
%\pgfplotsset{compat=1.12}

\begin{document}
\begin{tikzpicture}
    \pgfmathsetlengthmacro\MajorTickLength{
      \pgfkeysvalueof{/pgfplots/major tick length} * 0.5
    }
    \begin{axis}[ 
      width=190pt,
      axis x line=middle,
      axis y line=center,
      tick align=outside,
      xmin=0.3, 
      xmax=7.7, 
      ymin=0.44,
      ymax=1.05,
      xlabel={\emph{x-axis label}},
      ylabel={\emph{y-axis label}},
      xtick={1,2,3,4,5,6,7},
      ytick={0.5,0.6,0.7,0.8,0.9,1.0},
      x label style={
        at={(axis description cs:0.5,-0.1)},
        anchor=north,
      },
      y label style={
        at={(axis description cs:-0.1,.5)},
        rotate=90,   
        anchor=south,
      },
      major tick length=\MajorTickLength,
      every tick/.style={
        black,
        semithick,
      },
      ylabel style={yshift=0.2cm},
      xlabel style={yshift=-0.2cm}
    ]
        \addplot+[mark=none,smooth, thick]  plot coordinates {
            (1,1)     
            (2,0.75)  
            (3,0.666) 
            (4,0.625) 
            (5,0.6)   
            (6,0.5833)
            (7,0.571)
        };
        \addplot [red, dashed, no markers, thick] coordinates {(0.3,0.5)
        (7.7,0.5)};
    \end{axis}   
\end{tikzpicture}
\end{document} 

Result

大胆的勾号

这是CroCo 评论的答案。

粗体滴答号可以通过选项tick label style 。 由于默认情况下,数字模式设置为数学模式(请参阅\axisdefaultticklabel ), \boldmath获取大写刻度数字:

tick label style=\boldmath, 

Result with bold tick numbers

3 comments
Johnny Canuck 05/29/2015
丹克 - 不知道我错过了这个选择(或者我看到了它,并没有将它应用到我的'问题'上)。
CroCo 11/22/2015
如何仅使刻度号码变为粗体?
1 Heiko Oberdiek 11/23/2015
@CroCo查看更新的答案。

HighResolutionMusic.com - Download Hi-Res Songs

1 Alan Walker

Diamond Heart flac

Alan Walker. 2018. Writer: Alan Walker;Sophia Somajo;Mood Melodies;James Njie;Thomas Troelsen;Kristoffer Haugan;Edvard Normann;Anders Froen;Gunnar Greve;Yann Bargain;Victor Verpillat;Fredrik Borch Olsen.
2 Sia

I'm Still Here flac

Sia. 2018. Writer: Sia.
3 Cardi B

Taki Taki flac

Cardi B. 2018. Writer: Bava;Juan Vasquez;Vicente Saavedra;Jordan Thorpe;DJ Snake;Ozuna;Cardi B;Selena Gomez.
4 Little Mix

Woman Like Me flac

Little Mix. 2018. Writer: Nicki Minaj;Steve Mac;Ed Sheeran;Jess Glynne.
5 Halsey

Without Me flac

Halsey. 2018. Writer: Halsey;Delacey;Louis Bell;Amy Allen;Justin Timberlake;Timbaland;Scott Storch.
6 Lady Gaga

I'll Never Love Again flac

Lady Gaga. 2018. Writer: Benjamin Rice;Lady Gaga.
7 Bradley Cooper

Shallow flac

Bradley Cooper. 2018. Writer: Andrew Wyatt;Anthony Rossomando;Mark Ronson;Lady Gaga.
8 Bradley Cooper

Always Remember Us This Way flac

Bradley Cooper. 2018. Writer: Lady Gaga;Dave Cobb.
9 Kelsea Ballerini

This Feeling flac

Kelsea Ballerini. 2018. Writer: Andrew Taggart;Alex Pall;Emily Warren.
10 Mako

Rise flac

Mako. 2018. Writer: Riot Music Team;Mako;Justin Tranter.
11 Dewain Whitmore

Burn Out flac

Dewain Whitmore. 2018. Writer: Dewain Whitmore;Ilsey Juber;Emilio Behr;Martijn Garritsen.
12 Avril Lavigne

Head Above Water flac

Avril Lavigne. 2018. Writer: Stephan Moccio;Travis Clark;Avril Lavigne.
13 Khalid

Better flac

Khalid. 2018. Writer: Charlie Handsome;Jamil Chammas;Denis Kosiak;Tor Erik Hermansen;Mikkel Stoleer Eriksen;Khalid.
14 Lady Gaga

Look What I Found flac

Lady Gaga. 2018. Writer: DJ White Shadow;Nick Monson;Mark Nilan Jr;Lady Gaga.
15 Deep Chills

Run Free flac

Deep Chills. 2018.
16 Dynoro

In My Mind flac

Dynoro. 2018. Writer: Georgi Kay;Feenixpawl;Ivan Gough.
17 Charli XCX

1999 flac

Charli XCX. 2018. Writer: Charli XCX;Troye Sivan;Leland;Oscar Holter;Noonie Bao.
18 NCT 127

Regular (English Version) flac

NCT 127. 2018.
19 Lukas Graham

Love Someone flac

Lukas Graham. 2018. Writer: Don Stefano;Morten "Rissi" Ristorp;Morten "Pilo" Pilegaard;Jaramye Daniels;James Alan;David LaBrel;Lukas Forchhammer Graham.
20 Rita Ora

Let You Love Me flac

Rita Ora. 2018. Writer: Rita Ora.

Related questions

Hot questions

Language

Popular Tags