pgfplots画二维图真的很方便,多例比较
%直接PDFLATEX编译即可
\documentclass[border=1mm]{standalone}
\usepackage{tkz-euclide,pgfplots}
\begin{document}
\begin{tikzpicture}[domain=0:4]
\tkzInit[xmax=4.2,ymax=4.2,xmin=-1.2,ymin=-3.2,xstep=1]
\tkzGrid
\tkzAxeXY
\draw[color=red] plot (\x,\x) node[right] {$f(x)=x$};
\draw[color=orange,domain=-0.5:4] plot (\x,{0.05*exp(\x)}) node[right] {$f(x)=\frac{1}{20}\mathrm e^x$};
\draw[color=blue,domain=0:4] plot (\x,{sin(\x r)}) node[right] {$f(x)=\sin x$};
\draw[color=blue!50,x=1cm,y=0.5cm,domain=-0.5:2.4] plot (\x, {(\x)^3-4*(\x)+2}) node[right] {$f(x)=x^3-4x+2$};
\end{tikzpicture}
\end{document}
%直接PDFLATEX编译即可
\documentclass[border=1mm]{standalone}
\usepackage{tkz-euclide,pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[x=.5cm,xmin=0,ymin=0]
\addplot[mark=none,smooth,red,thick] expression[domain=0:12]{exp(((x-6)^2)/(-9))};
\addplot[mark=none,smooth,blue,thick] expression[domain=1:19]{exp(((x-10)^2)/(-25))};
\addplot[mark=none,smooth,ultra thick] expression[domain=7.5:12]{exp(((x-6)^2)/(-9))};
\addplot[mark=none,smooth,ultra thick] expression[domain=1:7.5]{exp(((x-10)^2)/(-25))};
\addplot[dotted,mark=none]coordinates{(6,0)(6,1)};
\addplot[dotted,mark=none]coordinates{(10,0)(10,1)(0,1)};
\addplot[dashed,mark=none]coordinates{(7.5,0)(7.5,0.7788)(0,0.7788)};
\node[pin=-45:{$P$}] at (axis cs:0,0.7788) {};
\node[pin=135:{$P_x$}] at (axis cs:7.5,0) {};
\end{axis}
\end{tikzpicture}
\end{document}
%直接PDFLATEX编译即可
\documentclass[border=1mm]{standalone}
\usepackage{tkz-euclide,pgfplots}
\begin{document}
\begin{tikzpicture}[domain=0:4]
\draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
\draw[->,>=angle 90] (-0.2,0) -- (4.2,0) node[right] {$x$};
\draw[->,>=angle 90] (0,-1.2) -- (0,4.2) node[above] {$f(x)$};
%plot选项请看pgfmanual手册第224页
\draw[color=red] plot (\x,\x) node[right] {$f(x)=x$};
\draw[color=orange] plot (\x,{0.05*exp(\x)}) node[right] {$f(x)=\frac{1}{20}\mathrm e^x$};
%下面的sin函数,要注意弧度和度数单位的转换,手册第225页
\draw[color=blue] plot (\x,{sin(\x r)}) node[right] {$f(x)=\sin x$};
\draw[color=blue,x=1cm,y=0.5cm,domain=-0.5:2.4] plot (\x, {(\x)^3-4*(\x)+2}) node[right] {$f(x)=x^3-4x+2$};
\end{tikzpicture}
\end{document}
from: http://blog.sina.com.cn/s/blog_01ea595801013ig7.html
pgfplots画二维图真的很方便,多例比较的更多相关文章
- matlab 画二维图与三维图
二维图 ezplot('sin(x)');%默认范围 ezplot('sin(x)',[-4 4]);%自己设定范围 三维图 ezmesh('x*x+y*y');%默认范围
- matplotlib---插值画二维、三维图
一.画二维图 1.原始数据(x,y) import matplotlib.pyplot as plt import numpy as np #数据 X = np.array(list(i for i ...
- matlab画二维直方图以及双y轴坐标如何修改另一边y轴的颜色
1.首先讲一下如何用hist画二维直方图 x=[- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...
- 小小知识点(三)——MATLAB如何把三维图用二维图表示
MATLAB程序: x=-1:0.1:1; [x y] = meshgrid(x); %grid data = load("filename.txt"); figure mesh( ...
- vue 画二维码
首先安装一下相关的插件 qrcode2 npm install --save qrcode2 然后在需要画二维码的页面引入一下 import QRCode from 'qrcode2' 最后在meth ...
- MFC画二维动态图表[GDI]
源博客:http://www.codeproject.com/Articles/9350/2D-Animated-Charts 源代码:http://download.csdn.net/detail/ ...
- python3怎样画二维点图
引用自:http://www.cnblogs.com/super-zhang-828/p/4792206.html import matplotlib.pyplot as pltplt.plot([1 ...
- js通过codeURL画二维码
一.函数封装 //生成微信二维码 function xyqrcode(options) { var settings = { dom:'', render: 'canvas', //生成二维码的格式还 ...
- Android二维码开源项目zxing用例简化和生成二维码、条形码
上一篇讲到:Android二维码开源项目zxing编译,编译出来后有一个自带的測试程序:CaptureActivity比較复杂,我仅仅要是把一些不用的东西去掉,用看起来更方便,二维码和条形码的流行性自 ...
随机推荐
- hdu 1426(DFS+坑爹的输入输出)
Sudoku Killer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- Efficient Graph-Based Image Segmentation
转:http://blog.csdn.net/asongoficeandfire/article/details/8434799 Efficient Graph-Based Image Segment ...
- [转载] 更改pip源至国内镜像,显著提升下载速度
原文地址: https://blog.csdn.net/lambert310/article/details/52412059 经常在使用python的时候需要安装各种模块,而pip是很强大的模块安装 ...
- Pychram------更改编辑区域的字体大小和背景颜色
如上设置完成即可看到如下的效果设置完成.
- hdu5798
官方题解: 考虑去掉abs符号,发现只有相邻两个数的最高位被影响了才会影响abs的符号,所以可以按照最高位不一样的位置分类,之后考虑朴素枚举x从0到2^20,每次的复杂度是O(400),无法通过,考虑 ...
- bzoj 3295 CDQ求动态逆序对
#include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk mak ...
- 六十五 async/await
用asyncio提供的@asyncio.coroutine可以把一个generator标记为coroutine类型,然后在coroutine内部用yield from调用另一个coroutine实现异 ...
- tomcat放置静态html页面
因公司tomcat网站需要部署一个html的静态网页上去 在项目目录下建立了一个 /usr/local/tomcat/apache-tomcat-brain-api/webapps/ROOT/html ...
- 阿里云轻量级学生机搭建FTP最新教程
碰了几次壁,我整理一下分析自己在阿里云上成功安装FTP的教程. 1.使用root用户进入云服务器. 2.rpm -qa|grep vsftpd 查看是否安装了ftp,一般阿里云服务器你以前没安装过, ...
- HTML5+中动态构建列表并填充数据
部分代码参考demo----<历史上的今天>. 感谢作者的分享,愿好人一生平安,虽然只有两个页面,但是通过这个示例让我学会了5+中如何动态构建列表并填充数据,非常实用. html部分: & ...