LaTex画双y轴折线图

\usepackage{pgfplots} %引用包

\pgfplotsset{compat=newest}

% compat 指定 pgfplots 的版本, 这里用最新。也可以直接用版本号,如1.13
%如果不指定新版本, y与z可能会重合。
 

\begin{figure}[!h] %插入图片
\centering %图片居中

\begin{tikzpicture} %tikz图片

\begin{axis}[
    axis y line*=left,%y轴居左
    xlabel=x, %横坐标名
    ylabel=y, %纵坐标名
    tick align=outside, %刻度在外显式
    ]

%第一条线,mark是折线标示形状
\addplot[smooth,mark=*,blue] plot coordinates { 
    (20,1)
    (40,2)
    (60,3)
    (80,4)
    (100,5)
};

%图例里名字
\label{plot_one}

%第二条线,mark是折线标示形状

\addplot[smooth,mark=triangle,cyan] plot coordinates {
    (20,1.3)
    (40,2.3)
    (60,3.3)
    (80,4.3)
    (100,5.3)
};
\label{plot_two}

\end{axis}

%第三条线, 用另一个y轴

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值