Last active
December 16, 2015 11:39
-
-
Save mkacky/5429047 to your computer and use it in GitHub Desktop.
グラフの中に小さいグラフを挿入
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
#import numpy | |
from pylab import * | |
# TeX形式のテキストを表示するために必要 | |
rcParams["text.usetex"]=True | |
############################################### | |
# 青いラインを描画 | |
x1 = arange(0.0, 2.0, 0.01) | |
plot(x1, x1**2, label="f(x)", color="blue") | |
title("Quadratic Curve") | |
xlabel("$x$") | |
ylabel("$f(x) = x^2$") | |
legend(loc="lower right") | |
############################################### | |
# 緑のラインを描画 | |
# axes([left, bottom, width, height]) | |
a = axes([0.25, 0.55, 0.3, 0.3]) | |
x2 = arange(-5.0, 5.0, 0.01) | |
plot(x2, x2**3, label="g(x)", color="green") | |
title("Cubic Curve") | |
xlabel("$x$") | |
ylabel("$g(x) = x^3$") | |
legend(loc="upper left") | |
# 表示 | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment